7 #include <glog/logging.h>
11 #define JODA_FLAG_T uint32_t
16 #define JODA_QUEUE_WAIT_TIME 1ms
25 size_t maxImplicit = 0)
26 :
queue(minCapacity, maxExplicitProducers, maxImplicit) {}
32 constexpr
auto getFlag() {
return flag; };
55 DLOG(INFO) <<
"Registered " << i + 1 <<
"th producer in queue " << flag;
61 DLOG(INFO) <<
"Unregistered " << i <<
"th producer in queue " << flag;
67 DLOG(INFO) << i + 1 <<
" Producer finished in queue " << flag;
70 DLOG(INFO) <<
"Queue " << flag <<
" finished";
75 using namespace std::chrono_literals;
76 auto te = std::move(e);
85 using namespace std::chrono_literals;
86 auto te = std::move(e);
94 template <
typename It>
96 using namespace std::chrono_literals;
104 template <
typename It>
105 void send(It e,
size_t count) {
106 using namespace std::chrono_literals;
115 using namespace std::chrono_literals;
125 using namespace std::chrono_literals;
134 template <
typename It>
143 template <
typename It>
160 return std::make_unique<queue_t>();
162 static std::unique_ptr<queue_t>
getQueue(
size_t minCapacity,
163 size_t maxProducers) {
164 return std::make_unique<queue_t>(minCapacity, maxProducers);
#define JODA_QUEUE_WAIT_TIME
Definition: Queue.h:16
JODA_NULL_QUEUE NullQueue
Definition: Queue.h:168
#define JODA_FLAG_T
Definition: Queue.h:11
Definition: concurrentqueue.h:802
bool try_dequeue(U &item)
Definition: concurrentqueue.h:1197
size_t try_dequeue_bulk(It itemFirst, size_t max)
Definition: concurrentqueue.h:1313
bool try_enqueue(T const &item)
Definition: concurrentqueue.h:1139
bool try_enqueue_bulk(It itemFirst, size_t count)
Definition: concurrentqueue.h:1176
@ memory_order_acquire
Definition: atomicops.h:73
@ memory_order_relaxed
Definition: atomicops.h:72
@ memory_order_release
Definition: atomicops.h:74
static std::unique_ptr< queue_t > getQueue()
Definition: Queue.h:159
bool payload_t
Definition: Queue.h:156
static std::unique_ptr< queue_t > getQueue(size_t minCapacity, size_t maxProducers)
Definition: Queue.h:162
JODA_SHARED_QUEUE(JODA_SHARED_QUEUE &c)=delete
void send(typename queue_t::producer_token_t &ptok, It e, size_t count)
Definition: Queue.h:95
std::atomic< unsigned long > finished
Definition: Queue.h:37
void retrieve(typename queue_t::consumer_token_t &ctok, payload_t &e)
Definition: Queue.h:124
queue_t::producer_token_t ptok_t
Definition: Queue.h:21
queue_t queue
Definition: Queue.h:32
void producerFinished()
Definition: Queue.h:65
constexpr auto getFlag()
Definition: Queue.h:32
void send(It e, size_t count)
Definition: Queue.h:105
std::atomic< unsigned long > inQueue
Definition: Queue.h:35
queue_t::consumer_token_t ctok_t
Definition: Queue.h:22
void retrieve(payload_t &e)
Definition: Queue.h:114
std::atomic< unsigned long > registered
Definition: Queue.h:36
size_t retrieve(typename queue_t::consumer_token_t &ctok, It e, size_t count)
Definition: Queue.h:144
moodycamel::ConcurrentQueue< payload_t, queue_trait > queue_t
Definition: Queue.h:20
JODA_SHARED_QUEUE(size_t minCapacity, size_t maxExplicitProducers, size_t maxImplicit=0)
Definition: Queue.h:24
bool isFinished()
Definition: Queue.h:42
std::atomic< bool > finishedWriting
Definition: Queue.h:40
std::pair< size_t, size_t > getStatistics()
Definition: Queue.h:47
JODA_SHARED_QUEUE(JODA_SHARED_QUEUE &&c)=delete
std::atomic< size_t > added
Definition: Queue.h:38
void registerProducer()
Definition: Queue.h:53
void send(payload_t &&e)
Definition: Queue.h:84
size_t retrieve(It e, size_t count)
Definition: Queue.h:135
void unregisterProducer()
Definition: Queue.h:59
std::atomic< size_t > removed
Definition: Queue.h:39
JODA_SHARED_QUEUE()
Definition: Queue.h:27
void send(typename queue_t::producer_token_t &ptok, payload_t &&e)
Definition: Queue.h:74
Definition: concurrentqueue.h:349
Definition: concurrentqueue.h:748
Definition: concurrentqueue.h:687