Kea 2.7.6
isc::ha::HARelationshipMapper< MappedType > Class Template Reference

Holds associations between objects and HA relationships. More...

#include <ha_relationship_mapper.h>

Public Types

typedef boost::shared_ptr< MappedType > MappedTypePtr
 A pointer to the held object type.
 

Public Member Functions

MappedTypePtr get () const
 Returns the default mapped object.
 
MappedTypePtr get (const std::string &key) const
 Retrieves mapped object by a key (e.g., partner name).
 
const std::vector< MappedTypePtr > & getAll () const
 Returns all mapped objects.
 
bool hasMultiple () const
 Checks if the mapper has multiple objects.
 
void map (const std::string &key, MappedTypePtr obj)
 Associates a key with the object.
 

Detailed Description

template<typename MappedType>
class isc::ha::HARelationshipMapper< MappedType >

Holds associations between objects and HA relationships.

There are at least two classes that require associations with the HA relationships: HAService and HAConfig. The HAImpl class may hold one or more instances of these classes. The library must be able to select appropriate instances depending on the partner name. This class associates partners with the relationships. Each partner may be associated with only one relationship. One relationship may be associated with many partners (e.g., primary and standby).

Template Parameters
MappedTypetype of a mapped object (i.e., HAService or HAConfig).

Definition at line 33 of file ha_relationship_mapper.h.

Member Typedef Documentation

◆ MappedTypePtr

template<typename MappedType >
boost::shared_ptr<MappedType> isc::ha::HARelationshipMapper< MappedType >::MappedTypePtr

A pointer to the held object type.

Definition at line 37 of file ha_relationship_mapper.h.

Member Function Documentation

◆ get() [1/2]

template<typename MappedType >
MappedTypePtr isc::ha::HARelationshipMapper< MappedType >::get ( ) const
inline

Returns the default mapped object.

Returns
Mapped object.
Exceptions
InvalidOperationwhen there is no mapped object.

Definition at line 77 of file ha_relationship_mapper.h.

References isc_throw.

◆ get() [2/2]

template<typename MappedType >
MappedTypePtr isc::ha::HARelationshipMapper< MappedType >::get ( const std::string & key) const
inline

Retrieves mapped object by a key (e.g., partner name).

Parameters
keytypically a name of the partner belonging to a relationship.
Returns
Mapped object or null pointer if the object was not found.

Definition at line 65 of file ha_relationship_mapper.h.

◆ getAll()

template<typename MappedType >
const std::vector< MappedTypePtr > & isc::ha::HARelationshipMapper< MappedType >::getAll ( ) const
inline

Returns all mapped objects.

Returns
A reference to a vector of mapped objects.

Definition at line 87 of file ha_relationship_mapper.h.

◆ hasMultiple()

template<typename MappedType >
bool isc::ha::HARelationshipMapper< MappedType >::hasMultiple ( ) const
inline

Checks if the mapper has multiple objects.

Returns
true if the mapper includes multiple objects (e.g., HAService), false otherwise.

Definition at line 95 of file ha_relationship_mapper.h.

◆ map()

template<typename MappedType >
void isc::ha::HARelationshipMapper< MappedType >::map ( const std::string & key,
MappedTypePtr obj )
inline

Associates a key with the object.

Parameters
keytypically a name of a partner belonging to a relationship.
objmapped object.

Definition at line 43 of file ha_relationship_mapper.h.

References isc_throw.


The documentation for this class was generated from the following file: