00001 #ifndef STOR_DQMEVENT_SERVER_H 00002 #define STOR_DQMEVENT_SERVER_H 00003 00020 #include <sys/time.h> 00021 #include <string> 00022 #include <vector> 00023 #include "IOPool/Streamer/interface/MsgTools.h" 00024 #include "IOPool/Streamer/interface/DQMEventMessage.h" 00025 #include "EventFilter/StorageManager/interface/DQMConsumerPipe.h" 00026 #include "boost/shared_ptr.hpp" 00027 #include "boost/thread/mutex.hpp" 00028 #include "boost/thread/thread.hpp" 00029 00030 namespace stor 00031 { 00032 class DQMEventServer 00033 { 00034 public: 00035 DQMEventServer(double maximumRate); 00036 ~DQMEventServer(); 00037 00038 void addConsumer(boost::shared_ptr<DQMConsumerPipe> consumer); 00039 boost::shared_ptr<DQMConsumerPipe> getConsumer(uint32 consumerId); 00040 void processDQMEvent(const DQMEventMsgView &eventView); 00041 boost::shared_ptr< std::vector<char> > getDQMEvent(uint32 consumerId); 00042 void clearQueue(); 00043 std::map< uint32, boost::shared_ptr<DQMConsumerPipe> > getConsumerTable() 00044 { return(consumerTable);} 00045 00046 private: 00047 00048 // data members for handling a maximum rate of accepted events 00049 static const double MAX_ACCEPT_INTERVAL; 00050 double minTimeBetweenEvents_; // seconds 00051 struct timeval lastAcceptedEventTime_; 00052 00053 // data members for deciding when to check for disconnected consumers 00054 int disconnectedConsumerTestCounter_; 00055 00056 // consumer lists 00057 std::map< uint32, boost::shared_ptr<DQMConsumerPipe> > consumerTable; 00058 //std::vector<boost::shared_ptr<DQMConsumerPipe>> vipConsumerList; 00059 }; 00060 } 00061 00062 #endif