105 for (
auto const& ps : psets) {
106 std::string
const service_name{ps.get<std::string>(
"service_type")};
107 std::string
const service_provider{
108 ps.get<std::string>(
"service_provider", service_name)};
110 std::unique_ptr<detail::ServiceHelperBase> service_helper{
112 "create_service_helper")()};
113 if (service_helper->is_interface()) {
115 <<
"Service " << service_name <<
" (of type " 116 << service_helper->get_typeid().className()
117 <<
")\nhas been registered as an interface in its header using\n" 118 <<
"DECLARE_ART_SERVICE_INTERFACE.\n" 119 <<
"Use DECLARE_ART_SERVICE OR DECLARE_ART_SERVICE_INTERFACE_IMPL\n" 120 <<
"as appropriate. A true service interface should *not* be\n" 121 <<
"compiled into a _service.so plugin library.\n";
123 std::unique_ptr<detail::ServiceInterfaceHelper> iface_helper;
124 if (service_helper->is_interface_impl()) {
125 iface_helper.reset(dynamic_cast<detail::ServiceInterfaceHelper*>(
127 "create_iface_helper")()
129 if (dynamic_cast<detail::ServiceInterfaceImplHelper*>(
130 service_helper.get())
131 ->get_interface_typeid() != iface_helper->get_typeid()) {
133 <<
"Service registration for " << service_provider
134 <<
" is internally inconsistent: " << iface_helper->get_typeid()
135 <<
" (" << iface_helper->get_typeid().className() <<
") != " 136 <<
dynamic_cast<detail::ServiceInterfaceImplHelper*
>(
137 service_helper.get())
138 ->get_interface_typeid()
140 <<
dynamic_cast<detail::ServiceInterfaceImplHelper*
>(
141 service_helper.get())
142 ->get_interface_typeid()
145 <<
"Contact the art developers <artists@fnal.gov>.\n";
147 if (service_provider == service_name) {
148 std::string iface_name{
149 cet::demangle_symbol(iface_helper->get_typeid().name())};
151 auto const colon_pos = iface_name.find_last_of(
":");
152 if (colon_pos != std::string::npos) {
153 iface_name.erase(0, colon_pos + 1);
156 <<
"Illegal use of service interface implementation as service name " 157 "in configuration.\n" 158 <<
"Correct use: services." << iface_name
159 <<
": { service_provider: \"" << service_provider <<
"\" }\n";
165 TypeID service_typeid{service_helper->get_typeid()};
166 auto svc =
insertImpl_(ps, std::move(service_helper));
170 index_[service_name] = svc.first;
TypeIDs requestedCreationOrder_
std::unique_ptr< detail::ServiceHelperBase >(*)( SHBCREATOR_t)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::pair< detail::ServiceCache::iterator, bool > insertImpl_(fhicl::ParameterSet const &pset, std::unique_ptr< detail::ServiceHelperBase > &&helper)
void insertInterface_(fhicl::ParameterSet const &pset, std::unique_ptr< detail::ServiceHelperBase > &&helper, detail::ServiceCache::iterator implEntry)
static void setNSchedules(size_t nSched)