19 #ifndef LARCORE_COREUTILS_SERVICEUTIL_H 20 #define LARCORE_COREUTILS_SERVICEUTIL_H 29 #include "cetlib_except/demangle.h" 32 #include <type_traits> 39 template <
typename PROVIDER>
42 template <
typename... Services>
79 using Service_t = std::add_const_t<T>;
80 using Provider_t =
typename Service_t::provider_type;
86 Provider_t
const*
const pProvider { h->provider() };
89 <<
"ServiceHandle <" << cet::demangle_symbol(
typeid(Service_t).
name())
90 <<
"> offered a null provider";
125 template <
typename... Services>
140 template <
typename... Services>
149 template <
typename PROVIDER>
157 "Service provider classes must not be copiable" 161 "Service provider classes must not be copiable" 165 "Service provider classes must not be movable" 169 "Service provider classes must not be movable" 175 template <
typename SERVICE>
190 "provider() method has unsupported signature" 197 template <
typename First,
typename... Others>
200 typename First::provider_type,
typename Others::provider_type...
206 lar::providerFrom<First>()
212 template <
typename Service>
223 #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.
virtual const provider_type * provider() const override
Data structure containing constant pointers to classes.
ServiceProviderRequirementsChecker< provider_type > provider_checker
Checker for the provider.
provider_type provider_type
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.