Bayeux  3.4.1
Core Foundation library for SuperNEMO
variant_registry_manager.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date : 2014-05-11
4  * Last modified : 2014-10-27
5  *
6  * Copyright (C) 2014 Francois Mauger <mauger@lpccaen.in2p3.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or (at
11  * your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  * Description:
24  *
25  * The configuration variant registry manager/factory.
26  *
27  */
28 
29 #ifndef DATATOOLS_CONFIGURATION_VARIANT_REGISTRY_MANAGER_H
30 #define DATATOOLS_CONFIGURATION_VARIANT_REGISTRY_MANAGER_H
31 
32 // Standard library:
33 #include <string>
34 #include <set>
35 #include <vector>
36 #include <map>
37 
38 // This project (Bayeux/datatools):
39 #include <datatools/i_tree_dump.h>
43 #include <datatools/logger.h>
45 
46 namespace datatools {
47 
48  namespace configuration {
49 
52  {
53  public:
54 
57 
59  virtual ~variant_registry_manager();
60 
62  bool is_initialized() const;
63 
65  void initialize(const properties & config_);
66 
68  void initialize_simple();
69 
71  void reset();
72 
74  void set_top_variant_name(const std::string &);
75 
77  const std::string & get_top_variant_name() const;
78 
80  void add_property_prefix(const std::string & prefix_);
81 
83  const std::set<std::string> & get_property_prefixes() const;
84 
86  void load_configuration_items_list(const std::string & item_list_file_);
87 
89  void load(const std::string & items_config_file_);
90 
93 
95  virtual void tree_dump(std::ostream & out_ = std::clog,
96  const std::string & title_ = "",
97  const std::string & indent_ = "",
98  bool inherit_ = false) const;
99 
102 
103  protected:
104 
106  void _set_default();
107 
108  private:
109 
111  void _construct_();
112 
113  private:
114 
115  bool _initialized_;
116  multi_properties _mp_;
117  std::set<std::string> _property_prefixes_;
118  std::string _top_variant_name_;
119  model_item_dict_type _configuration_items_;
120 
121  };
122 
123  } // end of namespace configuration
124 
125 } // end of namespace datatools
126 
127 // OCD support:
128 #include <datatools/ocd_macros.h>
129 
133 
134 #endif // DATATOOLS_CONFIGURATION_VARIANT_REGISTRY_MANAGER_H
135 
136 // Local Variables: --
137 // mode: c++ --
138 // c-file-style: "gnu" --
139 // tab-width: 2 --
140 // End: --
const std::string & get_top_variant_name() const
Return the name of the top variant.
A container of mapped properties objects.
Definition: multi_properties.h:99
void load(const std::string &items_config_file_)
Load definitions of configuration items from a file with a stored multi-properties container.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
An object that describes the way an object of a given class can be configured through properties.
Definition: object_configuration_description.h:234
std::map< std::string, model_item > model_item_dict_type
Dictionary of items.
Definition: utils.h:62
A Factory/manager for configuration variants and associated parameters.
Definition: variant_registry_manager.h:51
void add_property_prefix(const std::string &prefix_)
Add a property prefix to be preserved configuration items.
DOCD_CLASS_DECLARATION(my::algo)
Declaration of the OCD support for the my::algo class.
static void init_ocd(datatools::object_configuration_description &)
OCD support.
const std::set< std::string > & get_property_prefixes() const
Return the array of exported property prefixes.
void load_configuration_items_list(const std::string &item_list_file_)
Loading a file that contains a list of configuration items definition filenames :
void set_top_variant_name(const std::string &)
Set the name of the top variant.
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
Utilities for logging information.
const model_item_dict_type & get_configuration_items() const
Get a non-mutable collection of configuration items.
A base class with useful attributes usable in many contexts.
Definition: enriched_base.h:52
bool is_initialized() const
Check initialization status.
void initialize(const properties &config_)
Configuration and initialization from properties.
A dictionary of arbitrary properties.
Definition: properties.h:125