From f0c8777592592a1b8af80e29718e8932c83d792e Mon Sep 17 00:00:00 2001 From: Francis Dupont Date: Fri, 3 Mar 2017 13:49:21 +0100 Subject: [PATCH] [1205a] Moved cfg_to_element.h to src/lib/cc --- src/lib/cc/Makefile.am | 4 ++-- src/lib/{dhcpsrv => cc}/cfg_to_element.h | 8 +++----- src/lib/dhcpsrv/Makefile.am | 2 -- src/lib/dhcpsrv/libdhcpsrv.dox | 4 ++-- 4 files changed, 7 insertions(+), 11 deletions(-) rename src/lib/{dhcpsrv => cc}/cfg_to_element.h (84%) diff --git a/src/lib/cc/Makefile.am b/src/lib/cc/Makefile.am index cbce1325e1..8fd120b84a 100644 --- a/src/lib/cc/Makefile.am +++ b/src/lib/cc/Makefile.am @@ -6,7 +6,7 @@ AM_CXXFLAGS = $(KEA_CXXFLAGS) lib_LTLIBRARIES = libkea-cc.la libkea_cc_la_SOURCES = data.cc data.h -libkea_cc_la_SOURCES += dhcp_config_error.h +libkea_cc_la_SOURCES += cfg_to_element.h dhcp_config_error.h libkea_cc_la_SOURCES += command_interpreter.cc command_interpreter.h libkea_cc_la_SOURCES += simple_parser.cc simple_parser.h @@ -18,7 +18,7 @@ libkea_cc_la_LDFLAGS = -no-undefined -version-info 1:0:0 # Since data.h is now used in the hooks interface, it needs to be # installed on target system. libkea_cc_includedir = $(pkgincludedir)/cc -libkea_cc_include_HEADERS = data.h dhcp_config_error.h +libkea_cc_include_HEADERS = cfg_to_element.h data.h dhcp_config_error.h EXTRA_DIST = cc.dox diff --git a/src/lib/dhcpsrv/cfg_to_element.h b/src/lib/cc/cfg_to_element.h similarity index 84% rename from src/lib/dhcpsrv/cfg_to_element.h rename to src/lib/cc/cfg_to_element.h index 2603204000..3fc8214751 100644 --- a/src/lib/dhcpsrv/cfg_to_element.h +++ b/src/lib/cc/cfg_to_element.h @@ -22,11 +22,10 @@ public: isc::Exception(file, line, what) { }; }; -namespace dhcp { +namespace data { /// @brief Abstract class for configuration Cfg_* classes /// -template struct CfgToElement { /// Destructor virtual ~CfgToElement() { } @@ -35,13 +34,12 @@ struct CfgToElement { /// /// Returns an element which must parse into the same objet, i.e. /// @code - /// for all valid config C parse(toElement(parse(C)) == parse(C) + /// for all valid config C parse(parse(C)->toElement()) == parse(C) /// @endcode /// - /// @param extras extra arguments /// @return a pointer to a configuration which can be parsed into /// the initial configuration object - virtual isc::data::ElementPtr toElement(Args... extras) const = 0; + virtual isc::data::ElementPtr toElement() const = 0; }; }; // namespace isc::dhcp diff --git a/src/lib/dhcpsrv/Makefile.am b/src/lib/dhcpsrv/Makefile.am index ca97321646..6c8f48bb0f 100644 --- a/src/lib/dhcpsrv/Makefile.am +++ b/src/lib/dhcpsrv/Makefile.am @@ -85,7 +85,6 @@ libkea_dhcpsrv_la_SOURCES += alloc_engine.cc alloc_engine.h libkea_dhcpsrv_la_SOURCES += alloc_engine_log.cc alloc_engine_log.h libkea_dhcpsrv_la_SOURCES += base_host_data_source.h libkea_dhcpsrv_la_SOURCES += callout_handle_store.h -libkea_dhcpsrv_la_SOURCES += cfg_to_element.h libkea_dhcpsrv_la_SOURCES += cfg_4o6.h libkea_dhcpsrv_la_SOURCES += cfg_db_access.cc cfg_db_access.h libkea_dhcpsrv_la_SOURCES += cfg_duid.cc cfg_duid.h @@ -223,7 +222,6 @@ EXTRA_DIST += logging.spec # following headers are anticipated to be useful for the user libraries. libkea_dhcpsrv_includedir = $(pkgincludedir)/dhcpsrv libkea_dhcpsrv_include_HEADERS = \ - cfg_to_element.h \ cfg_option.h \ cfg_4o6.h \ d2_client_cfg.h \ diff --git a/src/lib/dhcpsrv/libdhcpsrv.dox b/src/lib/dhcpsrv/libdhcpsrv.dox index 6f3eec57d5..7097b908aa 100644 --- a/src/lib/dhcpsrv/libdhcpsrv.dox +++ b/src/lib/dhcpsrv/libdhcpsrv.dox @@ -80,11 +80,11 @@ predecessor of the current configuration, the value of 2 identifies the one that occurred before it etc. All configuration classes are derived from the abstract base class -\ref isc::dhcp::CfgBase and define the unparse virtual method +\ref isc::data::CfgToElement and define the toElement virtual method which returns a \ref isc::data::ConstElementPtr which must be parsed into the same object, i.e. fullfil this property: @code -for all valid C: parse(unparse(parse(C))) == parse(C) +for all valid C: parse(parse(C)->toElement()) == parse(C) @endcode -- 2.47.3