API Guides > ConceptRT 3.x
Dictionary< KeyType, ValueType, Size > Class Template Reference

Dictionary of association between key and value. More...

Detailed Description

template<class KeyType, class ValueType, Int32 Size>
class ConceptRT::Dictionary< KeyType, ValueType, Size >

Dictionary of association between key and value.

Template Parameters
KeyTypeKeys items type. Items must be instanciable whitout parameters. (scalar type or class with constructor without parameters or with default values.)
ValueTypeValues item type. Items must be instanciable whitout parameters. (scalar type or class with constructor without parameters or with default values.)
SizeDictionary size (maximum associations count).

Public Member Methods

Int32 GetCount () const
 Gets the number of associations contained in the dictionary. More...
 
bool IsEmpty () const
 Query if the dictionary is empty. More...
 
bool IsFull () const
 Query if the dictionary is full. More...
 
bool Lookup (const KeyType &key, ValueType &value) const
 Looks up a given key to find its associated value. More...
 
ValueType & operator[] (const KeyType &key)
 Array indexer operator. More...
 
void SetAt (const KeyType &key, const ValueType &newValue)
 Sets at. More...
 
bool RemoveKey (const KeyType &key)
 Removes the key described by key. More...
 
void RemoveAll ()
 Removes all. More...
 
void GetAssociation (Int32 index, KeyType &key, ValueType &value) const
 Gets an association. More...
 
Int32 FindKey (const KeyType &key) const
 Searches for a key. More...
 

Methods Documentation

Int32 FindKey ( const KeyType &  key) const

Searches for a key.

Parameters
keyThe key.
Returns
The index of found key.
void GetAssociation ( Int32  index,
KeyType &  key,
ValueType &  value 
) const

Gets an association.

Parameters
indexZero-based index of the.
key[in,out] The key.
value[in,out] The value.
Int32 GetCount ( ) const

Gets the number of associations contained in the dictionary.

Returns
The number of associations.
bool IsEmpty ( ) const

Query if the dictionary is empty.

Returns
true if it empty.
bool IsFull ( ) const

Query if the dictionary is full.

Returns
true if it full.
bool Lookup ( const KeyType &  key,
ValueType &  value 
) const

Looks up a given key to find its associated value.

Parameters
keyThe key.
value[in,out] The value.
Returns
true if key found, false if not.
ValueType & operator[] ( const KeyType &  key)

Array indexer operator.

Parameters
keyThe key.
Returns
The indexed value.
void RemoveAll ( )

Removes all.

bool RemoveKey ( const KeyType &  key)

Removes the key described by key.

Parameters
keyThe key.
Returns
true if it succeeds, false if kex not found.
void SetAt ( const KeyType &  key,
const ValueType &  newValue 
)

Sets at.

Parameters
keyThe key.
newValueThe new value.