Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-02-14 03:16:31

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/PathsAndConsumesOfModulesBase.h"
0016 
0017 #include "FWCore/Framework/interface/ESRecordsToProductResolverIndices.h"
0018 #include "FWCore/Framework/interface/ModuleProcessName.h"
0019 #include "FWCore/ServiceRegistry/interface/ServiceRegistryfwd.h"
0020 #include "FWCore/Utilities/interface/BranchType.h"
0021 #include "FWCore/Utilities/interface/Transition.h"
0022 
0023 #include <array>
0024 #include <memory>
0025 #include <string>
0026 #include <utility>
0027 #include <vector>
0028 
0029 namespace edm {
0030 
0031   class ModuleDescription;
0032   class ProductRegistry;
0033   class Schedule;
0034 
0035   namespace eventsetup {
0036     struct ComponentDescription;
0037     class ESProductResolverProvider;
0038     class EventSetupProvider;
0039   }  // namespace eventsetup
0040 
0041   class PathsAndConsumesOfModules : public PathsAndConsumesOfModulesBase {
0042   public:
0043     PathsAndConsumesOfModules() = default;
0044     ~PathsAndConsumesOfModules() override = default;
0045 
0046     void initialize(Schedule const*, std::shared_ptr<ProductRegistry const>);
0047     void initializeForEventSetup(eventsetup::ESRecordsToProductResolverIndices&&,
0048                                  eventsetup::EventSetupProvider const&);
0049     void checkEventSetupInitialization() const;
0050 
0051     void removeModules(std::vector<ModuleDescription const*> const& modules);
0052 
0053     std::vector<ModuleProcessName> const& modulesInPreviousProcessesWhoseProductsAreConsumedBy(
0054         unsigned int moduleID) const;
0055 
0056   private:
0057     std::vector<std::string> const& doPaths() const override;
0058     std::vector<std::string> const& doEndPaths() const override;
0059 
0060     std::vector<ModuleDescription const*> const& doAllModules() const override;
0061     ModuleDescription const* doModuleDescription(unsigned int moduleID) const override;
0062 
0063     std::vector<ModuleDescription const*> const& doModulesOnPath(unsigned int pathIndex) const override;
0064     std::vector<ModuleDescription const*> const& doModulesOnEndPath(unsigned int endPathIndex) const override;
0065     std::vector<ModuleDescription const*> const& doModulesWhoseProductsAreConsumedBy(
0066         unsigned int moduleID, BranchType branchType) const override;
0067 
0068     std::vector<eventsetup::ComponentDescription const*> const& doESModulesWhoseProductsAreConsumedBy(
0069         unsigned int moduleID, Transition) const override;
0070 
0071     std::vector<ModuleConsumesInfo> doModuleConsumesInfos(unsigned int moduleID) const override;
0072     std::vector<ModuleConsumesESInfo> doModuleConsumesESInfos(unsigned int moduleID) const override;
0073 
0074     unsigned int doLargestModuleID() const override;
0075 
0076     std::vector<eventsetup::ComponentDescription const*> const& doAllESModules() const override;
0077     eventsetup::ComponentDescription const* doComponentDescription(unsigned int esModuleID) const override;
0078 
0079     std::vector<std::vector<eventsetup::ComponentDescription const*>> const&
0080     doESModulesWhoseProductsAreConsumedByESModule() const override;
0081     std::vector<std::vector<ESModuleConsumesInfo>> doESModuleConsumesInfos(unsigned int esModuleID) const override;
0082 
0083     unsigned int moduleIndex(unsigned int moduleID) const;
0084     unsigned int esModuleIndex(unsigned int esModuleID) const;
0085 
0086     // data members
0087 
0088     std::vector<std::string> paths_;
0089     std::vector<std::string> endPaths_;
0090 
0091     std::vector<ModuleDescription const*> allModuleDescriptions_;
0092 
0093     std::vector<std::vector<ModuleDescription const*>> modulesOnPaths_;
0094     std::vector<std::vector<ModuleDescription const*>> modulesOnEndPaths_;
0095 
0096     // Gives a translation from the module ID to the index into the
0097     // following data member
0098     std::vector<std::pair<unsigned int, unsigned int>> moduleIDToIndex_;
0099 
0100     std::array<std::vector<std::vector<ModuleDescription const*>>, NumBranchTypes> modulesWhoseProductsAreConsumedBy_;
0101     std::vector<std::vector<ModuleProcessName>> modulesInPreviousProcessesWhoseProductsAreConsumedBy_;
0102 
0103     std::array<std::vector<std::vector<eventsetup::ComponentDescription const*>>, kNumberOfEventSetupTransitions>
0104         esModulesWhoseProductsAreConsumedBy_;
0105 
0106     // Gives a translation from the componentID to the index into allComponentDescriptions_,
0107     // allESProductResolverProviders_, and the outer vector of esModulesWhoseProductsAreConsumedByESModule_
0108     std::vector<std::pair<unsigned int, unsigned int>> esModuleIDToIndex_;
0109 
0110     std::vector<eventsetup::ComponentDescription const*> allComponentDescriptions_;
0111     std::vector<eventsetup::ESProductResolverProvider const*> allESProductResolverProviders_;
0112     std::vector<std::vector<eventsetup::ComponentDescription const*>> esModulesWhoseProductsAreConsumedByESModule_;
0113 
0114     Schedule const* schedule_ = nullptr;
0115     eventsetup::ESRecordsToProductResolverIndices esRecordsToProductResolverIndices_;
0116     std::shared_ptr<ProductRegistry const> preg_;
0117     bool eventSetupInfoInitialized_ = false;
0118   };
0119 
0120   std::vector<ModuleDescription const*> nonConsumedUnscheduledModules(
0121       edm::PathsAndConsumesOfModulesBase const& iPnC, std::vector<ModuleProcessName>& consumedByChildren);
0122 
0123   void checkForModuleDependencyCorrectness(edm::PathsAndConsumesOfModulesBase const& iPnC, bool iPrintDependencies);
0124 }  // namespace edm
0125 #endif