7#ifndef HA_RELATIONSHIP_MAPPER_H
8#define HA_RELATIONSHIP_MAPPER_H
13#include <boost/shared_ptr.hpp>
14#include <unordered_map>
32template<
typename MappedType>
44 if (mapping_.count(key) > 0) {
50 for (
auto const& o : vector_) {
57 vector_.push_back(obj);
66 auto obj = mapping_.find(key);
67 if (obj == mapping_.end()) {
78 if (vector_.empty()) {
87 const std::vector<MappedTypePtr>&
getAll()
const {
96 return (vector_.size() > 1);
102 std::unordered_map<std::string, MappedTypePtr> mapping_;
105 std::vector<MappedTypePtr> vector_;
A generic exception that is thrown if a function is called in a prohibited way.
Holds associations between objects and HA relationships.
boost::shared_ptr< MappedType > MappedTypePtr
A pointer to the held object type.
void map(const std::string &key, MappedTypePtr obj)
Associates a key with the object.
const std::vector< MappedTypePtr > & getAll() const
Returns all mapped objects.
MappedTypePtr get(const std::string &key) const
Retrieves mapped object by a key (e.g., partner name).
bool hasMultiple() const
Checks if the mapper has multiple objects.
MappedTypePtr get() const
Returns the default mapped object.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Defines the logger used by the top-level component of kea-lfc.