Kea  1.9.9-git
adaptor.h
Go to the documentation of this file.
1 // Copyright (C) 2018 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 ISC_ADAPTOR_H
8 #define ISC_ADAPTOR_H 1
9 
10 #include <exceptions/exceptions.h>
11 #include <cc/data.h>
12 
13 namespace isc {
14 namespace yang {
15 
17 class MissingKey : public isc::Exception {
18 public:
19  MissingKey(const char* file, size_t line, const char* what) :
20  isc::Exception(file, line, what)
21  {}
22 };
23 
30 class Adaptor {
31 public:
32 
34  Adaptor();
35 
37  virtual ~Adaptor();
38 
52 
62  static void fromParent(const std::string& name,
65 
75  static void toParent(const std::string& name,
76  isc::data::ElementPtr parent,
78 
124  static void modify(isc::data::ConstElementPtr path,
126  isc::data::ElementPtr config);
127 
128 };
129 
130 }; // end of namespace isc::yang
131 }; // end of namespace isc
132 
133 #endif // ISC_ADAPTOR_H
JSON adaptor between canonical Kea and YANG models.
Definition: adaptor.h:30
MissingKey(const char *file, size_t line, const char *what)
Definition: adaptor.h:19
boost::shared_ptr< Element > ElementPtr
Definition: data.h:20
Missing key error.
Definition: adaptor.h:17
virtual ~Adaptor()
Destructor.
Definition: adaptor.cc:23
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:23
static isc::data::ConstElementPtr getContext(isc::data::ConstElementPtr parent)
Get user context.
Definition: adaptor.cc:27
static void toParent(const std::string &name, isc::data::ElementPtr parent, isc::data::ConstElementPtr list)
Moves a parameter to a parent.
Definition: adaptor.cc:61
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
This is a base class for exceptions thrown from the DNS library module.
Defines the logger used by the top-level component of kea-dhcp-ddns.
static void modify(isc::data::ConstElementPtr path, isc::data::ConstElementPtr actions, isc::data::ElementPtr config)
Modify a configuration in its JSON element format.
Definition: adaptor.cc:302
static void fromParent(const std::string &name, isc::data::ConstElementPtr parent, isc::data::ConstElementPtr list)
Moves a parameter from parent to a list of children.
Definition: adaptor.cc:45
Adaptor()
Constructor.
Definition: adaptor.cc:20