ServiceTable.h
Go to the documentation of this file.
1 #ifndef art_Framework_Services_Registry_ServiceTable_h
2 #define art_Framework_Services_Registry_ServiceTable_h
3 
5 #include "fhiclcpp/types/Table.h"
7 
8 #include <ostream>
9 #include <set>
10 #include <string>
11 
12 namespace fhicl {
13  class ParameterSet;
14 }
15 
16 namespace art {
17 
18  template <typename T>
20  public:
21  explicit ServiceTable(fhicl::Name&& name) : config_{std::move(name)} {}
22 
24  : config_{fhicl::Name{"<service>"}}
25  {
26  std::set<std::string> const keys_to_ignore{"service_type",
27  "service_provider"};
28  config_.validate_ParameterSet(pset, keys_to_ignore);
29  }
30 
31  fhicl::ParameterSet const&
32  get_PSet() const
33  {
34  return config_.get_PSet();
35  }
36 
37  void
38  print_allowed_configuration(std::ostream& os,
39  std::string const& prefix) const
40  {
41  config_.print_allowed_configuration(os, prefix);
42  }
43 
44  auto const&
45  operator()() const
46  {
47  return config_();
48  }
49 
50  private:
53  get_parameter_base() const override
54  {
55  return &config_;
56  }
57  };
58 
59  template <typename T>
60  inline std::ostream&
61  operator<<(std::ostream& os, ServiceTable<T> const& t)
62  {
63  std::ostringstream config;
64  t.print_allowed_configuration(config, std::string(3, ' '));
65  return os << config.str();
66  }
67 }
68 
69 #endif /* art_Framework_Services_Registry_ServiceTable_h */
70 
71 // Local variables:
72 // mode: c++
73 // End:
auto const & operator()() const
Definition: ServiceTable.h:45
const XML_Char * name
Definition: expat.h:151
fhicl::Table< T > config_
Definition: ServiceTable.h:51
void print_allowed_configuration(std::ostream &os, std::string const &prefix) const
Definition: ServiceTable.h:38
ServiceTable(fhicl::ParameterSet const &pset)
Definition: ServiceTable.h:23
cet::exempt_ptr< fhicl::detail::ParameterBase const > get_parameter_base() const override
Definition: ServiceTable.h:53
ServiceTable(fhicl::Name &&name)
Definition: ServiceTable.h:21
fhicl::ParameterSet const & get_PSet() const
Definition: ServiceTable.h:32
const XML_Char * prefix
Definition: expat.h:380
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8