Bayeux  3.4.1
Core Foundation library for SuperNEMO
variant_object_info.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date : 2016-10-27
4  * Last modified : 2016-10-27
5  *
6  * Copyright (C) 2016 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  * A structure describing a variant object.
26  *
27  */
28 
29 #ifndef DATATOOLS_CONFIGURATION_VARIANT_OBJECT_INFO_H
30 #define DATATOOLS_CONFIGURATION_VARIANT_OBJECT_INFO_H
31 
32 // Standard library:
33 #include <string>
34 
35 // This project:
36 #include <datatools/bit_mask.h>
37 #include <datatools/logger.h>
38 
39 namespace datatools {
40 
41  namespace configuration {
42 
56  {
57 
58  public:
59 
61  enum object_type {
68  };
69 
70  void set_registry_name(const std::string & registry_name_);
71 
72  void make_registry(const std::string & registry_name_);
73 
74  void make_global(const std::string & registry_name_);
75 
76  void make_variant(const std::string & registry_name_,
77  const std::string & variant_local_path_);
78 
79  void make_local_variant(const std::string & variant_local_path_);
80 
81  void make_parameter(const std::string & registry_name_,
82  const std::string & parameter_local_path_);
83 
84  void make_local_parameter(const std::string & parameter_local_path_);
85 
86  void make_parameter_value_group(const std::string & registry_name_,
87  const std::string & param_local_path_,
88  const std::string & group_name_);
89 
90  void make_local_parameter_value_group(const std::string & param_local_path_,
91  const std::string & group_name_);
92 
93  void make_parameter_enum_string_value(const std::string & registry_name_,
94  const std::string & param_local_path_,
95  const std::string & value_);
96 
97  void make_local_parameter_enum_string_value(const std::string & param_local_path_,
98  const std::string & value_);
99 
100  bool is_valid() const;
101 
102  bool is_local() const;
103 
104  bool is_global() const;
105 
106  object_type get_type() const;
107 
108  bool is_registry() const;
109 
110  bool is_variant() const;
111 
112  bool is_parameter() const;
113 
114  bool is_parameter_value_group() const;
115 
116  bool is_parameter_enum_string_value() const;
117 
118  const std::string & get_registry_name() const;
119 
120  const std::string & get_local_path() const;
121 
122  const std::string & get_variant_local_path() const;
123 
124  const std::string & get_parameter_local_path() const;
125 
126  const std::string & get_parameter_value_group_name() const;
127 
128  const std::string & get_parameter_enum_string_value() const;
129 
131  void reset();
132 
134  enum parse_flags {
138  };
139 
141  bool parse_from_string(const std::string & repr_, uint32_t flags_ = 0);
142 
144  void to_string(std::string & repr_) const;
145 
147  friend std::ostream & operator<<(std::ostream &, const variant_object_info &);
148 
150  std::string get_full_path() const;
151 
153  bool match_path(const std::string & path_) const;
154 
155  protected:
156 
157  bool _parse_from_string_global(const std::string & repr_, const datatools::logger::priority logging_);
158 
159  bool _parse_from_string_local(const std::string & repr_, const datatools::logger::priority logging_);
160 
161  private:
162 
163  object_type _type_ = OBJECT_INVALID;
164  std::string _registry_name_;
165  std::string _local_path_;
166  std::string _parameter_value_group_name_;
167  std::string _parameter_enum_string_value_;
168 
169  };
170 
171  } // end of namespace configuration
172 
173 } // end of namespace datatools
174 
175 #endif // DATATOOLS_CONFIGURATION_VARIANT_OBJECT_INFO_H
176 
177 // Local Variables: --
178 // mode: c++ --
179 // c-file-style: "gnu" --
180 // tab-width: 2 --
181 // End: --
const std::string & get_parameter_value_group_name() const
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
const std::string & get_local_path() const
void make_local_parameter_enum_string_value(const std::string &param_local_path_, const std::string &value_)
std::string get_full_path() const
Return the full path.
Variant object.
Definition: variant_object_info.h:64
static const uint32_t bit01
Definition: bit_mask.h:28
const std::string & get_parameter_enum_string_value() const
bool parse_from_string(const std::string &repr_, uint32_t flags_=0)
Parse from a string.
void make_local_variant(const std::string &variant_local_path_)
parse_flags
Parsing flags.
Definition: variant_object_info.h:134
void make_parameter_value_group(const std::string &registry_name_, const std::string &param_local_path_, const std::string &group_name_)
const std::string & get_registry_name() const
Variant parameter enumerated string value object.
Definition: variant_object_info.h:67
const std::string & get_variant_local_path() const
void set_registry_name(const std::string &registry_name_)
bool _parse_from_string_local(const std::string &repr_, const datatools::logger::priority logging_)
void make_global(const std::string &registry_name_)
object_type
Object type:
Definition: variant_object_info.h:61
void to_string(std::string &repr_) const
Convert to a string.
friend std::ostream & operator<<(std::ostream &, const variant_object_info &)
Stream.
void make_parameter(const std::string &registry_name_, const std::string &parameter_local_path_)
static const uint32_t bit02
Definition: bit_mask.h:29
void make_variant(const std::string &registry_name_, const std::string &variant_local_path_)
void make_parameter_enum_string_value(const std::string &registry_name_, const std::string &param_local_path_, const std::string &value_)
void make_local_parameter_value_group(const std::string &param_local_path_, const std::string &group_name_)
bool match_path(const std::string &path_) const
Check compatibility with a given path.
Structure describing a variant object of interest which may have (dynamic) dependencies.
Definition: variant_object_info.h:55
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
Utilities for logging information.
Variant registry object.
Definition: variant_object_info.h:63
Variant parameter object.
Definition: variant_object_info.h:65
Invalid object.
Definition: variant_object_info.h:62
static const uint32_t bit00
Definition: bit_mask.h:27
const std::string & get_parameter_local_path() const
bool _parse_from_string_global(const std::string &repr_, const datatools::logger::priority logging_)
Variant parameter value group object.
Definition: variant_object_info.h:66
void make_registry(const std::string &registry_name_)
void make_local_parameter(const std::string &parameter_local_path_)