CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/EventFilter/StorageManager/interface/RegistrationCollection.h

Go to the documentation of this file.
00001 // $Id: RegistrationCollection.h,v 1.8 2011/03/07 15:31:32 mommsen Exp $
00003 
00004 #ifndef EventFilter_StorageManager_RegistrationCollection_h
00005 #define EventFilter_StorageManager_RegistrationCollection_h
00006 
00007 #include "EventFilter/StorageManager/interface/ConsumerID.h"
00008 #include "EventFilter/StorageManager/interface/RegistrationInfoBase.h"
00009 #include "EventFilter/StorageManager/interface/EventConsumerRegistrationInfo.h"
00010 #include "EventFilter/StorageManager/interface/DQMEventConsumerRegistrationInfo.h"
00011 
00012 #include <vector>
00013 #include <map>
00014 
00015 #include <boost/thread/mutex.hpp>
00016 #include <boost/shared_ptr.hpp>
00017 
00018 namespace stor
00019 {
00020 
00029   class RegistrationCollection
00030   {
00031 
00032   public:
00033 
00034     RegistrationCollection();
00035 
00036     ~RegistrationCollection();
00037 
00042     ConsumerID getConsumerId();
00043 
00047     bool addRegistrationInfo( RegPtr );
00048 
00052     RegPtr getRegistrationInfo( const ConsumerID ) const;
00053 
00057     typedef std::vector<EventConsRegPtr> ConsumerRegistrations;
00058     void getEventConsumers( ConsumerRegistrations& ) const;
00059 
00063     typedef std::vector<DQMEventConsRegPtr> DQMConsumerRegistrations;
00064     void getDQMEventConsumers( DQMConsumerRegistrations& ) const;
00065 
00069     void enableConsumerRegistration();
00070 
00074     void disableConsumerRegistration();
00075 
00079     void clearRegistrations();
00080 
00084     bool registrationIsAllowed( const ConsumerID ) const;
00085 
00086   private:
00087 
00088     mutable boost::mutex lock_;
00089 
00090     ConsumerID nextConsumerId_;
00091 
00092     bool registrationAllowed_;
00093       
00094     typedef std::map<ConsumerID, RegPtr> RegistrationMap;
00095     RegistrationMap consumers_;
00096 
00097   };
00098 
00099   typedef boost::shared_ptr<RegistrationCollection> RegistrationCollectionPtr;
00100 
00101 } // namespace stor
00102 
00103 #endif // EventFilter_StorageManager_RegistrationCollection_h
00104 
00105