Kea  2.1.7-git
config_base.h
Go to the documentation of this file.
1 // Copyright (C) 2018-2019 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 CONFIG_BASE_H
8 #define CONFIG_BASE_H
9 
10 #include <cc/cfg_to_element.h>
11 #include <cc/user_context.h>
13 #include <process/logging_info.h>
14 #include <util/optional.h>
15 #include <boost/date_time/posix_time/posix_time.hpp>
16 
17 namespace isc {
18 namespace process {
19 
34 public:
41 
44  return (logging_info_);
45  }
46 
50  void addLoggingInfo(const process::LoggingInfo& logging_info) {
51  logging_info_.push_back(logging_info);
52  }
53 
55  void applyLoggingCfg() const;
56 
60  bool equals(const ConfigBase& other) const;
61 
82  virtual void merge(ConfigBase& other);
83 
101  virtual isc::data::ElementPtr toElement() const;
102 
107  return (config_ctl_info_);
108  }
109 
119  config_ctl_info) {
120  config_ctl_info_ = config_ctl_info;
121  }
122 
127  void setServerTag(const util::Optional<std::string>& server_tag) {
128  server_tag_ = server_tag;
129  }
130 
135  return (server_tag_);
136  }
137 
140  boost::posix_time::ptime getLastCommitTime() const {
141  return (last_commit_time_);
142  }
143 
146  void setLastCommitTime(const boost::posix_time::ptime& last_commit_time) {
147  last_commit_time_ = last_commit_time;
148  }
149 
150 protected:
159  void copy(ConfigBase& new_config) const;
160 
161 private:
163  process::LoggingInfoStorage logging_info_;
164 
166  process::ConfigControlInfoPtr config_ctl_info_;
167 
169  util::Optional<std::string> server_tag_;
170 
172  boost::posix_time::ptime last_commit_time_;
173 };
174 
176 typedef boost::shared_ptr<ConfigBase> ConfigPtr;
177 
178 };
179 };
180 
181 #endif /* CONFIG_BASE_H */
void setConfigControlInfo(const process::ConfigControlInfoPtr &config_ctl_info)
Set the configuration control information.
Definition: config_base.h:118
boost::posix_time::ptime getLastCommitTime() const
Returns the last commit timestamp.
Definition: config_base.h:140
void addLoggingInfo(const process::LoggingInfo &logging_info)
Sets logging specific configuration.
Definition: config_base.h:50
Base class for user context.
Definition: user_context.h:22
Base class for all configurations.
Definition: config_base.h:33
boost::shared_ptr< Element > ElementPtr
Definition: data.h:24
virtual void merge(ConfigBase &other)
Merges specified configuration into this configuration.
Definition: config_base.cc:91
std::vector< isc::process::LoggingInfo > LoggingInfoStorage
storage for logging information in log4cplus format
Definition: logging_info.h:141
structure that describes one logging entry
Definition: logging_info.h:81
process::ConstConfigControlInfoPtr getConfigControlInfo() const
Fetches a read-only copy of the configuration control information.
Definition: config_base.h:106
void setLastCommitTime(const boost::posix_time::ptime &last_commit_time)
Sets the last commit timestamp.
Definition: config_base.h:146
Abstract class for configuration Cfg_* classes.
void applyLoggingCfg() const
Apply logging configuration to log4cplus.
Definition: config_base.cc:21
Defines the logger used by the top-level component of kea-lfc.
void copy(ConfigBase &new_config) const
Copies the current configuration to a new configuration.
Definition: config_base.cc:71
virtual isc::data::ElementPtr toElement() const
Converts to Element representation.
Definition: config_base.cc:113
void setServerTag(const util::Optional< std::string > &server_tag)
Sets the server&#39;s logical name.
Definition: config_base.h:127
bool equals(const ConfigBase &other) const
Compares two configuration.
Definition: config_base.cc:33
const process::LoggingInfoStorage & getLoggingInfo() const
Returns logging specific configuration.
Definition: config_base.h:43
boost::shared_ptr< ConfigControlInfo > ConfigControlInfoPtr
Defines a pointer to a ConfigControlInfo.
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
Definition: config_base.h:176
util::Optional< std::string > getServerTag() const
Returns the server&#39;s logical name.
Definition: config_base.h:134
boost::shared_ptr< const ConfigControlInfo > ConstConfigControlInfoPtr
Defines a pointer to a const ConfigControlInfo.