File indexing completed on 2024-04-06 12:13:02
0001 #ifndef ServiceRegistry_ServiceWrapper_h
0002 #define ServiceRegistry_ServiceWrapper_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include <memory>
0023
0024
0025 #include "FWCore/ServiceRegistry/interface/ServiceWrapperBase.h"
0026 #include "FWCore/Utilities/interface/propagate_const.h"
0027
0028
0029 namespace edm {
0030 class ParameterSet;
0031 class ActivityRegistry;
0032
0033 namespace serviceregistry {
0034
0035 template <class T>
0036 class ServiceWrapper : public ServiceWrapperBase {
0037 public:
0038 ServiceWrapper(std::unique_ptr<T> iService) : service_(std::move(iService)) {}
0039 ServiceWrapper(const ServiceWrapper&) = delete;
0040 const ServiceWrapper& operator=(const ServiceWrapper&) = delete;
0041
0042
0043 T const& get() const { return *service_; }
0044
0045
0046
0047
0048 T& get() { return *service_; }
0049
0050 private:
0051
0052 edm::propagate_const<std::unique_ptr<T>> service_;
0053 };
0054 }
0055 }
0056
0057 #endif