Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:45:48

0001 #ifndef CondCore_CondDB_CondServiceWrapper_h
0002 #define CondCore_CondDB_CondServiceWrapper_h
0003 
0004 #include <string>
0005 
0006 namespace coral {
0007   class Service;
0008 }
0009 
0010 /**
0011  * The wrapper is used to allow edm::PluginFactory to change its
0012  * return type to unique_ptr from a raw pointer. The unique_ptr does
0013  * not work for coral::Service, because its destructor is protected
0014  * and ownership is managed by intrusive reference counting.
0015  */
0016 namespace cond {
0017   struct CoralServiceWrapperBase {
0018     virtual ~CoralServiceWrapperBase() = default;
0019     virtual coral::Service* create(const std::string& componentname) const = 0;
0020   };
0021 
0022   template <typename T>
0023   struct CoralServiceWrapper : public CoralServiceWrapperBase {
0024     ~CoralServiceWrapper() override = default;
0025     coral::Service* create(const std::string& componentname) const override { return new T{componentname}; }
0026   };
0027 }  // namespace cond
0028 
0029 #endif