Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-10-02 22:46:38

0001 #ifndef FWCore_Framework_Factory_h
0002 #define FWCore_Framework_Factory_h
0003 
0004 #include "FWCore/Framework/interface/maker/Worker.h"
0005 #include "FWCore/Framework/interface/maker/WorkerMaker.h"
0006 #include "FWCore/Framework/interface/maker/MakeModuleParams.h"
0007 
0008 #include <map>
0009 #include <string>
0010 #include <memory>
0011 #include "FWCore/Utilities/interface/Signal.h"
0012 #include "FWCore/Utilities/interface/propagate_const.h"
0013 #include "FWCore/Utilities/interface/thread_safety_macros.h"
0014 
0015 namespace edm {
0016   class ModuleTypeResolverBase;
0017 
0018   class Factory {
0019   public:
0020     typedef std::map<std::string, edm::propagate_const<std::unique_ptr<Maker>>> MakerMap;
0021 
0022     ~Factory();
0023 
0024     static Factory const* get();
0025 
0026     //This function is not const-thread safe
0027     std::shared_ptr<maker::ModuleHolder> makeModule(const MakeModuleParams&,
0028                                                     const ModuleTypeResolverBase*,
0029                                                     signalslot::Signal<void(const ModuleDescription&)>& pre,
0030                                                     signalslot::Signal<void(const ModuleDescription&)>& post) const;
0031 
0032     std::shared_ptr<maker::ModuleHolder> makeReplacementModule(const edm::ParameterSet&) const;
0033 
0034   private:
0035     Factory();
0036     Maker* findMaker(const MakeModuleParams& p, const ModuleTypeResolverBase*) const;
0037     static Factory const singleInstance_;
0038     //It is not safe to create modules across threads
0039     CMS_SA_ALLOW mutable MakerMap makers_;
0040   };
0041 
0042 }  // namespace edm
0043 #endif