Saga
Saga Game Engine
Loading...
Searching...
No Matches
Saga::TypeMap< DataType > Class Template Reference

Map that has Types as key. More...

#include <typemap.h>

Public Types

typedef Map::iterator iterator
 
typedef Map::const_iterator const_iterator
 
typedef Map::value_type value_type
 

Public Member Functions

const_iterator begin () const
 Return a const iterator to the beginning of this typemap.
 
const_iterator end () const
 Return a const iterator to the end of this typemap.
 
iterator begin ()
 Return an iterator to the beginning of this typemap.
 
iterator end ()
 Return an iterator to the end of this typemap.
 
template<class KeyType >
iterator find ()
 Find a type inside this map.
 
template<class KeyType >
const_iterator find () const
 Find a type inside this map.
 
template<class KeyType >
bool hasKey ()
 Determine if the map already maps a type to some value.
 
template<class KeyType >
void put (DataType &&data)
 Place an item inside the map. If the map already contains this KeyType as a key, then replace the mapping to data. Otherwise, create a mapping between KeyType and data.
 
template<class KeyType >
int getTypeId ()
 Generate a unique ID for a type. Any call to this with the same type will return the same value.
 
int size ()
 Determine the number of mappings this map has.
 

Detailed Description

template<class DataType>
class Saga::TypeMap< DataType >

Map that has Types as key.

Template Parameters
DataTypethe type of the value of the map.

Member Typedef Documentation

◆ const_iterator

template<class DataType >
typedef Map::const_iterator Saga::TypeMap< DataType >::const_iterator

◆ iterator

template<class DataType >
typedef Map::iterator Saga::TypeMap< DataType >::iterator

◆ value_type

template<class DataType >
typedef Map::value_type Saga::TypeMap< DataType >::value_type

Member Function Documentation

◆ begin() [1/2]

template<class DataType >
iterator Saga::TypeMap< DataType >::begin ( )
inline

Return an iterator to the beginning of this typemap.

Returns
iterator an iterator pointing to the beginning of the typemap.

◆ begin() [2/2]

template<class DataType >
const_iterator Saga::TypeMap< DataType >::begin ( ) const
inline

Return a const iterator to the beginning of this typemap.

Returns
const_iterator a const iterator pointing to the beginning of the typemap.

◆ end() [1/2]

template<class DataType >
iterator Saga::TypeMap< DataType >::end ( )
inline

Return an iterator to the end of this typemap.

Returns
iterator an iterator pointing to the end of the typemap.

◆ end() [2/2]

template<class DataType >
const_iterator Saga::TypeMap< DataType >::end ( ) const
inline

Return a const iterator to the end of this typemap.

Returns
const_iterator a const iterator pointing to the end of the typemap.

◆ find() [1/2]

template<class DataType >
template<class KeyType >
iterator Saga::TypeMap< DataType >::find ( )
inline

Find a type inside this map.

Template Parameters
KeyTypethe type to find.
Returns
an iterator pointing to the key-value pair in the map with key = keyType, or the end iterator otherwise.

◆ find() [2/2]

template<class DataType >
template<class KeyType >
const_iterator Saga::TypeMap< DataType >::find ( ) const
inline

Find a type inside this map.

Template Parameters
KeyTypethe type to find.
Returns
a const iterator pointing to the key-value pair in the map with key = keyType, or the end iterator otherwise.

◆ getTypeId()

template<class DataType >
template<class KeyType >
int Saga::TypeMap< DataType >::getTypeId ( )
inline

Generate a unique ID for a type. Any call to this with the same type will return the same value.

Template Parameters
KeyTypethe type.

◆ hasKey()

template<class DataType >
template<class KeyType >
bool Saga::TypeMap< DataType >::hasKey ( )
inline

Determine if the map already maps a type to some value.

Template Parameters
KeyTypethe type to search for.
Returns
true if the type is inside the map.
false otherwise.
Here is the call graph for this function:

◆ put()

template<class DataType >
template<class KeyType >
void Saga::TypeMap< DataType >::put ( DataType &&  data)
inline

Place an item inside the map. If the map already contains this KeyType as a key, then replace the mapping to data. Otherwise, create a mapping between KeyType and data.

Template Parameters
KeyTypethe key used in the mapping.
Parameters
datathat we map KeyType to.

◆ size()

template<class DataType >
int Saga::TypeMap< DataType >::size ( )
inline

Determine the number of mappings this map has.

Returns
int the number of mappings the map has.

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