Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-10-07 04:59:29

0001 // -*- C++ -*-
0002 #ifndef FWCore_Framework_ESSourceConcurrentESProductResolverTemplate_h
0003 #define FWCore_Framework_ESSourceConcurrentESProductResolverTemplate_h
0004 //
0005 // Package:     FWCore/Framework
0006 // Class  :     ESSourceConcurrentESProductResolverTemplate
0007 //
0008 /**\class edm::eventsetup::ESSourceConcurrentESProductResolverTemplate
0009 
0010  Description: An ESSource specific ESProductResolver which is type safe and can run concurrently with other ESProductResolvers from the same ESSource.
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:  17/12/2021
0025 //
0026 
0027 // system include files
0028 
0029 // user include files
0030 #include "FWCore/Framework/interface/ESSourceProductResolverConcurrentBase.h"
0031 
0032 // forward declarations
0033 
0034 namespace edm::eventsetup {
0035   template <typename DataT>
0036   class ESSourceConcurrentESProductResolverTemplate : public ESSourceProductResolverConcurrentBase {
0037   public:
0038     ESSourceConcurrentESProductResolverTemplate() = default;
0039 
0040     ESSourceConcurrentESProductResolverTemplate(const ESSourceConcurrentESProductResolverTemplate&) = delete;
0041     const ESSourceConcurrentESProductResolverTemplate& operator=(const ESSourceConcurrentESProductResolverTemplate&) =
0042         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