Kea 2.6.0
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>
14#include <util/optional.h>
15#include <boost/date_time/posix_time/posix_time.hpp>
16
17namespace isc {
18namespace process {
19
34public:
41
42
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
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
150protected:
159 void copy(ConfigBase& new_config) const;
160
161private:
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
176typedef boost::shared_ptr<ConfigBase> ConfigPtr;
177
178};
179};
180
181#endif /* CONFIG_BASE_H */
Base class for all configurations.
Definition: config_base.h:33
void addLoggingInfo(const process::LoggingInfo &logging_info)
Sets logging specific configuration.
Definition: config_base.h:50
void applyLoggingCfg() const
Apply logging configuration to log4cplus.
Definition: config_base.cc:23
virtual isc::data::ElementPtr toElement() const
Converts to Element representation.
Definition: config_base.cc:118
process::ConstConfigControlInfoPtr getConfigControlInfo() const
Fetches a read-only copy of the configuration control information.
Definition: config_base.h:106
void setConfigControlInfo(const process::ConfigControlInfoPtr &config_ctl_info)
Set the configuration control information.
Definition: config_base.h:118
const process::LoggingInfoStorage & getLoggingInfo() const
Returns logging specific configuration.
Definition: config_base.h:43
void setServerTag(const util::Optional< std::string > &server_tag)
Sets the server's logical name.
Definition: config_base.h:127
boost::posix_time::ptime getLastCommitTime() const
Returns the last commit timestamp.
Definition: config_base.h:140
void setLastCommitTime(const boost::posix_time::ptime &last_commit_time)
Sets the last commit timestamp.
Definition: config_base.h:146
util::Optional< std::string > getServerTag() const
Returns the server's logical name.
Definition: config_base.h:134
void copy(ConfigBase &new_config) const
Copies the current configuration to a new configuration.
Definition: config_base.cc:77
virtual void merge(ConfigBase &other)
Merges specified configuration into this configuration.
Definition: config_base.cc:96
bool equals(const ConfigBase &other) const
Compares two configuration.
Definition: config_base.cc:39
structure that describes one logging entry
Definition: logging_info.h:81
A template representing an optional value.
Definition: optional.h:36
boost::shared_ptr< Element > ElementPtr
Definition: data.h:28
std::vector< isc::process::LoggingInfo > LoggingInfoStorage
storage for logging information in log4cplus format
Definition: logging_info.h:141
boost::shared_ptr< ConfigBase > ConfigPtr
Non-const pointer to the ConfigBase.
Definition: config_base.h:176
boost::shared_ptr< const ConfigControlInfo > ConstConfigControlInfoPtr
Defines a pointer to a const ConfigControlInfo.
boost::shared_ptr< ConfigControlInfo > ConfigControlInfoPtr
Defines a pointer to a ConfigControlInfo.
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.
Base class for user context.
Definition: user_context.h:22