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(buffer, header, consumerID)) < 0 && readCounter > 0)
52 setNextProducerBuffer(consumerID);
58 int read(D*& buffer, H*& header,
const std::string& consumerID)
60 setNextProducerBuffer(consumerID);
61 unsigned int readCounter = theBuffer_.size() - 1;
72 while((readReturnVal = lastReadBuffer_[consumerID]->second.read(buffer, header, consumerID)) < 0 && readCounter > 0)
74 setNextProducerBuffer(consumerID);
85 return theBuffer_[producerID];
94 void registerProducer(
const std::string& producerID,
unsigned int numberOfSubBuffers = 100);
95 void registerConsumer(
const std::string& consumerID, CircularBufferBase::ConsumerPriority priority);
97 void setNextProducerBuffer(
const std::string& consumer);
99 std::map<std::string ,
100 typename std::map<std::string, BufferImplementation<D, H>>::iterator>
103 std::map<std::string, CircularBufferBase::ConsumerPriority> consumers_;
105 #include "otsdaq/DataManager/CircularBuffer.icc"