10 #include "cetlib/LibraryManager.h" 19 cet::LibraryManager
const& lm,
64 auto& serviceEntry = pr.second;
71 if (serviceEntry.is_interface())
76 auto const& pset = serviceEntry.getParameterSet();
77 std::string moduleLabel{};
78 if (!pset.get_if_present(
"service_type", moduleLabel)) {
84 serviceEntry.registerProducts(mpr, productsToProduce, signals, md);
93 tmp.push_back(cur.second.getParameterSet());
100 cet::LibraryManager
const& lm)
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() <<
") != " 137 service_helper.get())
138 ->get_interface_typeid()
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;
175 std::pair<art::detail::ServiceCache::iterator, bool>
178 std::unique_ptr<detail::ServiceHelperBase>&& helper)
182 TypeID const sType{helper->get_typeid()};
190 std::unique_ptr<detail::ServiceHelperBase>&& helper,
195 TypeID const iType{helper->get_typeid()};
std::vector< fhicl::ParameterSet > ParameterSets
void registerProducts(MasterProductRegistry &mpr, ProductDescriptions &productsToProduce, ProducingServiceSignals &signals, ProcessConfiguration const &pc)
std::vector< BranchDescription > ProductDescriptions
detail::ServiceStack actualCreationOrder_
void getParameterSets(ParameterSets &out) const
ModuleDescriptionID id() const
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)
detail::ServiceCache factory_
void insertInterface_(fhicl::ParameterSet const &pset, std::unique_ptr< detail::ServiceHelperBase > &&helper, detail::ServiceCache::iterator implEntry)
ServicesManager(ServicesManager const &)=delete
void fillCache_(ParameterSets const &psets, cet::LibraryManager const &lm)
art::ActivityRegistry & registry_
static void setNSchedules(size_t nSched)