CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/FWCore/Framework/src/EventSetupsController.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Framework
00004 // Class  :     EventSetupsController
00005 // 
00006 // Implementation:
00007 //     [Notes on implementation]
00008 //
00009 // Original Author:  Chris Jones
00010 //         Created:  Wed Jan 12 14:30:44 CST 2011
00011 // $Id: EventSetupsController.cc,v 1.3 2012/04/16 15:43:49 wdd Exp $
00012 //
00013 
00014 // system include files
00015 
00016 // user include files
00017 #include "FWCore/Framework/src/EventSetupsController.h"
00018 #include "FWCore/Framework/interface/EventSetupProviderMaker.h"
00019 #include "FWCore/Framework/interface/EventSetupProvider.h"
00020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00021 
00022 #include <algorithm>
00023 
00024 //
00025 // constants, enums and typedefs
00026 //
00027 
00028 namespace edm {
00029 
00030    namespace eventsetup {
00031 //
00032 // static data member definitions
00033 //
00034 
00035 //
00036 // constructors and destructor
00037 //
00038 EventSetupsController::EventSetupsController()
00039 {
00040 }
00041 
00042 // EventSetupsController::EventSetupsController(const EventSetupsController& rhs)
00043 // {
00044 //    // do actual copying here;
00045 // }
00046 
00047 //EventSetupsController::~EventSetupsController()
00048 //{
00049 //}
00050 
00051 //
00052 // assignment operators
00053 //
00054 // const EventSetupsController& EventSetupsController::operator=(const EventSetupsController& rhs)
00055 // {
00056 //   //An exception safe implementation is
00057 //   EventSetupsController temp(rhs);
00058 //   swap(rhs);
00059 //
00060 //   return *this;
00061 // }
00062 
00063 //
00064 // member functions
00065 //
00066 boost::shared_ptr<EventSetupProvider> 
00067 EventSetupsController::makeProvider(ParameterSet& iPSet)
00068 {
00069    boost::shared_ptr<EventSetupProvider> returnValue(makeEventSetupProvider(iPSet) );
00070 
00071    fillEventSetupProvider(*this, *returnValue, iPSet);
00072    
00073    providers_.push_back(returnValue);
00074    
00075    return returnValue;
00076 }
00077 
00078 void
00079 EventSetupsController::eventSetupForInstance(IOVSyncValue const& syncValue) const {
00080   std::for_each(providers_.begin(), providers_.end(), [&syncValue](boost::shared_ptr<EventSetupProvider> const& esp) {
00081     esp->eventSetupForInstance(syncValue);
00082   });
00083 }
00084 
00085 void
00086 EventSetupsController::forceCacheClear() const {
00087   std::for_each(providers_.begin(), providers_.end(), [](boost::shared_ptr<EventSetupProvider> const& esp) {
00088     esp->forceCacheClear();
00089   });
00090 }
00091 
00092 boost::shared_ptr<EventSetupRecordIntervalFinder> const*
00093 EventSetupsController::getAlreadyMadeESSource(ParameterSet const& pset) const {
00094   auto elements = essources_.equal_range(pset.id());
00095   for (auto it = elements.first; it != elements.second; ++it) {
00096     if (isTransientEqual(pset, *it->second.first)) {
00097       return &it->second.second;
00098     }
00099   }
00100   return 0;
00101 }
00102 
00103 void
00104 EventSetupsController::putESSource(ParameterSet const& pset, boost::shared_ptr<EventSetupRecordIntervalFinder> const& component) {
00105   essources_.insert(std::pair<ParameterSetID, std::pair<ParameterSet const*, boost::shared_ptr<EventSetupRecordIntervalFinder> > >(pset.id(), 
00106                                               std::pair<ParameterSet const*, boost::shared_ptr<EventSetupRecordIntervalFinder> >(&pset, component)));
00107 }
00108 
00109 void
00110 EventSetupsController::clearComponents() {
00111   essources_.clear();
00112 }
00113 
00114 //
00115 // const member functions
00116 //
00117 
00118 //
00119 // static member functions
00120 //
00121    }
00122 }