1 #ifndef _ots_CircularBuffer_h_
2 #define _ots_CircularBuffer_h_
4 #include "otsdaq/DataManager/BufferImplementation.h"
5 #include "otsdaq/DataManager/CircularBufferBase.h"
7 #include "otsdaq/Macros/CoutMacros.h"
8 #include "otsdaq/MessageFacility/MessageFacility.h"
17 template<
class D,
class H>
25 void resetConsumerList(
void);
26 bool isEmpty(
void)
const;
27 unsigned int getTotalNumberOfSubBuffers(
void)
const;
28 unsigned int getProducerBufferSize(
const std::string& producerID)
const;
31 inline int read(D& buffer,
const std::string& consumerID)
34 return read(buffer, dummyHeader, consumerID);
37 inline int read(D& buffer, H& header,
const std::string& consumerID)
39 setNextProducerBuffer(consumerID);
40 unsigned int readCounter = theBuffer_.size() - 1;
51 while((readReturnVal = lastReadBuffer_[consumerID]->second.read(
52 buffer, header, consumerID)) < 0 &&
55 setNextProducerBuffer(consumerID);
61 int read(D*& buffer, H*& header,
const std::string& consumerID)
63 setNextProducerBuffer(consumerID);
64 unsigned int readCounter = theBuffer_.size() - 1;
75 while((readReturnVal = lastReadBuffer_[consumerID]->second.read(
76 buffer, header, consumerID)) < 0 &&
79 setNextProducerBuffer(consumerID);
85 BufferImplementation<D, H>& getLastReadBuffer(
const std::string& consumerID)
87 return lastReadBuffer_[consumerID]->second;
89 BufferImplementation<D, H>& getBuffer(
const std::string& producerID)
93 return theBuffer_[producerID];
100 std::map<std::string ,
101 BufferImplementation<D, H> >
104 void registerProducer(
const std::string& producerID,
105 unsigned int numberOfSubBuffers = 100);
106 void registerConsumer(
const std::string& consumerID,
109 void setNextProducerBuffer(
const std::string& consumer);
111 std::map<std::string ,
113 map<std::string, BufferImplementation<D, H>>::iterator>
116 std::map<std::string, CircularBufferBase::ConsumerPriority> consumers_;
118 #include "otsdaq/DataManager/CircularBuffer.icc"
unsigned int getProducerWrittenBuffers(const std::string &producerID) const
sub-buffers written but not yet read by every consumer
void reset(void)
This DOES NOT reset the consumer list.
defines used also by OtsConfigurationWizardSupervisor