#ifndef BASE_PROGMGR_H #define BASE_PROGMGR_H #include #include #include "base/defines.h" #include "base/Buffer.h" #include "base/Markers.h" #include "base/Event.h" class TTree; class TObject; namespace base { /** Class base::ProcMgr is central manager of processors and interface * to any external frameworks like ROOT or Go4 or ... * It is singleton - the only instance for whole system */ class Processor; class StreamProc; class EventProc; class EventStore; class ProcMgr { friend class Processor; protected: enum { MaxBrdId = 256 }; enum { NoSyncIndex = 0xfffffffe, DummyIndex = 0xffffffff }; typedef std::map StreamProcMap; std::vector fProc; //! all stream processors StreamProcMap fMap; //! map for fast access std::vector fEvProc; //! all event processors GlobalMarksQueue fTriggers; //!< list of current triggers unsigned fTimeMasterIndex; //!< processor index, which time is used for all other subsystems AnalysisKind fAnalysisKind; //!< ignore all events, only single scan, not output events TTree *fTree; //!< abstract tree pointer, will be used in ROOT implementation int fDfltHistLevel; //!< default histogram fill level for any new created processor int fDfltStoreKind; //!< default store kind for any new created processor base::Event *fTrigEvent; //!< current event, filled when performing triggered analysis static ProcMgr* fInstance; //! virtual unsigned SyncIdRange() const { return 0x1000000; } /** Method calculated difference id2-id1, * used for sync markers identification * Sync ID overflow is taken into account */ int SyncIdDiff(unsigned id1, unsigned id2) const; void DeleteAllProcessors(); public: ProcMgr(); virtual ~ProcMgr(); static ProcMgr* instance(); static void ClearInstancePointer(); ProcMgr* AddProcessor(Processor* proc); static ProcMgr* AddProc(Processor* proc); /** Enter processor for processing data of specified kind */ bool RegisterProc(StreamProc* proc, unsigned kind, unsigned brdid); unsigned NumProc() const { return fProc.size(); } StreamProc* GetProc(unsigned n) const { return n