19 #ifndef LARCORE_COREUTILS_SERVICEUTIL_H 20 #define LARCORE_COREUTILS_SERVICEUTIL_H 29 #include "cetlib_except/demangle.h" 32 #include <type_traits> 38 template <
typename PROVIDER>
41 template <
typename... Services>
77 using Service_t = std::add_const_t<T>;
78 using Provider_t =
typename Service_t::provider_type;
84 Provider_t
const*
const pProvider{h->provider()};
87 <<
"ServiceHandle <" << cet::demangle_symbol(
typeid(Service_t).name())
88 <<
"> offered a null provider";
122 template <
typename... Services>
138 template <
typename... Services>
144 template <
typename PROVIDER>
151 "Service provider classes must not be copiable");
153 "Service provider classes must not be copiable");
155 "Service provider classes must not be movable");
157 "Service provider classes must not be movable");
161 template <
typename SERVICE>
175 "provider() method has unsupported signature");
180 template <
typename First,
typename... Others>
182 static ProviderPack<
typename First::provider_type,
typename Others::provider_type...>
189 template <
typename Service>
198 #endif //#LARCORE_COREUTILS_SERVICEUTIL_H
typename SERVICE::provider_type provider_type
T::provider_type const * providerFrom()
Returns a constant pointer to the provider of specified service.
Defines classes that can't be copied nor moved.
ServiceProviderRequirementsChecker< provider_type > provider_checker
Checker for the provider.
ProviderPack< Providers... > makeProviderPack(Providers const *...providers)
Function to create a ProviderPack from the function arguments.
Compiles only if PROVIDER class satisfied service provider requirements.
provider_type const *(SERVICE::*)() const provider_func_type
auto providersFrom()
Returns a lar::ProviderPack with providers from all services.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
LArSoft-specific namespace.
Container for a list of pointers to providers.
Data structure containing constant pointers to classes.
provider_type provider_type