Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef FWCore_Framework_UnscheduledConfigurator_h
0002 #define FWCore_Framework_UnscheduledConfigurator_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/Framework
0006 // Class  :     UnscheduledConfigurator
0007 //
0008 /**\class UnscheduledConfigurator UnscheduledConfigurator.h "UnscheduledConfigurator.h"
0009 
0010  Description: [one line class summary]
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Wed, 13 Apr 2016 18:57:55 GMT
0019 //
0020 
0021 // system include files
0022 #include <unordered_map>
0023 
0024 // user include files
0025 
0026 // forward declarations
0027 
0028 namespace edm {
0029   class Worker;
0030   class UnscheduledAuxiliary;
0031 
0032   class UnscheduledConfigurator {
0033   public:
0034     template <typename IT>
0035     UnscheduledConfigurator(IT iBegin, IT iEnd, UnscheduledAuxiliary const* iAux) : m_aux(iAux) {
0036       for (auto it = iBegin; it != iEnd; ++it) {
0037         m_labelToWorker.emplace((*it)->description()->moduleLabel(), *it);
0038       }
0039     }
0040 
0041     UnscheduledConfigurator(const UnscheduledConfigurator&) = delete;                   // stop default
0042     const UnscheduledConfigurator& operator=(const UnscheduledConfigurator&) = delete;  // stop default
0043 
0044     // ---------- const member functions ---------------------
0045     Worker* findWorker(std::string const& iLabel) const {
0046       auto itFound = m_labelToWorker.find(iLabel);
0047       if (itFound != m_labelToWorker.end()) {
0048         return itFound->second;
0049       }
0050       return nullptr;
0051     }
0052 
0053     UnscheduledAuxiliary const* auxiliary() const { return m_aux; }
0054 
0055   private:
0056     // ---------- member data --------------------------------
0057     std::unordered_map<std::string, Worker*> m_labelToWorker;
0058     UnscheduledAuxiliary const* m_aux;
0059   };
0060 }  // namespace edm
0061 
0062 #endif