8 #include "cetlib/HorizontalRule.h" 9 #include "cetlib/bold_fontify.h" 10 #include "cetlib_except/demangle.h" 24 std::unique_ptr<ServiceHelperBase>&& helper)
25 : config_{pset},
helper_{std::move(helper)}
30 std::unique_ptr<ServiceHelperBase>&& helper,
38 std::shared_ptr<ServiceWrapperBase> premade_service,
39 std::unique_ptr<ServiceHelperBase>&& helper)
43 std::shared_ptr<ServiceWrapperBase>
68 std::shared_ptr<ServiceWrapperBase>
72 assert(
is_impl() &&
"ServiceCacheEntry::makeAndCacheService called on a " 73 "service interface!");
79 std::ostringstream err_stream;
80 constexpr cet::HorizontalRule rule{100};
82 << rule(
'=') <<
"\n\n" 83 <<
"!! The following service has been misconfigured: !!" 85 << rule(
'-') <<
"\n\nservice_type: " 86 << cet::bold_fontify(
config_.
get<std::string>(
"service_type"))
89 << rule(
'=') <<
"\n\n";
94 <<
"cet::exception caught during construction of service type " 95 << cet::demangle_symbol(
helper_->get_typeid().name()) <<
'\n';
99 <<
"exception caught during construction of service type " 100 << cet::demangle_symbol(
helper_->get_typeid().name()) <<
": " 103 catch (std::string
const& s) {
105 <<
"String exception during construction of service type " 106 << cet::demangle_symbol(
helper_->get_typeid().name()) <<
": " << s;
110 <<
"String exception during construction of service type " 111 << cet::demangle_symbol(
helper_->get_typeid().name()) <<
'\n';
120 "ServiceCacheEntry::forceCreation called on a service interface!");
131 service_->registerProducts(productsToProduce, signals, md);
146 "ServiceCacheEntry::createService called on a service interface!");
153 std::shared_ptr<ServiceWrapperBase>
157 "ServiceCacheEntry::convertService called on a service interface!");
171 return helper_->is_interface();
std::shared_ptr< ServiceWrapperBase > makeService(ActivityRegistry ®, SharedResources &resources) const
fhicl::ParameterSet const & getParameterSet() const
std::stack< WrapperBase_ptr > ServiceStack
bool is_interface() const
void registerProducts(ProductDescriptions &productsToProduce, ProducingServiceSignals &signals, ModuleDescription const &md)
ServiceScope serviceScope() const
std::shared_ptr< ServiceWrapperBase > getService(ActivityRegistry ®, SharedResources &resources, ServiceStack &creationOrder) const
std::vector< BranchDescription > ProductDescriptions
void forceCreation(ActivityRegistry ®, SharedResources &resources) const
virtual std::unique_ptr< ServiceWrapperBase > make(fhicl::ParameterSet const &cfg, ActivityRegistry ®, detail::SharedResources &resources) const =0
ServiceCacheEntry(fhicl::ParameterSet const &pset, std::unique_ptr< ServiceHelperBase > &&helper)
T get(std::string const &key) const
std::unique_ptr< ServiceHelperBase > helper_
void createService(ActivityRegistry ®, SharedResources &resources, ServiceStack &creationOrder) const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
char const * what() const noexcept override
fhicl::ParameterSet config_
std::shared_ptr< ServiceWrapperBase > convertService() const
virtual std::unique_ptr< ServiceWrapperBase > convert(std::shared_ptr< ServiceWrapperBase > const &swb) const =0
cet::exempt_ptr< ServiceCacheEntry const > const interface_impl_
std::shared_ptr< ServiceWrapperBase > service_
cet::coded_exception< error, detail::translate > exception