Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef FWCore_Framework_PathsAndConsumesOfModules_h
0002 #define FWCore_Framework_PathsAndConsumesOfModules_h
0003 
0004 /**\class edm::PathsAndConsumesOfModules
0005 
0006  Description: See comments in the base class
0007 
0008  Usage:
0009 
0010 */
0011 //
0012 // Original Author: W. David Dagenhart
0013 //         Created: 11/5/2014
0014 
0015 #include "FWCore/ServiceRegistry/interface/ConsumesInfo.h"
0016 #include "FWCore/ServiceRegistry/interface/PathsAndConsumesOfModulesBase.h"
0017 
0018 #include "FWCore/Framework/interface/ModuleProcessName.h"
0019 #include "FWCore/Utilities/interface/BranchType.h"
0020 
0021 #include <array>
0022 #include <memory>
0023 #include <string>
0024 #include <utility>
0025 #include <vector>
0026 
0027 namespace edm {
0028 
0029   class ModuleDescription;
0030   class ProductRegistry;
0031   class Schedule;
0032 
0033   class PathsAndConsumesOfModules : public PathsAndConsumesOfModulesBase {
0034   public:
0035     PathsAndConsumesOfModules();
0036     ~PathsAndConsumesOfModules() override;
0037 
0038     void initialize(Schedule const*, std::shared_ptr<ProductRegistry const>);
0039 
0040     void removeModules(std::vector<ModuleDescription const*> const& modules);
0041 
0042     std::vector<ModuleProcessName> const& modulesInPreviousProcessesWhoseProductsAreConsumedBy(
0043         unsigned int moduleID) const;
0044 
0045   private:
0046     std::vector<std::string> const& doPaths() const override { return paths_; }
0047     std::vector<std::string> const& doEndPaths() const override { return endPaths_; }
0048 
0049     std::vector<ModuleDescription const*> const& doAllModules() const override { return allModuleDescriptions_; }
0050     ModuleDescription const* doModuleDescription(unsigned int moduleID) const override;
0051 
0052     std::vector<ModuleDescription const*> const& doModulesOnPath(unsigned int pathIndex) const override;
0053     std::vector<ModuleDescription const*> const& doModulesOnEndPath(unsigned int endPathIndex) const override;
0054     std::vector<ModuleDescription const*> const& doModulesWhoseProductsAreConsumedBy(
0055         unsigned int moduleID, BranchType branchType) const override;
0056 
0057     std::vector<ConsumesInfo> doConsumesInfo(unsigned int moduleID) const override;
0058 
0059     unsigned int doLargestModuleID() const override;
0060 
0061     unsigned int moduleIndex(unsigned int moduleID) const;
0062 
0063     // data members
0064 
0065     std::vector<std::string> paths_;
0066     std::vector<std::string> endPaths_;
0067 
0068     std::vector<ModuleDescription const*> allModuleDescriptions_;
0069 
0070     std::vector<std::vector<ModuleDescription const*> > modulesOnPaths_;
0071     std::vector<std::vector<ModuleDescription const*> > modulesOnEndPaths_;
0072 
0073     // Gives a translation from the module ID to the index into the
0074     // following data member
0075     std::vector<std::pair<unsigned int, unsigned int> > moduleIDToIndex_;
0076 
0077     std::array<std::vector<std::vector<ModuleDescription const*> >, NumBranchTypes> modulesWhoseProductsAreConsumedBy_;
0078     std::vector<std::vector<ModuleProcessName> > modulesInPreviousProcessesWhoseProductsAreConsumedBy_;
0079 
0080     Schedule const* schedule_;
0081     std::shared_ptr<ProductRegistry const> preg_;
0082   };
0083 
0084   std::vector<ModuleDescription const*> nonConsumedUnscheduledModules(
0085       edm::PathsAndConsumesOfModulesBase const& iPnC, std::vector<ModuleProcessName>& consumedByChildren);
0086 
0087   void checkForModuleDependencyCorrectness(edm::PathsAndConsumesOfModulesBase const& iPnC, bool iPrintDependencies);
0088 }  // namespace edm
0089 #endif