File indexing completed on 2024-05-11 03:34:12
0001 #ifndef FWCore_Framework_stream_EDProducerBase_h
0002 #define FWCore_Framework_stream_EDProducerBase_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "FWCore/Framework/interface/ProducerBase.h"
0025 #include "FWCore/Framework/interface/EDConsumerBase.h"
0026 #include "FWCore/Framework/interface/Frameworkfwd.h"
0027 #include "FWCore/Framework/interface/stream/EDProducerAdaptor.h"
0028 #include "DataFormats/Provenance/interface/ModuleDescription.h"
0029 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0030 #include "FWCore/Utilities/interface/ProductResolverIndex.h"
0031
0032
0033 namespace edm {
0034 template <typename T>
0035 class WorkerT;
0036 class ProductRegistry;
0037 class ThinnedAssociationsHelper;
0038 class WaitingTaskWithArenaHolder;
0039 class EventForTransformer;
0040
0041 namespace stream {
0042 class EDProducerAdaptorBase;
0043 template <typename>
0044 class ProducingModuleAdaptorBase;
0045
0046 class EDProducerBase : public edm::ProducerBase, public edm::EDConsumerBase {
0047
0048 friend class EDProducerAdaptorBase;
0049 friend class ProducingModuleAdaptorBase<EDProducerBase>;
0050
0051 public:
0052 typedef EDProducerAdaptorBase ModuleType;
0053
0054 EDProducerBase();
0055 EDProducerBase(const EDProducerBase&) = delete;
0056 const EDProducerBase& operator=(const EDProducerBase&) = delete;
0057 ~EDProducerBase() override;
0058
0059 static void fillDescriptions(ConfigurationDescriptions& descriptions);
0060 static void prevalidate(ConfigurationDescriptions& descriptions);
0061 static const std::string& baseType();
0062
0063
0064 ModuleDescription const& moduleDescription() const { return *moduleDescriptionPtr_; }
0065
0066 private:
0067 virtual void beginStream(StreamID) {}
0068 virtual void beginRun(edm::Run const&, edm::EventSetup const&) {}
0069 virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
0070 virtual void produce(Event&, EventSetup const&) = 0;
0071 virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
0072 virtual void endRun(edm::Run const&, edm::EventSetup const&) {}
0073 virtual void endStream() {}
0074
0075 virtual void registerThinnedAssociations(ProductRegistry const&, ThinnedAssociationsHelper&) {}
0076
0077 virtual void doAcquire_(Event const&, EventSetup const&, WaitingTaskWithArenaHolder&) = 0;
0078 virtual size_t transformIndex_(edm::BranchDescription const& iBranch) const noexcept;
0079 virtual ProductResolverIndex transformPrefetch_(std::size_t iIndex) const noexcept;
0080 virtual void transformAsync_(WaitingTaskHolder iTask,
0081 std::size_t iIndex,
0082 edm::EventForTransformer& iEvent,
0083 edm::ActivityRegistry* iAct,
0084 ServiceWeakToken const& iToken) const noexcept;
0085
0086 void setModuleDescriptionPtr(ModuleDescription const* iDesc) { moduleDescriptionPtr_ = iDesc; }
0087
0088 std::vector<BranchID> previousParentage_;
0089 std::vector<BranchID> gotBranchIDsFromAcquire_;
0090 ParentageID previousParentageId_;
0091 ModuleDescription const* moduleDescriptionPtr_;
0092 };
0093
0094 }
0095 }
0096
0097 #endif