Kea  1.9.9-git
server_collection.cc
Go to the documentation of this file.
1 // Copyright (C) 2019-2020 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 
11 using namespace isc::data;
12 
13 namespace isc {
14 namespace db {
15 
17 ServerFetcher::get(const ServerCollection& collection,
18  const ServerTag& server_tag) {
19  auto& index = collection.get<ServerTagIndexTag>();
20  auto s = index.find(server_tag.get());
21  if (s != index.end()) {
22  return (*s);
23  }
24  return (ServerPtr());
25 }
26 
27 } // end of namespace isc::db
28 } // end of namespace isc
std::string get() const
Returns server tag as string.
Definition: server_tag.h:51
boost::shared_ptr< Server > ServerPtr
Shared pointer to the Server class.
Definition: server.h:19
boost::multi_index_container< ServerPtr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::tag< ServerTagIndexTag >, boost::multi_index::const_mem_fun< Server, std::string,&Server::getServerTagAsText > > >> ServerCollection
Multi index container for Server.
Represents a server tag.
Definition: server_tag.h:25
Defines the logger used by the top-level component of kea-dhcp-ddns.
Tag identifying an index by server tag.