Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-11 03:34:11

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 noexcept = 0;
0051       virtual bool wantsInputProcessBlocks() const noexcept = 0;
0052       virtual bool wantsGlobalRuns() const noexcept = 0;
0053       virtual bool wantsGlobalLuminosityBlocks() const noexcept = 0;
0054       bool wantsStreamRuns() const noexcept { return false; }
0055       bool wantsStreamLuminosityBlocks() const noexcept { 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       virtual void preActionBeforeRunEventAsync(WaitingTaskHolder iTask,
0083                                                 ModuleCallingContext const& iModuleCallingContext,
0084                                                 Principal const& iPrincipal) const noexcept {}
0085 
0086       bool hasAcquire() const noexcept { return false; }
0087     };
0088   }  // namespace one
0089 }  // namespace edm
0090 #endif