Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef FWCore_Framework_MakeModuleHelper_h
0002 #define FWCore_Framework_MakeModuleHelper_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/Framework
0006 // Class  :     MakeModuleHelper
0007 //
0008 /**\class edm::MakeModuleHelper MakeModuleHelper.h "MakeModuleHelper.h"
0009 
0010  Description: A template class which can be specialized to create a module from a user type
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Sun, 25 Aug 2013 20:54:45 GMT
0019 //
0020 
0021 // system include files
0022 #include <memory>
0023 // user include files
0024 
0025 // forward declarations
0026 namespace edm {
0027   class ParameterSet;
0028 
0029   template <typename Base>
0030   class MakeModuleHelper {
0031   public:
0032     MakeModuleHelper() = delete;
0033     MakeModuleHelper(const MakeModuleHelper&) = delete;  // stop default
0034 
0035     const MakeModuleHelper& operator=(const MakeModuleHelper&) = delete;  // stop default
0036 
0037     template <typename T>
0038     static std::unique_ptr<Base> makeModule(ParameterSet const& pset) {
0039       auto module = std::make_unique<T>(pset);
0040       return std::unique_ptr<Base>(module.release());
0041     }
0042   };
0043 }  // namespace edm
0044 
0045 #endif