All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ProviderUtil.h
Go to the documentation of this file.
1 /**
2  * @file ProviderUtil.h
3  * @brief Simple utilities for service providers
4  * @date November 30, 2015
5  * @author Gianluca Petrillo (petrillo@fnal.gov)
6  *
7  * Currently this header is written so that it does not need a implementation
8  * file.
9  */
10 
11 #ifndef DETECTORINFO_PROVIDERUTIL_H
12 #define DETECTORINFO_PROVIDERUTIL_H 1
13 
14 // C/C++ standard libraries
15 #include <string>
16 #include <set>
17 
18 
19 namespace lar {
20 
21  /** **************************************************************************
22  * @brief Returns a list of configuration keys that providers should ignore
23  * @return a reference to a key list
24  *
25  * This function may be used for parameter validation, like in:
26  *
27  * fhicl::Table<Config> cfg { pset, lar::IgnorableProviderConfigKeys() };
28  *
29  * where `pset` is a `fhicl::ParameterSet`. This will inform `cfg` that some
30  * keys can be unexpectedly present, or missing.
31  *
32  * This implementation includes:
33  * * art framework service keywords
34  */
35  inline std::set<std::string> const& IgnorableProviderConfigKeys()
36  {
37  static std::set<std::string> const ignorable {
38  "service_type", // added by art: service name (possibly interface)
39  "service_provider" // art: service implementation name
40  };
41  return ignorable;
42  } // IgnorableProviderConfigKeys()
43 
44 
45 
46 } // namespace lar
47 
48 
49 #endif // DETECTORINFO_PROVIDERUTIL_H
std::set< std::string > const & IgnorableProviderConfigKeys()
Returns a list of configuration keys that providers should ignore.
Definition: ProviderUtil.h:35