Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef FWCore_Framework_stream_EDProducerAdaptor_h
0002 #define FWCore_Framework_stream_EDProducerAdaptor_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/Framework
0006 // Class  :     EDProducerAdaptor
0007 //
0008 /**\class edm::stream::EDProducerAdaptor EDProducerAdaptor.h "EDProducerAdaptor.h"
0009 
0010  Description: Adapts an edm::stream::EDProducer<> to work with an edm::Worker
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Fri, 02 Aug 2013 18:09:18 GMT
0019 //
0020 
0021 // system include files
0022 
0023 // user include files
0024 #include "FWCore/Framework/interface/stream/EDProducerAdaptorBase.h"
0025 #include "FWCore/Framework/interface/stream/ProducingModuleAdaptor.h"
0026 #include "FWCore/Framework/interface/maker/MakeModuleHelper.h"
0027 // forward declarations
0028 
0029 namespace edm {
0030   namespace stream {
0031     template <typename ABase, typename ModType>
0032     struct BaseToAdaptor;
0033 
0034     template <typename T>
0035     using EDProducerAdaptor = ProducingModuleAdaptor<T, EDProducerBase, EDProducerAdaptorBase>;
0036 
0037     template <typename ModType>
0038     struct BaseToAdaptor<EDProducerAdaptorBase, ModType> {
0039       typedef EDProducerAdaptor<ModType> Type;
0040     };
0041   }  // namespace stream
0042 
0043   template <>
0044   class MakeModuleHelper<edm::stream::EDProducerAdaptorBase> {
0045     typedef edm::stream::EDProducerAdaptorBase Base;
0046 
0047   public:
0048     template <typename ModType>
0049     static std::unique_ptr<Base> makeModule(ParameterSet const& pset) {
0050       typedef typename stream::BaseToAdaptor<Base, ModType>::Type Adaptor;
0051       auto module = std::make_unique<Adaptor>(pset);
0052       return std::unique_ptr<Base>(module.release());
0053     }
0054   };
0055 }  // namespace edm
0056 
0057 #endif