diff --git a/docs/mpmc/priority_queue.md b/docs/mpmc/priority_queue.md index 5c85133..f92e63d 100644 --- a/docs/mpmc/priority_queue.md +++ b/docs/mpmc/priority_queue.md @@ -30,7 +30,7 @@ if (read_success) { There is also a `std::optional` API for `Pop`: ```c -auto read = queue_events.PopOptional(); +auto read = queue_events.Pop(); if (read) { actor2.ProcessEvent(read); diff --git a/docs/mpmc/queue.md b/docs/mpmc/queue.md index fc013b2..fda065e 100644 --- a/docs/mpmc/queue.md +++ b/docs/mpmc/queue.md @@ -30,7 +30,7 @@ if (read_success) { There is also a `std::optional` API for the `Pop` method: ```c -auto job = queue_jobs.PopOptional(); +auto job = queue_jobs.Pop(); if (job) { worker.ProcessJob(read); diff --git a/docs/spsc/priority_queue.md b/docs/spsc/priority_queue.md index 95da656..13a30fb 100644 --- a/docs/spsc/priority_queue.md +++ b/docs/spsc/priority_queue.md @@ -30,7 +30,7 @@ if (read_success) { There is also a `std::optional` API for `Pop`: ```c -auto read = queue_events.PopOptional(); +auto read = queue_events.Pop(); if (read) { actor2.ProcessEvent(read); diff --git a/docs/spsc/queue.md b/docs/spsc/queue.md index 971f4b1..268a438 100644 --- a/docs/spsc/queue.md +++ b/docs/spsc/queue.md @@ -30,7 +30,7 @@ if (read_success) { There is also a `std::optional` API for the `Pop` method: ```c -auto read = queue_adc.PopOptional(); +auto read = queue_adc.Pop(); if (read) { DoStuffWithData(read); diff --git a/lockfree/mpmc/priority_queue.hpp b/lockfree/mpmc/priority_queue.hpp index 296afbd..1ed3ac0 100644 --- a/lockfree/mpmc/priority_queue.hpp +++ b/lockfree/mpmc/priority_queue.hpp @@ -83,7 +83,7 @@ template class PriorityQueue { * Should only be called from the consumer thread. * @retval Either the element or nothing if the queue is empty. */ - std::optional PopOptional(); + std::optional Pop(); #endif /********************** PRIVATE MEMBERS ***********************/ diff --git a/lockfree/mpmc/priority_queue_impl.hpp b/lockfree/mpmc/priority_queue_impl.hpp index 8905929..ad06b3a 100644 --- a/lockfree/mpmc/priority_queue_impl.hpp +++ b/lockfree/mpmc/priority_queue_impl.hpp @@ -68,7 +68,7 @@ bool PriorityQueue::Pop(T &element) { /********************* std::optional API **********************/ #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) template -std::optional PriorityQueue::PopOptional() { +std::optional PriorityQueue::Pop() { T element; bool result = Pop(element); diff --git a/lockfree/mpmc/queue.hpp b/lockfree/mpmc/queue.hpp index f4d0bbb..894d6a5 100644 --- a/lockfree/mpmc/queue.hpp +++ b/lockfree/mpmc/queue.hpp @@ -80,7 +80,7 @@ template class Queue { * @brief Removes an element from the queue. * @retval Either the element or nothing */ - std::optional PopOptional(); + std::optional Pop(); #endif /*********************** PRIVATE TYPES ************************/ diff --git a/lockfree/mpmc/queue_impl.hpp b/lockfree/mpmc/queue_impl.hpp index 439d64e..00fc0cf 100644 --- a/lockfree/mpmc/queue_impl.hpp +++ b/lockfree/mpmc/queue_impl.hpp @@ -113,8 +113,7 @@ template bool Queue::Pop(T &element) { /********************* std::optional API **********************/ #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -template -std::optional Queue::PopOptional() { +template std::optional Queue::Pop() { T element; bool result = Pop(element); diff --git a/lockfree/spsc/priority_queue.hpp b/lockfree/spsc/priority_queue.hpp index 7af2577..8661496 100644 --- a/lockfree/spsc/priority_queue.hpp +++ b/lockfree/spsc/priority_queue.hpp @@ -84,7 +84,7 @@ template class PriorityQueue { * Should only be called from the consumer thread. * @retval Either the element or nothing if the queue is empty. */ - std::optional PopOptional(); + std::optional Pop(); #endif /********************** PRIVATE MEMBERS ***********************/ diff --git a/lockfree/spsc/priority_queue_impl.hpp b/lockfree/spsc/priority_queue_impl.hpp index 6884cb2..1309715 100644 --- a/lockfree/spsc/priority_queue_impl.hpp +++ b/lockfree/spsc/priority_queue_impl.hpp @@ -69,7 +69,7 @@ bool PriorityQueue::Pop(T &element) { /********************* std::optional API **********************/ #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) template -std::optional PriorityQueue::PopOptional() { +std::optional PriorityQueue::Pop() { T element; bool result = Pop(element); diff --git a/lockfree/spsc/queue.hpp b/lockfree/spsc/queue.hpp index 3907db9..d3d4e85 100755 --- a/lockfree/spsc/queue.hpp +++ b/lockfree/spsc/queue.hpp @@ -83,7 +83,7 @@ template class Queue { * Should only be called from the consumer thread. * @retval Either the element or nothing */ - std::optional PopOptional(); + std::optional Pop(); #endif /********************** PRIVATE MEMBERS ***********************/ diff --git a/lockfree/spsc/queue_impl.hpp b/lockfree/spsc/queue_impl.hpp index 760db33..f0ddfbd 100644 --- a/lockfree/spsc/queue_impl.hpp +++ b/lockfree/spsc/queue_impl.hpp @@ -94,8 +94,7 @@ template bool Queue::Pop(T &element) { /********************* std::optional API **********************/ #if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) -template -std::optional Queue::PopOptional() { +template std::optional Queue::Pop() { T element; bool result = Pop(element); diff --git a/tests/mpmc/priority_queue.cpp b/tests/mpmc/priority_queue.cpp index ab76ce0..3678f97 100644 --- a/tests/mpmc/priority_queue.cpp +++ b/tests/mpmc/priority_queue.cpp @@ -74,6 +74,6 @@ TEST_CASE("mpmc::PriorityQueue - Optional API", "[mpmc_pq_optional_api]") { bool const push_success = queue.Push(-1024, 0); REQUIRE(push_success); - auto const read = queue.PopOptional(); + auto const read = queue.Pop(); REQUIRE(read == -1024); } diff --git a/tests/mpmc/queue.cpp b/tests/mpmc/queue.cpp index 5b9338b..bc14076 100644 --- a/tests/mpmc/queue.cpp +++ b/tests/mpmc/queue.cpp @@ -84,8 +84,8 @@ TEST_CASE("mpmc::Queue - Write with overflow and read back from start", TEST_CASE("mpmc::Queue - Optional API", "[mpmc_q_optional_api]") { lockfree::mpmc::Queue queue; - REQUIRE(!queue.PopOptional()); + REQUIRE(!queue.Pop()); queue.Push(-1024); - REQUIRE(queue.PopOptional() == -1024); + REQUIRE(queue.Pop() == -1024); } diff --git a/tests/spsc/priority_queue.cpp b/tests/spsc/priority_queue.cpp index 9db1498..e3d74d4 100644 --- a/tests/spsc/priority_queue.cpp +++ b/tests/spsc/priority_queue.cpp @@ -148,6 +148,6 @@ TEST_CASE("spsc::PriorityQueue - Optional API", "[pq_optional_api]") { bool const push_success = queue.Push(-1024, 0); REQUIRE(push_success); - auto const read = queue.PopOptional(); + auto const read = queue.Pop(); REQUIRE(read == -1024); } diff --git a/tests/spsc/queue.cpp b/tests/spsc/queue.cpp index 3099c24..b6a09dc 100644 --- a/tests/spsc/queue.cpp +++ b/tests/spsc/queue.cpp @@ -84,10 +84,10 @@ TEST_CASE("spsc::Queue - Write with overflow and read back from start", TEST_CASE("spsc::Queue - Optional API", "[q_optional_api]") { lockfree::spsc::Queue queue; - REQUIRE(!queue.PopOptional()); + REQUIRE(!queue.Pop()); queue.Push(-1024); - REQUIRE(queue.PopOptional() == -1024); + REQUIRE(queue.Pop() == -1024); } TEST_CASE("spsc::Queue - Multithreaded read/write", "[q_multithread]") {