Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:12:03

0001 #ifndef Framework_EventSetupRecordIntervalFinder_h
0002 #define Framework_EventSetupRecordIntervalFinder_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     Framework
0006 // Class  :     EventSetupRecordIntervalFinder
0007 //
0008 /**\class EventSetupRecordIntervalFinder EventSetupRecordIntervalFinder.h FWCore/Framework/interface/EventSetupRecordIntervalFinder.h
0009 
0010  Description: <one line class summary>
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Author:      Chris Jones
0018 // Created:     Tue Mar 29 16:15:11 EST 2005
0019 //
0020 
0021 // system include files
0022 #include <map>
0023 #include <set>
0024 
0025 // user include files
0026 #include "FWCore/Framework/interface/ValidityInterval.h"
0027 #include "FWCore/Framework/interface/EventSetupRecordKey.h"
0028 #include "FWCore/Framework/interface/ComponentDescription.h"
0029 
0030 // forward declarations
0031 namespace edm {
0032 
0033   class EventSetupRecordIntervalFinder {
0034   public:
0035     EventSetupRecordIntervalFinder() : intervals_() {}
0036     EventSetupRecordIntervalFinder(const EventSetupRecordIntervalFinder&) = delete;
0037     const EventSetupRecordIntervalFinder& operator=(const EventSetupRecordIntervalFinder&) = delete;
0038     virtual ~EventSetupRecordIntervalFinder() noexcept(false);
0039 
0040     // ---------- const member functions ---------------------
0041     std::set<eventsetup::EventSetupRecordKey> findingForRecords() const;
0042 
0043     const eventsetup::ComponentDescription& descriptionForFinder() const { return description_; }
0044     // ---------- static member functions --------------------
0045 
0046     // ---------- member functions ---------------------------
0047     /**returns the 'default constructed' ValidityInterval if no valid interval.
0048        If upperbound is not known, it should be set to IOVSyncValue::invalidIOVSyncValue()
0049       */
0050     const ValidityInterval& findIntervalFor(const eventsetup::EventSetupRecordKey&, const IOVSyncValue&);
0051 
0052     void resetInterval(const eventsetup::EventSetupRecordKey&);
0053 
0054     bool concurrentFinder() const { return isConcurrentFinder(); }
0055 
0056     bool nonconcurrentAndIOVNeedsUpdate(const eventsetup::EventSetupRecordKey& key,
0057                                         const IOVSyncValue& syncValue) const {
0058       return isNonconcurrentAndIOVNeedsUpdate(key, syncValue);
0059     }
0060 
0061     void setDescriptionForFinder(const eventsetup::ComponentDescription& iDescription) { description_ = iDescription; }
0062 
0063   protected:
0064     virtual void setIntervalFor(const eventsetup::EventSetupRecordKey&, const IOVSyncValue&, ValidityInterval&) = 0;
0065 
0066     template <class T>
0067     void findingRecord() {
0068       findingRecordWithKey(eventsetup::EventSetupRecordKey::makeKey<T>());
0069     }
0070 
0071     void findingRecordWithKey(const eventsetup::EventSetupRecordKey&);
0072 
0073   private:
0074     virtual void doResetInterval(const eventsetup::EventSetupRecordKey&);
0075 
0076     // The following function should be overridden in a derived class if
0077     // it supports concurrent IOVs. If this returns false (the default),
0078     // this will cause the Framework to run everything associated with the
0079     // particular IOV set in a call to the function setIntervalFor before
0080     // calling setIntervalFor again for that finder. In modules that do not
0081     // support concurrency, this time ordering is what the produce functions
0082     // use to know what IOV to produce data for. In finders that support
0083     // concurrency, the produce function will get information from the
0084     // Record to know what IOV to produce data for. This waiting to synchronize
0085     // IOV transitions can affect performance. It would be nice if someday
0086     // all finders were migrated to support concurrency and this function
0087     // and the code related to it could be deleted.
0088     virtual bool isConcurrentFinder() const;
0089 
0090     // Should only be overridden by DependentRecordIntervalFinder and
0091     // IntersectingIOVRecordIntervalFinder.
0092     virtual bool isNonconcurrentAndIOVNeedsUpdate(const eventsetup::EventSetupRecordKey&, const IOVSyncValue&) const;
0093 
0094     /** override this method if you need to delay setting what records you will be using until after all modules are loaded*/
0095     virtual void delaySettingRecords();
0096     // ---------- member data --------------------------------
0097     using Intervals = std::map<eventsetup::EventSetupRecordKey, ValidityInterval>;
0098     Intervals intervals_;
0099 
0100     eventsetup::ComponentDescription description_;
0101   };
0102 
0103 }  // namespace edm
0104 #endif