File indexing completed on 2022-10-18 04:13:17
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef FWCore_Framework_TransformerBase_h
0009 #define FWCore_Framework_TransformerBase_h
0010
0011 #include "FWCore/Utilities/interface/EDPutToken.h"
0012 #include "FWCore/Utilities/interface/SoATuple.h"
0013 #include "FWCore/Utilities/interface/TypeID.h"
0014 #include "FWCore/Utilities/interface/ProductResolverIndex.h"
0015
0016 #include <string>
0017 #include <functional>
0018 #include <memory>
0019 #include <any>
0020
0021 namespace edm {
0022 class ProducerBase;
0023 class TypeID;
0024 class WrapperBase;
0025 class EventForTransformer;
0026 class BranchDescription;
0027 class ProductResolverIndexHelper;
0028 class ModuleDescription;
0029 class WaitingTaskWithArenaHolder;
0030 class WaitingTaskHolder;
0031
0032 class TransformerBase {
0033 public:
0034 TransformerBase() = default;
0035 virtual ~TransformerBase() noexcept(false) = default;
0036
0037 protected:
0038
0039
0040 using TransformFunction = std::function<std::unique_ptr<edm::WrapperBase>(std::any)>;
0041 using PreTransformFunction = std::function<std::any(edm::WrapperBase const&, edm::WaitingTaskWithArenaHolder)>;
0042
0043 void registerTransformImp(ProducerBase&, EDPutToken, const TypeID& id, std::string instanceName, TransformFunction);
0044 void registerTransformAsyncImp(
0045 ProducerBase&, EDPutToken, const TypeID& id, std::string instanceName, PreTransformFunction, TransformFunction);
0046
0047 std::size_t findMatchingIndex(ProducerBase const& iBase, edm::BranchDescription const&) const;
0048 ProductResolverIndex prefetchImp(std::size_t iIndex) const { return transformInfo_.get<kResolverIndex>(iIndex); }
0049 void transformImpAsync(WaitingTaskHolder iTask,
0050 std::size_t iIndex,
0051 ProducerBase const& iBase,
0052 edm::EventForTransformer&) const;
0053
0054 void extendUpdateLookup(ProducerBase const&,
0055 ModuleDescription const& iModuleDesc,
0056 ProductResolverIndexHelper const& iHelper);
0057
0058 private:
0059 enum InfoColumns { kResolverIndex, kType, kToken, kPreTransform, kTransform };
0060 SoATuple<ProductResolverIndex, TypeID, EDPutToken, PreTransformFunction, TransformFunction> transformInfo_;
0061 };
0062 }
0063
0064 #endif