Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:42

0001 #ifndef FWCore_Framework_stream_EDFilterBase_h
0002 #define FWCore_Framework_stream_EDFilterBase_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/Framework
0006 // Class  :     EDFilterBase
0007 //
0008 /**\class edm::stream::EDFilterBase EDFilterBase.h "FWCore/Framework/interface/stream/EDFilterBase.h"
0009 
0010  Description: [one line class summary]
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Fri, 02 Aug 2013 00:11:27 GMT
0019 //
0020 
0021 // system include files
0022 
0023 // user include files
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/EDFilterAdaptor.h"
0028 #include "DataFormats/Provenance/interface/ModuleDescription.h"
0029 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0030 
0031 // forward declarations
0032 namespace edm {
0033 
0034   class ProductRegistry;
0035   class ThinnedAssociationsHelper;
0036   class WaitingTaskWithArenaHolder;
0037 
0038   namespace stream {
0039     class EDFilterAdaptorBase;
0040     template <typename>
0041     class ProducingModuleAdaptorBase;
0042 
0043     class EDFilterBase : public edm::ProducerBase, public edm::EDConsumerBase {
0044       //This needs access to the parentage cache info
0045       friend class EDFilterAdaptorBase;
0046       friend class ProducingModuleAdaptorBase<EDFilterBase>;
0047 
0048     public:
0049       typedef EDFilterAdaptorBase ModuleType;
0050 
0051       EDFilterBase();
0052       EDFilterBase(const EDFilterBase&) = delete;                   // stop default
0053       const EDFilterBase& operator=(const EDFilterBase&) = delete;  // stop default
0054       ~EDFilterBase() override;
0055 
0056       static void fillDescriptions(ConfigurationDescriptions& descriptions);
0057       static void prevalidate(ConfigurationDescriptions& descriptions);
0058       static const std::string& baseType();
0059 
0060       // Warning: the returned moduleDescription will be invalid during construction
0061       ModuleDescription const& moduleDescription() const { return *moduleDescriptionPtr_; }
0062 
0063     private:
0064       virtual void beginStream(StreamID) {}
0065       virtual void beginRun(edm::Run const&, edm::EventSetup const&) {}
0066       virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
0067       virtual bool filter(Event&, EventSetup const&) = 0;
0068       virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
0069       virtual void endRun(edm::Run const&, edm::EventSetup const&) {}
0070       virtual void endStream() {}
0071 
0072       virtual void registerThinnedAssociations(ProductRegistry const&, ThinnedAssociationsHelper&) {}
0073 
0074       virtual void doAcquire_(Event const&, EventSetup const&, WaitingTaskWithArenaHolder&) = 0;
0075 
0076       void setModuleDescriptionPtr(ModuleDescription const* iDesc) { moduleDescriptionPtr_ = iDesc; }
0077       // ---------- member data --------------------------------
0078 
0079       std::vector<BranchID> previousParentage_;
0080       std::vector<BranchID> gotBranchIDsFromAcquire_;
0081       ParentageID previousParentageId_;
0082       ModuleDescription const* moduleDescriptionPtr_;
0083     };
0084   }  // namespace stream
0085 }  // namespace edm
0086 #endif