3 #ifndef SERVICE_HANDLE_HH 4 #define SERVICE_HANDLE_HH 15 using std::runtime_error::runtime_error;
20 using std::runtime_error::runtime_error;
25 using std::runtime_error::runtime_error;
47 if (!provider.
has(serviceName)) {
51 if (!provider.
is_a<Service_t>(serviceName)) {
52 throw bad_service_type{
"Service is not of requested type '" + serviceName +
"'"};
104 if (instance !=
nullptr)
return instance;
110 T* instance =
nullptr;
115 #endif // SERVICE_HANDLE_HH T * operator->() const
Return pointer to service interface.
Definition: service_handle.h:103
Types for defining service class traits.
Semi-smart pointer holding a service interface.
Definition: service_handle.h:91
Template struct for defining trait types and functions for a service.
Definition: service_traits.h:44
Exception reporting that a service is provided, but of the wrong type.
Definition: service_handle.h:19
typename boost::mpl::c_str< typename service_traits< T >::label_type >::type service_label
Convenience type alias for extracting the label of a service.
Definition: service_traits.h:55
Definition: calo_tapered_scin_box_model.h:54
Exception reporting that a service_handle is empty.
Definition: service_handle.h:24
T * service_maker(datatools::service_manager &provider)
Make a service_handle from a datatools::service_manager provider.
Definition: service_handle.h:43
service_handle()=default
Default constructor.
service_handle(datatools::service_manager &sm)
Construct from a service provider.
Definition: service_handle.h:97
Exception reporting that a service is missing in the provider.
Definition: service_handle.h:14