CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/FWCore/Framework/interface/DataProxyProvider.h

Go to the documentation of this file.
00001 #ifndef Framework_DataProxyProvider_h
00002 #define Framework_DataProxyProvider_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     Framework
00006 // Class  :     DataProxyProvider
00007 // 
00016 //
00017 // Author:      Chris Jones
00018 // Created:     Mon Mar 28 14:21:58 EST 2005
00019 //
00020 
00021 // system include files
00022 #include <map>
00023 #include <set>
00024 #include <string>
00025 #include <vector>
00026 #include "boost/shared_ptr.hpp"
00027 
00028 // user include files
00029 #include "FWCore/Framework/interface/EventSetupRecordKey.h"
00030 #include "FWCore/Framework/interface/DataKey.h"
00031 #include "FWCore/Framework/interface/ComponentDescription.h"
00032 
00033 // forward declarations
00034 namespace edm {
00035    class ValidityInterval;
00036    class ParameterSet;
00037    class ConfigurationDescriptions;
00038    namespace eventsetup {
00039       class DataProxy;
00040       
00041       
00042 class DataProxyProvider
00043 {
00044 
00045    public:   
00046       typedef std::vector< EventSetupRecordKey> Keys;
00047       typedef std::vector<std::pair<DataKey, 
00048                                     boost::shared_ptr<DataProxy> > > KeyedProxies ;
00049       typedef std::map<EventSetupRecordKey, KeyedProxies> RecordProxies;
00050       
00051       DataProxyProvider();
00052       virtual ~DataProxyProvider();
00053 
00054       // ---------- const member functions ---------------------
00055       bool isUsingRecord(const EventSetupRecordKey&) const;
00056       
00057       std::set<EventSetupRecordKey> usingRecords() const;
00058       
00059       const KeyedProxies& keyedProxies(const EventSetupRecordKey& iRecordKey) const ;
00060       
00061       const ComponentDescription& description() const { return description_;}
00062       // ---------- static member functions --------------------
00065       static void prevalidate(ConfigurationDescriptions&);
00066 
00067       // ---------- member functions ---------------------------
00068       
00070       virtual void newInterval(const EventSetupRecordKey& iRecordType,
00071                                 const ValidityInterval& iInterval) = 0;
00072       
00073       void setDescription(const ComponentDescription& iDescription) {
00074          description_ = iDescription;
00075       }
00076       
00080       void setAppendToDataLabel(const edm::ParameterSet&);
00081       
00082       void resetProxies(const EventSetupRecordKey& iRecordType);
00083       void resetProxiesIfTransient(const EventSetupRecordKey& iRecordType);
00084 
00085    protected:
00086       template< class T>
00087       void usingRecord() {
00088          usingRecordWithKey(EventSetupRecordKey::makeKey<T>());
00089       }
00090       
00091       void usingRecordWithKey(const EventSetupRecordKey&);
00092 
00093       void invalidateProxies(const EventSetupRecordKey& iRecordKey) ;
00094 
00095       virtual void registerProxies(const EventSetupRecordKey& iRecordKey ,
00096                                     KeyedProxies& aProxyList) = 0 ;
00097       
00099       void eraseAll(const EventSetupRecordKey& iRecordKey) ;
00100 
00101    private:
00102       DataProxyProvider(const DataProxyProvider&); // stop default
00103 
00104       const DataProxyProvider& operator=(const DataProxyProvider&); // stop default
00105 
00106       // ---------- member data --------------------------------
00107       RecordProxies recordProxies_;
00108       ComponentDescription description_;
00109       std::string appendToDataLabel_;
00110 };
00111 
00112 template<class ProxyT>
00113 inline void insertProxy(DataProxyProvider::KeyedProxies& iList,
00114                         boost::shared_ptr<ProxyT> iProxy,
00115                         const char* iName="") {
00116    iList.push_back(DataProxyProvider::KeyedProxies::value_type(
00117                                              DataKey(DataKey::makeTypeTag<typename ProxyT::value_type>(),
00118                                                      iName),
00119                                              iProxy));
00120    
00121 }
00122 
00123    }
00124 }
00125 #endif