$treeview $search $mathjax $extrastylesheet
otsdaq
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #ifndef _ots_CircularBufferBase_h_ 00002 #define _ots_CircularBufferBase_h_ 00003 00004 #include <string> 00005 00006 namespace ots 00007 { 00008 class DataProcessor; 00009 00010 // CircularBufferBase 00011 // This class is the base class for the otsdaq Buffer 00012 class CircularBufferBase 00013 { 00014 public: 00015 enum ConsumerPriority 00016 { 00017 LowConsumerPriority, // If the buffers are full because a low priority consumer 00018 // didn't emptied them then overwrite 00019 HighConsumerPriority // Can't overwrite but need to wait for sometime before 00020 // writing a buffer 00021 }; 00022 00023 CircularBufferBase(const std::string& bufferID); 00024 virtual ~CircularBufferBase(void); 00025 00026 virtual void reset(void) = 0; 00027 void registerProducer(DataProcessor* producer, unsigned int numberOfSubBuffers = 100); 00028 void registerConsumer(DataProcessor* consumer); 00029 // void unregisterProducer(DataProcessor* producer); 00030 // void unregisterConsumer(DataProcessor* consumer); 00031 00032 virtual bool isEmpty(void) const = 0; 00033 virtual unsigned int getTotalNumberOfSubBuffers(void) const = 0; 00034 virtual unsigned int getProducerBufferSize(const std::string& producerID) const = 0; 00035 00036 protected: 00037 virtual void registerProducer(const std::string& producerID, 00038 unsigned int numberOfSubBuffers = 100) = 0; 00039 virtual void registerConsumer(const std::string& consumerID, 00040 ConsumerPriority priority) = 0; 00041 // virtual void unregisterProducer (const std::string& producerID) = 0; 00042 // virtual void unregisterConsume r(const std::string& consumerID) = 0; 00043 00044 std::string dataBufferId_; 00045 std::string mfSubject_; 00046 }; 00047 } // namespace ots 00048 #endif