1 #ifndef art_Framework_Services_Registry_ServicesManager_h 2 #define art_Framework_Services_Registry_ServicesManager_h 16 #include "cetlib_except/demangle.h" 29 class ActivityRegistry;
30 class ProcessConfiguration;
31 class ProducingServiceSignals;
33 class SharedResources;
52 return services_.find(
TypeID{
typeid(
T)}) !=
cend(services_);
55 void getParameterSets(std::vector<fhicl::ParameterSet>& out)
const;
61 std::vector<std::string> registerProducts(
70 void put(std::unique_ptr<T>&& premade_service);
72 template <
typename SERVICE,
typename... ARGS>
73 void addSystemService(ARGS&&...
args);
79 std::map<TypeID, detail::ServiceCacheEntry> services_{};
80 std::vector<TypeID> requestedCreationOrder_{};
81 std::stack<std::shared_ptr<detail::ServiceWrapperBase>>
82 actualCreationOrder_{};
83 std::vector<std::string> configErrMsgs_{};
90 auto it = services_.find(
TypeID{
typeid(
T)});
91 if (it == services_.end()) {
93 <<
"ServicesManager unable to find the service of type '" 94 << cet::demangle_symbol(
typeid(
T).
name()) <<
"'.\n";
96 return it->second.get<
T>(actReg_, resources_, actualCreationOrder_);
103 std::unique_ptr<detail::ServiceHelperBase> service_helper(
106 auto it = services_.find(
id);
107 if (it != services_.end()) {
109 <<
"The system has manually added service of type " 110 << cet::demangle_symbol(
id.
name())
111 <<
", but the service system already has a configured service of that " 116 actualCreationOrder_.push(swb);
121 template <
typename SERVICE,
typename... ARGS>
124 put(std::make_unique<SERVICE>(std::forward<ARGS>(
args)...));
130 << rule(
'=') <<
"\n\n" 131 <<
"!! The following service has been misconfigured: !!" 133 << rule(
'-') <<
"\n\nservice_type: " 137 << rule(
'=') <<
"\n\n";
ActivityRegistry & actReg_
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
std::vector< BranchDescription > ProductDescriptions
void addSystemService(ARGS &&...args)
void put(std::unique_ptr< T > &&premade_service)
detail::SharedResources & resources_
std::string bold_fontify(std::string const &s)
std::shared_ptr< ServiceWrapperBase > WrapperBase_ptr
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
char const * what() const noexcept override
static std::string const & service()