LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
AllowedConfiguration.h
Go to the documentation of this file.
1 #ifndef art_Framework_Art_detail_AllowedConfiguration_h
2 #define art_Framework_Art_detail_AllowedConfiguration_h
3 
4 /*
5  The functions below:
6 
7  void print_available_plugins
8  void print_description
9  void print_descriptions
10  bool supports_key
11 
12  are the driving functions for the art program options:
13 
14  art --print-available=(module|plugin|service|source)
15  art --print-available-modules
16  art --print-available-services
17  art --print-description <specs>...
18 
19  ===============
20  Developer notes
21  ===============
22 
23  A primary design consideration for this system is that
24  'PluginSuffixes' provides an enumerator for each supported plugin
25  suffix. This allows template programming to be used. However, the
26  necessity of looping over entries implies needing to use inheritance
27  as well.
28 
29  For each plugin, the following information is stored as in a
30  'LibraryInfo' object:
31 
32  - .so name
33  - specs (long and short)
34  - source file path
35  - allowed configuration -- pointer to allowed configuration
36  - provider ("art" or "user")
37  - plugin type
38 
39  Some of the data members may be empty if the associated info is not
40  relevant (e.g. plugin type for services).
41 
42  There are 3 get_* functions that are plugin-specific:
43 
44  1. get_LibraryInfoCollection(suffix_type)
45  2. get_MetadataSummary (suffix_type, LibraryInfoCollection const&)
46  3. get_MetadataCollector(suffix_type)
47 
48  Function 1 is used for returning the LibraryInfo objects associated
49  with a given plugin suffix.
50 
51  Function 2 returns the 'MetadataSummary', which is used for
52  presenting one-line information for the --print-available* program
53  options.
54 
55  Function 3 return the 'MetadataCollector', which is used for
56  presenting more detailed information for '--print-description'.
57 
58  Both 'MetadataSummary' and 'MetadataCollector' are abstract base
59  classes, whose derived classes are template instantiations of
60  'MetadataSummaryFor<suffix_type>' or
61  'MetadataCollectorFor<suffix_type>', respectively.
62 
63  For the '--print-description' option, the 'PluginMetadata' class is
64  used to encapsulate the "header", "details", and "allowed
65  configuration" of each plugin.
66 
67  KK, October 2015
68 */
69 
72 
73 #include <string>
74 #include <vector>
75 
76 namespace art::detail {
77 
78  void print_available_plugins(std::string const& suffix,
79  std::string const& spec,
80  bool verbose);
81 
82  inline void
83  print_available_plugins(std::string const& suffix, bool const verbose)
84  {
85  print_available_plugins(suffix, dflt_spec_pattern(), verbose);
86  }
87 
88  bool supports_key(std::string const& suffix,
89  std::string const& spec,
90  std::string const& key);
91  void print_description(std::vector<PluginMetadata> const& matches);
92  void print_descriptions(std::vector<std::string> const& plugins);
93 }
94 
95 #endif /* art_Framework_Art_detail_AllowedConfiguration_h */
96 
97 // Local variables:
98 // mode: c++
99 // End:
bool supports_key(std::string const &suffix, std::string const &spec, std::string const &key)
void print_available_plugins(std::string const &suffix, std::string const &spec, bool verbose)
void print_descriptions(std::vector< std::string > const &plugins)
void print_description(std::vector< PluginMetadata > const &matches)
constexpr char const * dflt_spec_pattern()