Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-22 01:53:28

0001 #ifndef FWCore_Framework_ESSourceDataProxyTemplate_h
0002 #define FWCore_Framework_ESSourceDataProxyTemplate_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/Framework
0006 // Class  :     ESSourceDataProxyTemplate
0007 //
0008 /**\class ESSourceDataProxyTemplate ESSourceDataProxyTemplate.h "FWCore/Framework/interface/ESSourceDataProxyTemplate.h"
0009 
0010  Description: An ESSource specific DataProxy 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/ESSourceDataProxyNonConcurrentBase.h"
0031 
0032 // forward declarations
0033 
0034 namespace edm::eventsetup {
0035   template <typename DataT>
0036   class ESSourceDataProxyTemplate : public ESSourceDataProxyNonConcurrentBase {
0037   public:
0038     ESSourceDataProxyTemplate(edm::SerialTaskQueue* iQueue, std::mutex* iMutex)
0039         : ESSourceDataProxyNonConcurrentBase(iQueue, iMutex) {}
0040 
0041     ESSourceDataProxyTemplate(const ESSourceDataProxyTemplate&) = delete;
0042     const ESSourceDataProxyTemplate& operator=(const ESSourceDataProxyTemplate&) = 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