108 vector<ParameterSet> psets;
111 addService(
"FileCatalogMetadata", servicesPSet, psets);
112 servicesPSet.
erase(
"FileCatalogMetadata");
114 addService(
"DatabaseConnection", servicesPSet, psets);
115 servicesPSet.
erase(
"DatabaseConnection");
118 addService(
key, servicesPSet, psets);
121 using SHBCREATOR_t = std::unique_ptr<detail::ServiceHelperBase> (*)();
122 for (
auto const&
ps : psets) {
123 auto const service_name =
ps.get<
string>(
"service_type");
124 auto const service_provider =
125 ps.get<
string>(
"service_provider", service_name);
127 unique_ptr<detail::ServiceHelperBase> service_helper{
129 "create_service_helper")()};
130 if (service_helper->is_interface()) {
132 <<
"Service " << service_name <<
" (of type " 133 << service_helper->get_typeid().className()
134 <<
")\nhas been registered as an interface in its header using\n" 135 <<
"DECLARE_ART_SERVICE_INTERFACE.\n" 136 <<
"Use DECLARE_ART_SERVICE OR DECLARE_ART_SERVICE_INTERFACE_IMPL\n" 137 <<
"as appropriate. A true service interface should *not* be\n" 138 <<
"compiled into a _service.so plugin library.\n";
140 unique_ptr<detail::ServiceInterfaceHelper> iface_helper;
141 if (service_helper->is_interface_impl()) {
142 iface_helper.reset(dynamic_cast<detail::ServiceInterfaceHelper*>(
144 .getSymbolByLibspec<SHBCREATOR_t>(service_provider,
145 "create_iface_helper")()
147 if (dynamic_cast<detail::ServiceInterfaceImplHelper*>(
148 service_helper.get())
149 ->get_interface_typeid() != iface_helper->get_typeid()) {
151 <<
"Service registration for " << service_provider
152 <<
" is internally inconsistent: " << iface_helper->get_typeid()
153 <<
" (" << iface_helper->get_typeid().className() <<
") != " 154 <<
dynamic_cast<detail::ServiceInterfaceImplHelper*
>(
155 service_helper.get())
156 ->get_interface_typeid()
158 <<
dynamic_cast<detail::ServiceInterfaceImplHelper*
>(
159 service_helper.get())
160 ->get_interface_typeid()
163 <<
"Contact the art developers <artists@fnal.gov>.\n";
165 if (service_provider == service_name) {
167 cet::demangle_symbol(iface_helper->get_typeid().name())};
169 auto const colon_pos = iface_name.find_last_of(
":");
170 if (colon_pos != std::string::npos) {
171 iface_name.erase(0, colon_pos + 1);
174 <<
"Illegal use of service interface implementation as service " 175 "name in configuration.\n" 176 <<
"Correct use: services." << iface_name
177 <<
": { service_provider: \"" << service_provider <<
"\" }\n";
183 TypeID service_typeid{service_helper->get_typeid()};
187 TypeID
const sType{service_helper->get_typeid()};
189 sType, detail::ServiceCacheEntry(
ps,
move(service_helper)));
194 TypeID
const iType{iface_helper->get_typeid()};
197 detail::ServiceCacheEntry(
ps,
move(iface_helper),
svc.first->second));
ActivityRegistry & actReg_
std::vector< TypeID > requestedCreationOrder_
static ServiceRegistry & instance() noexcept
T getSymbolByLibspec(std::string const &libspec, std::string const &sym_name) const
std::vector< std::string > get_pset_names() const
detail::SharedResources & resources_
void setManager(ServicesManager *)
static constexpr double ps
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::map< TypeID, detail::ServiceCacheEntry > services_
bool erase(std::string const &key)