Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef FWCore_Framework_ESSourceProductResolverTemplate_h
0002 #define FWCore_Framework_ESSourceProductResolverTemplate_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/Framework
0006 // Class  :     ESSourceProductResolverTemplate
0007 //
0008 /**\class ESSourceProductResolverTemplate ESSourceProductResolverTemplate.h "FWCore/Framework/interface/ESSourceProductResolverTemplate.h"
0009 
0010  Description: An ESSource specific ESProductResolver which is type safe.
0011 
0012  Usage:
0013     Inherit from this class and override
0014       `void prefetch(edm::eventsetup::DataKey const& iKey)`
0015     and
0016        `DataT const* fetch() const`
0017 
0018     prefetch is guaranteed to be called before fetch where fetch should return the value obtained during the call to prefetch.
0019     The inheriting class must maintain the lifetime of the object returned from fetch until invalidateCache() is called.
0020 
0021 */
0022 //
0023 // Original Author:  Chris Jones
0024 //         Created:  14/05/2020
0025 //
0026 
0027 // system include files
0028 
0029 // user include files
0030 #include "FWCore/Framework/interface/ESSourceProductResolverNonConcurrentBase.h"
0031 
0032 // forward declarations
0033 
0034 namespace edm::eventsetup {
0035   template <typename DataT>
0036   class ESSourceProductResolverTemplate : public ESSourceProductResolverNonConcurrentBase {
0037   public:
0038     ESSourceProductResolverTemplate(edm::SerialTaskQueue* iQueue, std::mutex* iMutex)
0039         : ESSourceProductResolverNonConcurrentBase(iQueue, iMutex) {}
0040 
0041     ESSourceProductResolverTemplate(const ESSourceProductResolverTemplate&) = delete;
0042     const ESSourceProductResolverTemplate& operator=(const ESSourceProductResolverTemplate&) = delete;
0043 
0044     // ---------- const member functions ---------------------
0045 
0046     // ---------- static member functions --------------------
0047 
0048     // ---------- member functions ---------------------------
0049   protected:
0050     /** Inheriting classes must also override 
0051    void prefetch(edm::eventsetup::DataKey const& iKey, EventSetupRecordDetails) override;
0052    */
0053 
0054     /** returns the data obtained in the call to prefetch */
0055     virtual DataT const* fetch() const = 0;
0056 
0057   private:
0058     void const* getAfterPrefetchImpl() const final { return fetch(); }
0059   };
0060 }  // namespace edm::eventsetup
0061 
0062 #endif