1 #include "artdaq-core/Core/SimpleQueueReader.hh"
19 std::istringstream ins(argv[1]);
26 catch (std::string
const& msg)
28 std::cerr <<
"simpleQueueReaderApp failed: "
41 , expectedEventCount_(eec)
44 TRACE( 50,
"SimpleQueueReader ctor done (after queue_.setReaderIsReady())" );
49 std::size_t eventsSeen = 0;
50 auto doPrint = getenv(
"VERBOSE_QUEUE_READING");
57 if (!rawEventPtr) {
break; }
60 if (doPrint) { std::cout << *rawEventPtr << std::endl; }
64 std::this_thread::sleep_for(std::chrono::milliseconds(250));
67 if (expectedEventCount_ && eventsSeen != expectedEventCount_)
69 std::ostringstream os;
70 os <<
"Wrong number of events in SimpleQueueReader ("
71 << eventsSeen <<
" != " << expectedEventCount_ <<
").\n";
SimpleQueueReader(std::size_t expectedEventCount=0)
Constructs a SimpleQueueReader.
RawEventQueue & getGlobalQueue(RawEventQueue::SizeType maxSize)
The first thread to call getGlobalQueue() causes the creation of the queue. The queue will be destroy...
int simpleQueueReaderApp(int argc, char **argv)
An application which pops items off a RawEventQueue using the SimpleQueueReader.
std::shared_ptr< RawEvent > RawEvent_ptr
A smart pointer to a RawEvent object.
bool deqNowait(ValueType &item)
Assign the value at the head of the queue to item and then remove the head of the queue...
SimpleQueueReader will continue to read RawEvent objects off the queue until it encounters a null poi...
void run()
Run until a null pointer is popped off of the RawEventQueue. Throws an excpetion if expectedEventCoun...
void setReaderIsReady(bool rdy=true)
Set the ready flag for the reader.