Commit 99705e8b authored by Francis Dupont's avatar Francis Dupont

[master] Merged trac1205a (unparse design)

parents c43220c5 f0c87775
......@@ -187,6 +187,20 @@ for retry in "none" "--std=c++11" "--std=c++0x" "--std=c++1x" "fail"; do
[AC_MSG_RESULT([no])
continue])
AC_MSG_CHECKING(variadic template support)
feature="variadic template"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[template<typename ... Args>
struct A {
void foo(Args... myargs) { return; };
};],
[A<> a;
a.foo();])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
continue])
AC_MSG_CHECKING(lambda support)
feature="lambda"
AC_COMPILE_IFELSE(
......
......@@ -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
......
// Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef CFG_TO_ELEMENT_H
#define CFG_TO_ELEMENT_H
#include <exceptions/exceptions.h>
#include <cc/data.h>
namespace isc {
/// @brief Cannot unparse error
///
/// This exception is expected to be thrown when toElement fails
/// and to skip flawed elements is not wanted.
class ToElementError : public isc::Exception {
public:
ToElementError(const char* file, size_t line, const char* what) :
isc::Exception(file, line, what) { };
};
namespace data {
/// @brief Abstract class for configuration Cfg_* classes
///
struct CfgToElement {
/// Destructor
virtual ~CfgToElement() { }
/// @brief Unparse a configuration objet
///
/// Returns an element which must parse into the same objet, i.e.
/// @code
/// for all valid config C parse(parse(C)->toElement()) == parse(C)
/// @endcode
///
/// @return a pointer to a configuration which can be parsed into
/// the initial configuration object
virtual isc::data::ElementPtr toElement() const = 0;
};
}; // namespace isc::dhcp
}; // namespace isc
#endif // CFG_TO_ELEMENT_H
// Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
......@@ -79,6 +79,15 @@ configuration. For example: the value of 1 identifies an immediate
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::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(parse(C)->toElement()) == parse(C)
@endcode
@section hostmgr Host Manager
Host Manager implemented by the \ref isc::dhcp::HostMgr is a singleton object
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment