Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-06-29 22:58:01

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   namespace one {
0031 
0032     class OutputModuleBase : public core::OutputModuleCore {
0033     public:
0034       template <typename U>
0035       friend class edm::maker::ModuleHolderT;
0036       template <typename T>
0037       friend class ::edm::WorkerT;
0038       template <typename T>
0039       friend class ::edm::OutputModuleCommunicatorT;
0040       typedef OutputModuleBase ModuleType;
0041 
0042       explicit OutputModuleBase(ParameterSet const& pset);
0043 
0044       OutputModuleBase(OutputModuleBase const&) = delete;             // Disallow copying and moving
0045       OutputModuleBase& operator=(OutputModuleBase const&) = delete;  // Disallow copying and moving
0046 
0047       //Output modules always need writeRun and writeLumi to be called
0048       virtual bool wantsProcessBlocks() const noexcept = 0;
0049       virtual bool wantsInputProcessBlocks() const noexcept = 0;
0050       virtual bool wantsGlobalRuns() const noexcept = 0;
0051       virtual bool wantsGlobalLuminosityBlocks() const noexcept = 0;
0052       bool wantsStreamRuns() const noexcept { return false; }
0053       bool wantsStreamLuminosityBlocks() const noexcept { return false; };
0054 
0055       virtual SerialTaskQueue* globalRunsQueue() { return nullptr; }
0056       virtual SerialTaskQueue* globalLuminosityBlocksQueue() { return nullptr; }
0057       SharedResourcesAcquirer& sharedResourcesAcquirer() { return resourcesAcquirer_; }
0058 
0059     protected:
0060       void doPreallocate(PreallocationConfiguration const&);
0061 
0062       void doBeginJob();
0063       bool doEvent(EventTransitionInfo const&, ActivityRegistry*, ModuleCallingContext const*);
0064 
0065       void configure(OutputModuleDescription const& desc);
0066 
0067     private:
0068       SharedResourcesAcquirer resourcesAcquirer_;
0069       SerialTaskQueue runQueue_;
0070       SerialTaskQueue luminosityBlockQueue_;
0071 
0072       virtual SharedResourcesAcquirer createAcquirer();
0073 
0074       virtual void preActionBeforeRunEventAsync(WaitingTaskHolder iTask,
0075                                                 ModuleCallingContext const& iModuleCallingContext,
0076                                                 Principal const& iPrincipal) const noexcept {}
0077 
0078       bool hasAcquire() const noexcept { return false; }
0079     };
0080   }  // namespace one
0081 }  // namespace edm
0082 #endif