File indexing completed on 2025-01-31 02:19:22
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/StreamID.h"
0014 #include "FWCore/Utilities/interface/TypeID.h"
0015 #include "FWCore/Utilities/interface/ProductResolverIndex.h"
0016 #include "DataFormats/Provenance/interface/ProductDescriptionFwd.h"
0017
0018 #include <string>
0019 #include <functional>
0020 #include <memory>
0021 #include <any>
0022
0023 namespace edm {
0024 class ProducerBase;
0025 class TypeID;
0026 class WrapperBase;
0027 class EventForTransformer;
0028 class ProductResolverIndexHelper;
0029 class ModuleDescription;
0030 class WaitingTaskWithArenaHolder;
0031 class WaitingTaskHolder;
0032 class ActivityRegistry;
0033
0034 class TransformerBase {
0035 public:
0036 TransformerBase() = default;
0037 virtual ~TransformerBase() noexcept(false) = default;
0038
0039 protected:
0040
0041
0042 using TransformFunction = std::function<std::unique_ptr<edm::WrapperBase>(edm::StreamID, std::any)>;
0043 using PreTransformFunction =
0044 std::function<std::any(edm::StreamID, edm::WrapperBase const&, edm::WaitingTaskWithArenaHolder)>;
0045
0046 void registerTransformImp(ProducerBase&, EDPutToken, const TypeID& id, std::string instanceName, TransformFunction);
0047 void registerTransformAsyncImp(
0048 ProducerBase&, EDPutToken, const TypeID& id, std::string instanceName, PreTransformFunction, TransformFunction);
0049
0050 std::size_t findMatchingIndex(ProducerBase const& iBase, edm::ProductDescription const&) const noexcept;
0051 ProductResolverIndex prefetchImp(std::size_t iIndex) const noexcept {
0052 return transformInfo_.get<kResolverIndex>(iIndex);
0053 }
0054 void transformImpAsync(WaitingTaskHolder iTask,
0055 std::size_t iIndex,
0056 edm::ActivityRegistry* iAct,
0057 ProducerBase const& iBase,
0058 edm::EventForTransformer&) const noexcept;
0059
0060 void extendUpdateLookup(ProducerBase const&,
0061 ModuleDescription const& iModuleDesc,
0062 ProductResolverIndexHelper const& iHelper);
0063
0064 private:
0065 enum InfoColumns { kResolverIndex, kType, kToken, kPreTransform, kTransform };
0066 SoATuple<ProductResolverIndex, TypeID, EDPutToken, PreTransformFunction, TransformFunction> transformInfo_;
0067 };
0068 }
0069
0070 #endif