Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:13:02

0001 #ifndef FWCore_ServiceRegistry_PathsAndConsumesOfModulesBase_h
0002 #define FWCore_ServiceRegistry_PathsAndConsumesOfModulesBase_h
0003 
0004 /**\class edm::PathsAndConsumesOfModulesBase
0005 
0006  Description: Contains information about paths and end paths
0007  as well as the modules on them. Also contains information
0008  about all modules that might run. Also contains information
0009  about the products a module is declared to consume and the
0010  dependences between modules which can be derived from
0011  those declarations.
0012 
0013  Usage: This is typically passed as an argument to the
0014  PreBeginJob callback for a service.
0015 
0016  In a SubProcess job, an instance of this class this will
0017  contain information about 1 Process/SubProcess, but a
0018  service will be passed a separate object for its process
0019  and each SubProcess descended from it.
0020 */
0021 //
0022 // Original Author: W. David Dagenhart
0023 //         Created: 11/5/2014
0024 
0025 #include "FWCore/ServiceRegistry/interface/ConsumesInfo.h"
0026 #include "FWCore/Utilities/interface/BranchType.h"
0027 
0028 #include <string>
0029 #include <vector>
0030 
0031 namespace edm {
0032 
0033   class ModuleDescription;
0034 
0035   class PathsAndConsumesOfModulesBase {
0036   public:
0037     virtual ~PathsAndConsumesOfModulesBase();
0038 
0039     std::vector<std::string> const& paths() const { return doPaths(); }
0040     std::vector<std::string> const& endPaths() const { return doEndPaths(); }
0041 
0042     std::vector<ModuleDescription const*> const& allModules() const { return doAllModules(); }
0043 
0044     ModuleDescription const* moduleDescription(unsigned int moduleID) const { return doModuleDescription(moduleID); }
0045 
0046     std::vector<ModuleDescription const*> const& modulesOnPath(unsigned int pathIndex) const {
0047       return doModulesOnPath(pathIndex);
0048     }
0049 
0050     std::vector<ModuleDescription const*> const& modulesOnEndPath(unsigned int endPathIndex) const {
0051       return doModulesOnEndPath(endPathIndex);
0052     }
0053 
0054     // The modules in the returned vector will be from the current process
0055     // (not the prior process, and it will never include the source even
0056     // though the source can make products) and these modules will declare
0057     // they produce (they might or might not really produce) at least one
0058     // product in the event (not run, not lumi) that the module corresponding
0059     // to the moduleID argument declares it consumes (includes declarations using
0060     // consumes or maybeConsumes). Note that if a module declares
0061     // it consumes a module label that is an EDAlias, the corresponding module
0062     // description will be included in the returned vector (but the label in the
0063     // module description is not the EDAlias label).
0064     std::vector<ModuleDescription const*> const& modulesWhoseProductsAreConsumedBy(
0065         unsigned int moduleID, BranchType branchType = InEvent) const {
0066       return doModulesWhoseProductsAreConsumedBy(moduleID, branchType);
0067     }
0068 
0069     // This returns the declared consumes information for a module.
0070     // Note the other functions above return a reference to an object
0071     // that is held in memory throughout the job, while the following
0072     // function returns a newly created object each time.  We do not
0073     // expect this to be called during a normal production job where
0074     // performance and memory are important. These objects are bigger
0075     // than just a pointer.
0076     std::vector<ConsumesInfo> consumesInfo(unsigned int moduleID) const { return doConsumesInfo(moduleID); }
0077 
0078     unsigned int largestModuleID() const { return doLargestModuleID(); }
0079 
0080   private:
0081     virtual std::vector<std::string> const& doPaths() const = 0;
0082     virtual std::vector<std::string> const& doEndPaths() const = 0;
0083     virtual std::vector<ModuleDescription const*> const& doAllModules() const = 0;
0084     virtual ModuleDescription const* doModuleDescription(unsigned int moduleID) const = 0;
0085     virtual std::vector<ModuleDescription const*> const& doModulesOnPath(unsigned int pathIndex) const = 0;
0086     virtual std::vector<ModuleDescription const*> const& doModulesOnEndPath(unsigned int endPathIndex) const = 0;
0087     virtual std::vector<ModuleDescription const*> const& doModulesWhoseProductsAreConsumedBy(
0088         unsigned int moduleID, BranchType branchType) const = 0;
0089     virtual std::vector<ConsumesInfo> doConsumesInfo(unsigned int moduleID) const = 0;
0090     virtual unsigned int doLargestModuleID() const = 0;
0091   };
0092 }  // namespace edm
0093 #endif