OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ot::ObjectManagerTemplate< K, V > Class Template Reference

#include "ObjectManagerTemplate.h"

Public Member Functions

virtual ~ObjectManagerTemplate ()
 
bool insert (const K &_key, V *_object)
 Store the provided object for the given key. If there exists an entry for the given key the function will terminate.
 
void replace (const K &_key, V *_object)
 Store the provided object for the given key. If there exists an entry for the given key the entry will be replaced.
 
bool contains (const K &_key)
 Returns true if an entry exits for the given key.
 
V *const find (const K &_key)
 Return stored pointer to object for the given key. Note that the Object Manager keeps the ownership.
 
V * grab (const K &_key)
 Return stored pointer to object for the given key and remove from object manager. Note that the caller takes ownership.
 
V *const operator[] (const K &_key)
 Return stored pointer to object for the given key. Note that the Object Manager keeps the ownership.
 

Detailed Description

template<class K, class V>
class ot::ObjectManagerTemplate< K, V >
Parameters
KKey type
VValue/Object type

Constructor & Destructor Documentation

◆ ~ObjectManagerTemplate()

template<class K , class V >
virtual ot::ObjectManagerTemplate< K, V >::~ObjectManagerTemplate ( )
inlinevirtual

Member Function Documentation

◆ contains()

template<class K , class V >
bool ot::ObjectManagerTemplate< K, V >::contains ( const K & _key)
inline

Returns true if an entry exits for the given key.

Parameters
_keyThe key to check.

◆ find()

template<class K , class V >
V *const ot::ObjectManagerTemplate< K, V >::find ( const K & _key)

Return stored pointer to object for the given key. Note that the Object Manager keeps the ownership.

Parameters
_keyThe key to the object.
Returns
nullptr if no entry found for the specified key.

◆ grab()

template<class K , class V >
V * ot::ObjectManagerTemplate< K, V >::grab ( const K & _key)

Return stored pointer to object for the given key and remove from object manager. Note that the caller takes ownership.

Parameters
_keyThe key to the object.
Returns
nullptr if no entry found for the specified key.

◆ insert()

template<class K , class V >
bool ot::ObjectManagerTemplate< K, V >::insert ( const K & _key,
V * _object )

Store the provided object for the given key. If there exists an entry for the given key the function will terminate.

Parameters
_objectPointer to object to store (Object Manager takes ownership).
Returns
Returns false if there is an entry for the given key (Object not inserterd).

◆ operator[]()

template<class K , class V >
V *const ot::ObjectManagerTemplate< K, V >::operator[] ( const K & _key)

Return stored pointer to object for the given key. Note that the Object Manager keeps the ownership.

Parameters
_keyThe key to the object.
Returns
nullptr if no entry found for the specified key.

◆ replace()

template<class K , class V >
void ot::ObjectManagerTemplate< K, V >::replace ( const K & _key,
V * _object )

Store the provided object for the given key. If there exists an entry for the given key the entry will be replaced.

Parameters
_objectPointer to object to store (Object Manager takes ownership).

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