CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/EventFilter/StorageManager/interface/DQMEventStore.h

Go to the documentation of this file.
00001 // $Id: DQMEventStore.h,v 1.12 2011/04/18 16:06:23 mommsen Exp $
00003 
00004 #ifndef EventFilter_StorageManager_DQMEventStore_h
00005 #define EventFilter_StorageManager_DQMEventStore_h
00006 
00007 #include <map>
00008 #include <queue>
00009 
00010 #include <boost/thread/mutex.hpp>
00011 
00012 #include "TThread.h"
00013 
00014 #include "xcept/Exception.h"
00015 #include "xdaq/ApplicationDescriptor.h"
00016 
00017 #include "IOPool/Streamer/interface/HLTInfo.h"
00018 
00019 #include "EventFilter/StorageManager/interface/AlarmHandler.h"
00020 #include "EventFilter/StorageManager/interface/Configuration.h"
00021 #include "EventFilter/StorageManager/interface/DQMTopLevelFolder.h"
00022 #include "EventFilter/StorageManager/interface/DQMKey.h"
00023 #include "EventFilter/StorageManager/interface/InitMsgCollection.h"
00024 #include "EventFilter/StorageManager/interface/SharedResources.h"
00025 
00026 
00027 namespace stor {
00028   
00029   class DQMEventMonitorCollection;
00030 
00031 
00043   template<class EventType, class ConnectionType, class StateMachineType>  
00044   class DQMEventStore
00045   {
00046   public:
00047     
00048     DQMEventStore
00049     (
00050       xdaq::ApplicationDescriptor*,
00051       DQMEventQueueCollectionPtr,
00052       DQMEventMonitorCollection&,
00053       ConnectionType*,
00054       size_t (ConnectionType::*getExpectedUpdatesCount)() const,
00055       StateMachineType*,
00056       void (StateMachineType::*moveToFailedState)(xcept::Exception&),
00057       AlarmHandlerPtr
00058     );
00059 
00060     ~DQMEventStore();
00061 
00066     void setParameters(DQMProcessingParams const&);
00067 
00073     void addDQMEvent(EventType const&);
00074 
00078     void purge();
00079 
00083     void clear();
00084 
00088     bool empty()
00089     { return store_.empty(); }
00090 
00091     void moveToFailedState(xcept::Exception& sentinelException)
00092     { (stateMachineType_->*moveToFailedState_)(sentinelException); }
00093 
00094     bool doProcessCompletedTopLevelFolders()
00095     { return processCompletedTopLevelFolders_; }
00096     
00097     
00098   private:
00099 
00100     //Prevent copying of the DQMEventStore
00101     DQMEventStore(DQMEventStore const&);
00102     DQMEventStore& operator=(DQMEventStore const&);
00103 
00104     void addDQMEventToStore(EventType const&);
00105     void addDQMEventToReadyToServe(EventType const&);
00106     DQMTopLevelFolderPtr makeDQMTopLevelFolder(EventType const&);
00107     DQMEventMsgView getDQMEventView(EventType const&);
00108     bool getNextReadyTopLevelFolder(DQMTopLevelFolderPtr&);
00109     static void processCompletedTopLevelFolders(void* arg);
00110     bool handleNextCompletedTopLevelFolder();
00111     void stopProcessingCompletedTopLevelFolders();
00112 
00113     xdaq::ApplicationDescriptor* appDescriptor_;
00114     DQMProcessingParams dqmParams_;
00115     DQMEventQueueCollectionPtr dqmEventQueueCollection_;
00116     DQMEventMonitorCollection& dqmEventMonColl_;
00117     ConnectionType* connectionType_;
00118     size_t (ConnectionType::*getExpectedUpdatesCount_)() const;
00119     StateMachineType* stateMachineType_;
00120     void (StateMachineType::*moveToFailedState_)(xcept::Exception&);
00121     AlarmHandlerPtr alarmHandler_;
00122 
00123     typedef std::map<DQMKey, DQMTopLevelFolderPtr> DQMTopLevelFolderMap;
00124     DQMTopLevelFolderMap store_;
00125     static boost::mutex storeMutex_;
00126 
00127     TThread* completedFolderThread_;
00128     bool processCompletedTopLevelFolders_;
00129 
00130     std::vector<unsigned char> tempEventArea_;
00131 
00132   };
00133   
00134 } // namespace stor
00135 
00136 #endif // EventFilter_StorageManager_DQMEventStore_h 
00137 
00138