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;
30 inline int read(D& buffer,
const std::string& consumerID)
33 return read(buffer, dummyHeader, consumerID);
36 inline int read(D& buffer, H& header,
const std::string& consumerID)
38 setNextProducerBuffer(consumerID);
39 unsigned int readCounter = theBuffer_.size() - 1;
50 while((readReturnVal = lastReadBuffer_[consumerID]->second.read(
51 buffer, header, consumerID)) < 0 &&
54 setNextProducerBuffer(consumerID);
60 int read(D*& buffer, H*& header,
const std::string& consumerID)
62 setNextProducerBuffer(consumerID);
63 unsigned int readCounter = theBuffer_.size() - 1;
74 while((readReturnVal = lastReadBuffer_[consumerID]->second.read(
75 buffer, header, consumerID)) < 0 &&
78 setNextProducerBuffer(consumerID);
84 BufferImplementation<D, H>& getLastReadBuffer(
const std::string& consumerID)
86 return lastReadBuffer_[consumerID]->second;
88 BufferImplementation<D, H>& getBuffer(
const std::string& producerID)
92 return theBuffer_[producerID];
99 std::map<std::string ,
100 BufferImplementation<D, H> >
103 void registerProducer(
const std::string& producerID,
104 unsigned int numberOfSubBuffers = 100);
105 void registerConsumer(
const std::string& consumerID,
108 void setNextProducerBuffer(
const std::string& consumer);
110 std::map<std::string ,
112 map<std::string, BufferImplementation<D, H>>::iterator>
115 std::map<std::string, CircularBufferBase::ConsumerPriority> consumers_;
117 #include "otsdaq/DataManager/CircularBuffer.icc"
void reset(void)
This DOES NOT reset the consumer list.