Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef FWCore_Framework_limited_OutputModuleBase_h
0002 #define FWCore_Framework_limited_OutputModuleBase_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/Framework
0006 // Class  :     OutputModuleBase
0007 //
0008 /**\class OutputModuleBase OutputModuleBase.h "FWCore/Framework/interface/limited/OutputModuleBase.h"
0009 
0010  Description: Base class for all 'limited' OutputModules
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 //
0018 
0019 // system include files
0020 
0021 // user include files
0022 #include "FWCore/Framework/interface/OutputModuleCore.h"
0023 #include "FWCore/Concurrency/interface/LimitedTaskQueue.h"
0024 
0025 // forward declarations
0026 namespace edm {
0027 
0028   namespace limited {
0029 
0030     class OutputModuleBase : public core::OutputModuleCore {
0031     public:
0032       template <typename U>
0033       friend class edm::maker::ModuleHolderT;
0034       template <typename T>
0035       friend class ::edm::WorkerT;
0036       template <typename T>
0037       friend class ::edm::OutputModuleCommunicatorT;
0038       typedef OutputModuleBase ModuleType;
0039 
0040       explicit OutputModuleBase(ParameterSet const& pset);
0041 
0042       OutputModuleBase(OutputModuleBase const&) = delete;             // Disallow copying and moving
0043       OutputModuleBase& operator=(OutputModuleBase const&) = delete;  // Disallow copying and moving
0044 
0045       static void fillDescription(
0046           ParameterSetDescription& desc,
0047           std::vector<std::string> const& iDefaultOutputCommands = ProductSelectorRules::defaultSelectionStrings());
0048 
0049       //Output modules always need writeRun and writeLumi to be called
0050       bool wantsGlobalRuns() const { return true; }
0051       bool wantsGlobalLuminosityBlocks() const { return true; }
0052       virtual bool wantsProcessBlocks() const = 0;
0053       virtual bool wantsInputProcessBlocks() const = 0;
0054       virtual bool wantsStreamRuns() const = 0;
0055       virtual bool wantsStreamLuminosityBlocks() const = 0;
0056 
0057       unsigned int concurrencyLimit() const { return queue_.concurrencyLimit(); }
0058 
0059       LimitedTaskQueue& queue() { return queue_; }
0060 
0061     protected:
0062       void doPreallocate(PreallocationConfiguration const&);
0063 
0064       void doBeginJob();
0065 
0066       void doBeginStream(StreamID id);
0067       void doEndStream(StreamID id);
0068 
0069       bool doEvent(EventTransitionInfo const&, ActivityRegistry*, ModuleCallingContext const*);
0070       //For now this is a placeholder
0071       /*virtual*/ void preActionBeforeRunEventAsync(WaitingTaskHolder,
0072                                                     ModuleCallingContext const&,
0073                                                     Principal const&) const {}
0074 
0075     private:
0076       LimitedTaskQueue queue_;
0077 
0078       std::string workerType() const { return "WorkerT<edm::limited::OutputModuleBase>"; }
0079 
0080       void registerProductsAndCallbacks(OutputModuleBase const*, ProductRegistry const*) {}
0081 
0082       virtual void preallocStreams(unsigned int) {}
0083       virtual void preallocate(PreallocationConfiguration const&) {}
0084       virtual void doBeginStream_(StreamID) {}
0085       virtual void doEndStream_(StreamID) {}
0086       virtual void doStreamBeginRun_(StreamID, RunForOutput const&, EventSetup const&) {}
0087       virtual void doStreamEndRun_(StreamID, RunForOutput const&, EventSetup const&) {}
0088       virtual void doStreamEndRunSummary_(StreamID, RunForOutput const&, EventSetup const&) {}
0089       virtual void doStreamBeginLuminosityBlock_(StreamID, LuminosityBlockForOutput const&, EventSetup const&) {}
0090       virtual void doStreamEndLuminosityBlock_(StreamID, LuminosityBlockForOutput const&, EventSetup const&) {}
0091       virtual void doStreamEndLuminosityBlockSummary_(StreamID, LuminosityBlockForOutput const&, EventSetup const&) {}
0092 
0093       virtual void doBeginRunSummary_(RunForOutput const&, EventSetup const&) {}
0094       virtual void doEndRunSummary_(RunForOutput const&, EventSetup const&) {}
0095       virtual void doBeginLuminosityBlockSummary_(LuminosityBlockForOutput const&, EventSetup const&) {}
0096       virtual void doEndLuminosityBlockSummary_(LuminosityBlockForOutput const&, EventSetup const&) {}
0097       bool hasAcquire() const { return false; }
0098     };
0099   }  // namespace limited
0100 }  // namespace edm
0101 #endif