LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ServiceDirector.h
Go to the documentation of this file.
1 #ifndef art_Framework_EventProcessor_ServiceDirector_h
2 #define art_Framework_EventProcessor_ServiceDirector_h
7 #include "cetlib/HorizontalRule.h"
8 #include "cetlib_except/demangle.h"
11 
12 #include <memory>
13 
14 namespace art {
15  class ServiceDirector;
16 }
17 
19 public:
20  explicit ServiceDirector(fhicl::ParameterSet&& services,
21  ActivityRegistry& areg,
22  ServiceToken& token);
23 
24  template <typename SERVICE, typename... ARGS>
25  void addSystemService(ARGS&&... args);
26 
27 private:
29 };
30 
31 template <typename SERVICE, typename... ARGS>
32 void
34  serviceToken_.add(std::make_unique<SERVICE>(std::forward<ARGS>(args)...));
35 }
37  constexpr cet::HorizontalRule rule{100};
39  << "\n"
40  << rule('=') << "\n\n"
41  << "!! The following service has been misconfigured: !!"
42  << "\n\n"
43  << rule('-') << "\n\nservice_type: "
44  << art::detail::bold_fontify(cet::demangle_symbol(typeid(SERVICE).name()))
45  << "\n\n"
46  << e.what() << "\n"
47  << rule('=') << "\n\n";
48 }
49 
50 #endif /* art_Framework_EventProcessor_ServiceDirector_h */
51 
52 // Local Variables:
53 // mode: c++
54 // End:
std::string bold_fontify(std::string const &s)
Definition: bold_fontify.h:9
void add(std::unique_ptr< T > &&serv)
Definition: ServiceToken.h:46
ServiceDirector(fhicl::ParameterSet &&services, ActivityRegistry &areg, ServiceToken &token)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
char const * what() const noexcept override
HLT enums.
void addSystemService(ARGS &&...args)
Float_t e
Definition: plot.C:34
ServiceToken & serviceToken_