Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-10 02:50:55

0001 #ifndef FWCore_Framework_one_OutputModuleBase_h
0002 #define FWCore_Framework_one_OutputModuleBase_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/Framework
0006 // Class  :     OutputModuleBase
0007 //
0008 /**\class OutputModuleBase OutputModuleBase.h "FWCore/Framework/interface/one/OutputModuleBase.h"
0009 
0010  Description: Base class for all 'one' OutputModules
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Wed, 31 Jul 2013 15:37:16 GMT
0019 //
0020 
0021 // system include files
0022 
0023 // user include files
0024 #include "FWCore/Framework/interface/OutputModuleCore.h"
0025 #include "FWCore/Framework/interface/SharedResourcesAcquirer.h"
0026 
0027 // forward declarations
0028 namespace edm {
0029 
0030   class SubProcessParentageHelper;
0031 
0032   namespace one {
0033 
0034     class OutputModuleBase : public core::OutputModuleCore {
0035     public:
0036       template <typename U>
0037       friend class edm::maker::ModuleHolderT;
0038       template <typename T>
0039       friend class ::edm::WorkerT;
0040       template <typename T>
0041       friend class ::edm::OutputModuleCommunicatorT;
0042       typedef OutputModuleBase ModuleType;
0043 
0044       explicit OutputModuleBase(ParameterSet const& pset);
0045 
0046       OutputModuleBase(OutputModuleBase const&) = delete;             // Disallow copying and moving
0047       OutputModuleBase& operator=(OutputModuleBase const&) = delete;  // Disallow copying and moving
0048 
0049       //Output modules always need writeRun and writeLumi to be called
0050       virtual bool wantsProcessBlocks() const = 0;
0051       virtual bool wantsInputProcessBlocks() const = 0;
0052       virtual bool wantsGlobalRuns() const = 0;
0053       virtual bool wantsGlobalLuminosityBlocks() const = 0;
0054       bool wantsStreamRuns() const { return false; }
0055       bool wantsStreamLuminosityBlocks() const { return false; };
0056 
0057       virtual SerialTaskQueue* globalRunsQueue() { return nullptr; }
0058       virtual SerialTaskQueue* globalLuminosityBlocksQueue() { return nullptr; }
0059       SharedResourcesAcquirer& sharedResourcesAcquirer() { return resourcesAcquirer_; }
0060 
0061       SubProcessParentageHelper const* subProcessParentageHelper() const { return subProcessParentageHelper_; }
0062 
0063     protected:
0064       void doPreallocate(PreallocationConfiguration const&);
0065 
0066       void doBeginJob();
0067       bool doEvent(EventTransitionInfo const&, ActivityRegistry*, ModuleCallingContext const*);
0068 
0069       void configure(OutputModuleDescription const& desc);
0070 
0071     private:
0072       SubProcessParentageHelper const* subProcessParentageHelper_;
0073 
0074       SharedResourcesAcquirer resourcesAcquirer_;
0075       SerialTaskQueue runQueue_;
0076       SerialTaskQueue luminosityBlockQueue_;
0077 
0078       virtual SharedResourcesAcquirer createAcquirer();
0079 
0080       std::string workerType() const { return "WorkerT<edm::one::OutputModuleBase>"; }
0081 
0082       void registerProductsAndCallbacks(OutputModuleBase const*, ProductRegistry const*) {}
0083 
0084       virtual void preActionBeforeRunEventAsync(WaitingTaskHolder iTask,
0085                                                 ModuleCallingContext const& iModuleCallingContext,
0086                                                 Principal const& iPrincipal) const {}
0087 
0088       bool hasAcquire() const { return false; }
0089     };
0090   }  // namespace one
0091 }  // namespace edm
0092 #endif