Kea  2.3.4-git
cfg_globals.h
Go to the documentation of this file.
1 // Copyright (C) 2021-2022 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef CFG_GLOBALS_H
8 #define CFG_GLOBALS_H
9 
10 #include <cc/cfg_to_element.h>
11 #include <cc/data.h>
12 #include <boost/shared_ptr.hpp>
13 #include <map>
14 #include <string>
15 #include <vector>
16 
17 namespace isc {
18 namespace dhcp {
19 
26 public:
27 
29 
39  enum Index : int {
40  // Common parameters.
76 
77  // DHCPv4 specific parameters.
84 
85  // DHCPv6 specific parameters.
90 
91  // Size sentinel.
93  };
94 
96  static const std::map<std::string, int> nameToIndex;
97 
99 
103  CfgGlobals();
104 
110  isc::data::ConstElementPtr get(const std::string& name) const;
111 
117  isc::data::ConstElementPtr get(int index) const;
118 
124  void set(const std::string& name, isc::data::ConstElementPtr value);
125 
131  void set(int index, isc::data::ConstElementPtr value);
132 
134  void clear();
135 
137  typedef std::map<std::string, isc::data::ConstElementPtr> MapType;
138 
143  const MapType valuesMap() const;
144 
149 
150 protected:
152  std::vector<isc::data::ConstElementPtr> values_;
153 };
154 
156 typedef boost::shared_ptr<CfgGlobals> CfgGlobalsPtr;
157 
159 typedef boost::shared_ptr<const CfgGlobals> ConstCfgGlobalsPtr;
160 
161 } // namespace isc::dhcp
162 } // namespace isc
163 
164 #endif // CFG_GLOBALS_H
boost::shared_ptr< CfgGlobals > CfgGlobalsPtr
Non-const shared pointer to a CfgGlobals instance.
Definition: cfg_globals.h:156
static const std::map< std::string, int > nameToIndex
Name to index map.
Definition: cfg_globals.h:96
boost::shared_ptr< const CfgGlobals > ConstCfgGlobalsPtr
Const shared pointer to a CfgGlobals instance.
Definition: cfg_globals.h:159
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
std::vector< isc::data::ConstElementPtr > values_
Vectors of values.
Definition: cfg_globals.h:152
std::map< std::string, isc::data::ConstElementPtr > MapType
Type of name and value map.
Definition: cfg_globals.h:137
Index
Class members.
Definition: cfg_globals.h:39
const MapType valuesMap() const
Returns configured parameters as a map.
Definition: cfg_globals.cc:156
Abstract class for configuration Cfg_* classes.
Class to store configured global parameters.
Definition: cfg_globals.h:25
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
void clear()
Clear configured parameter values.
Definition: cfg_globals.cc:147
Defines the logger used by the top-level component of kea-lfc.
CfgGlobals()
Instance members.
Definition: cfg_globals.cc:109
isc::data::ElementPtr toElement() const
Unparse configured global parameters.
Definition: cfg_globals.cc:169