ReplicaNet and RNLobby  1
Public Types | Public Member Functions | List of all members
RegistryManagerMap< I, T, C > Class Template Reference

#include <RegistryManagerMap.h>

Inheritance diagram for RegistryManagerMap< I, T, C >:
Inheritance graph
[legend]

Public Types

enum  Direction { kForward =0, kBackward, kUndefined }
 

Public Member Functions

 RegistryManagerMap ()
 
virtual ~RegistryManagerMap ()
 
bool AddItem (const I &index, const T *item)
 
T * FindItem (const I &index)
 
T * FindItemNoIterator (const I &index)
 
bool RemoveItem (const I &index)
 
void RemoveItem (void)
 
void BeginIterate (void)
 
void EndIterate (void)
 
T * Iterate (I *index=0)
 
bool IsEmpty (void)
 
bool IsEmpty (void) const
 
void Clear (void)
 

Detailed Description

template<class I, class T, class C = std::less<I>>
class RNReplicaNet::RegistryManagerMap< I, T, C >

RegistryManager is a template class for handling classes in organised maps

Constructor & Destructor Documentation

RegistryManagerMap ( )
inline

The ctor performs some basic initialisation

virtual ~RegistryManagerMap ( )
inlinevirtual

The dtor makes sure everything is tidy

Member Function Documentation

bool AddItem ( const I &  index,
const T *  item 
)
inline

Adds an item to the list. This does not allocate an item as this is left to the user to do

Parameters
itemthe item pointer to add
void BeginIterate ( void  )
inline

Starts the iteration of the items in the list from the start and works forwards

void Clear ( void  )
inline

Clears the associated map. Does not free the items.

void EndIterate ( void  )
inline

Starts the iteration of the items in the list from the end and works backwards

T* FindItem ( const I &  index)
inline

Finds an item using the index and if found also sets the current iterator to the item in the map. The direction of the iterator is set to be kUndefined.

Parameters
indexThe index to use.
Returns
The pointer to T corresponding to the index or null if the index was not found.
T* FindItemNoIterator ( const I &  index)
inline

Finds an item using the index. The current iterator is not set.

Parameters
indexThe index to use.
Returns
The pointer to T corresponding to the index or null if the index was not found.
bool IsEmpty ( void  )
inline

Returns true if the map is empty

T* Iterate ( I *  index = 0)
inline

Iterates through the items in the list

Parameters
indexAllows the value of the index to be read. The default is null indicating the index is not returned.
Returns
returns the next item pointer in the list or returns NULL for the end of the list
bool RemoveItem ( const I &  index)
inline

Removes an item from the list but does not free the item as this is left to the user to do

Parameters
itemthe item pointer to remove
Returns
True indicates the index was in the map. False indicates the index was not in the map.
void RemoveItem ( void  )
inline

Removes the item at the current iterator.