105 vector<ParameterSet> psets;
108 addService(
"FileCatalogMetadata", servicesPSet, psets);
109 servicesPSet.
erase(
"FileCatalogMetadata");
111 addService(
"DatabaseConnection", servicesPSet, psets);
112 servicesPSet.
erase(
"DatabaseConnection");
115 addService(key, servicesPSet, psets);
118 using SHBCREATOR_t = std::unique_ptr<detail::ServiceHelperBase> (*)();
119 for (
auto const& ps : psets) {
120 auto const service_name = ps.get<
string>(
"service_type");
121 auto const service_provider =
122 ps.get<
string>(
"service_provider", service_name);
124 unique_ptr<detail::ServiceHelperBase> service_helper{
125 lm_.getSymbolByLibspec<SHBCREATOR_t>(service_provider,
126 "create_service_helper")()};
127 if (service_helper->is_interface()) {
129 <<
"Service " << service_name <<
" (of type " 130 << service_helper->get_typeid().className()
131 <<
")\nhas been registered as an interface in its header using\n" 132 <<
"DECLARE_ART_SERVICE_INTERFACE.\n" 133 <<
"Use DECLARE_ART_SERVICE OR DECLARE_ART_SERVICE_INTERFACE_IMPL\n" 134 <<
"as appropriate. A true service interface should *not* be\n" 135 <<
"compiled into a _service.so plugin library.\n";
137 unique_ptr<detail::ServiceInterfaceHelper> iface_helper;
138 if (service_helper->is_interface_impl()) {
139 iface_helper.reset(dynamic_cast<detail::ServiceInterfaceHelper*>(
141 .getSymbolByLibspec<SHBCREATOR_t>(service_provider,
142 "create_iface_helper")()
144 if (dynamic_cast<detail::ServiceInterfaceImplHelper*>(
145 service_helper.get())
146 ->get_interface_typeid() != iface_helper->get_typeid()) {
148 <<
"Service registration for " << service_provider
149 <<
" is internally inconsistent: " << iface_helper->get_typeid()
150 <<
" (" << iface_helper->get_typeid().className() <<
") != " 151 <<
dynamic_cast<detail::ServiceInterfaceImplHelper*
>(
152 service_helper.get())
153 ->get_interface_typeid()
155 <<
dynamic_cast<detail::ServiceInterfaceImplHelper*
>(
156 service_helper.get())
157 ->get_interface_typeid()
160 <<
"Contact the art developers <artists@fnal.gov>.\n";
162 if (service_provider == service_name) {
164 cet::demangle_symbol(iface_helper->get_typeid().name())};
166 auto const colon_pos = iface_name.find_last_of(
":");
167 if (colon_pos != std::string::npos) {
168 iface_name.erase(0, colon_pos + 1);
171 <<
"Illegal use of service interface implementation as service " 172 "name in configuration.\n" 173 <<
"Correct use: services." << iface_name
174 <<
": { service_provider: \"" << service_provider <<
"\" }\n";
180 TypeID service_typeid{service_helper->get_typeid()};
184 TypeID
const sType{service_helper->get_typeid()};
186 sType, detail::ServiceCacheEntry(ps, std::move(service_helper)));
191 TypeID
const iType{iface_helper->get_typeid()};
193 detail::ServiceCacheEntry(
194 ps, std::move(iface_helper), svc.first->second));
ActivityRegistry & actReg_
std::vector< TypeID > requestedCreationOrder_
static ServiceRegistry & instance() noexcept
std::vector< std::string > get_pset_names() const
detail::SharedResources & resources_
void setManager(ServicesManager *)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::map< TypeID, detail::ServiceCacheEntry > services_
bool erase(std::string const &key)