Kea 2.7.5
stamped_element.cc
Go to the documentation of this file.
1// Copyright (C) 2018-2024 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#include <config.h>
8
10
11namespace isc {
12namespace data {
13
17
18bool
19StampedElement::hasServerTag(const ServerTag& server_tag) const {
20 return (server_tags_.count(server_tag) > 0);
21}
22
23void
24StampedElement::delServerTag(const std::string& server_tag) {
25 if (!server_tags_.erase(ServerTag(server_tag))) {
26 isc_throw(NotFound, "can't find server tag '" << server_tag << "' to delete");
27 }
28}
29
30bool
34
35
38 ElementPtr metadata = Element::createMap();
40
41 for (auto const& server_tag : server_tags_) {
42 tags->add(Element::create(server_tag.get()));
43 }
44
45 metadata->set("server-tags", tags);
46 return (metadata);
47}
48
49} // end of namespace isc::data
50} // end of namespace isc
A generic exception that is thrown when an object can not be found.
This class represents configuration element which is associated with database identifier and the modi...
static ElementPtr create(const Position &pos=ZERO_POSITION())
Definition data.cc:249
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
Definition data.cc:304
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Definition data.cc:299
Represents a server tag.
Definition server_tag.h:25
static std::string ALL
Server tag for all servers as text.
Definition server_tag.h:29
void delServerTag(const std::string &server_tag)
Deletes server tag.
isc::data::ElementPtr getMetadata() const
Returns an object representing metadata to be returned with objects from the configuration backend.
bool hasAllServerTag() const
Checks if the element has 'all' server tag.
bool hasServerTag(const ServerTag &server_tag) const
Checks if the element has the given server tag.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
Defines the logger used by the top-level component of kea-lfc.