CMS 3D CMS Logo

TransformerBase.h
Go to the documentation of this file.
1 //
2 // TransformerBase.h
3 // CMSSW
4 //
5 // Created by Chris Jones on 6/02/22.
6 //
7 
8 #ifndef FWCore_Framework_TransformerBase_h
9 #define FWCore_Framework_TransformerBase_h
10 
15 
16 #include <string>
17 #include <functional>
18 #include <memory>
19 #include <any>
20 
21 namespace edm {
22  class ProducerBase;
23  class TypeID;
24  class WrapperBase;
25  class EventForTransformer;
26  class BranchDescription;
27  class ProductResolverIndexHelper;
28  class ModuleDescription;
29  class WaitingTaskWithArenaHolder;
30  class WaitingTaskHolder;
31  class ActivityRegistry;
32 
34  public:
35  TransformerBase() = default;
36  virtual ~TransformerBase() noexcept(false) = default;
37 
38  protected:
39  //The function takes the WrapperBase corresponding to the data product from the EDPutToken
40  // and returns the WrapperBase associated to the id and instanceName
41  using TransformFunction = std::function<std::unique_ptr<edm::WrapperBase>(std::any)>;
42  using PreTransformFunction = std::function<std::any(edm::WrapperBase const&, edm::WaitingTaskWithArenaHolder)>;
43 
47 
48  std::size_t findMatchingIndex(ProducerBase const& iBase, edm::BranchDescription const&) const noexcept;
49  ProductResolverIndex prefetchImp(std::size_t iIndex) const noexcept {
50  return transformInfo_.get<kResolverIndex>(iIndex);
51  }
53  std::size_t iIndex,
55  ProducerBase const& iBase,
56  edm::EventForTransformer&) const noexcept;
57 
58  void extendUpdateLookup(ProducerBase const&,
59  ModuleDescription const& iModuleDesc,
60  ProductResolverIndexHelper const& iHelper);
61 
62  private:
65  };
66 } // namespace edm
67 
68 #endif /* TransformerBase_h */
std::function< std::any(edm::WrapperBase const &, edm::WaitingTaskWithArenaHolder)> PreTransformFunction
virtual ~TransformerBase() noexcept(false)=default
SoATuple< ProductResolverIndex, TypeID, EDPutToken, PreTransformFunction, TransformFunction > transformInfo_
unsigned int ProductResolverIndex
TransformerBase()=default
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:37
void extendUpdateLookup(ProducerBase const &, ModuleDescription const &iModuleDesc, ProductResolverIndexHelper const &iHelper)
std::function< std::unique_ptr< edm::WrapperBase >(std::any)> TransformFunction
std::size_t findMatchingIndex(ProducerBase const &iBase, edm::BranchDescription const &) const noexcept
void transformImpAsync(WaitingTaskHolder iTask, std::size_t iIndex, edm::ActivityRegistry *iAct, ProducerBase const &iBase, edm::EventForTransformer &) const noexcept
void registerTransformAsyncImp(ProducerBase &, EDPutToken, const TypeID &id, std::string instanceName, PreTransformFunction, TransformFunction)
HLT enums.
void registerTransformImp(ProducerBase &, EDPutToken, const TypeID &id, std::string instanceName, TransformFunction)
ProductResolverIndex prefetchImp(std::size_t iIndex) const noexcept