TBTreeDictionary< K, O > Class Template Reference
[Template Containers]

B-Tree dictionary template definition. More...

#include <tbtreedictionary.h>

Inheritance diagram for TBTreeDictionary< K, O >:
Inheritance graph
[legend]

Public Member Functions

 TBTreeDictionary (int32 order=3)
 Default constructor.
 TBTreeDictionary (const TBTreeDictionary< K, O > &dict)
 Copy constructor.
 ~TBTreeDictionary ()
 Destructor.
TBTreeDictionary< K, O > & operator= (const TBTreeDictionary< K, O > &dict)
 Assignment operator.
bool addKey (const K &key)
 Add an association with a key and a default object.
bool addKeyAndObject (const K &key, const O &object)
 Add an association with a key and an object.
bool addAssoc (const TAssociation< K, O > &assoc)
 Add the passed association.
bool replace (const K &key, const O &object)
 Replace the object associated with key with the passed object.
bool removeKey (const K &key)
 Remove the association with the key.
const K & lookupKey (const K &key) const
 Returns an equal key contained in the dictionary.
const O & lookupObject (const K &key) const
 Returns the object associated with key.
bool containsKey (const K &key) const
 Returns if the key is contained in the dictionary.
const TAssociation< K, O > & lookupAssoc (const K &key) const
 Lookup an association, that has the passed key.

Detailed Description

template<class K, class O>
class Steinberg::TBTreeDictionary< K, O >

B-Tree dictionary template definition.

TBTreeDictionary is a template class for managing (key, object) pairs in a TBTree. The (key, object) pairs are stored as TAssociation objects. Every key can only be used once in the dictionary. For more information about TBTree (which should not be confused with a "binary tree", which is in tbinarytree.h) see the tbtree.h header.


Constructor & Destructor Documentation

TBTreeDictionary ( int32  order = 3  )  [inline]

Default constructor.

"TBTreeDictionary" is the default dictionary constructor.

Parameters:
order the order of the B-Tree is the maximum number of children for each node. Order has to be >= 3.
TBTreeDictionary ( const TBTreeDictionary< K, O > &  dict  )  [inline]

Copy constructor.

~TBTreeDictionary (  )  [inline]

Destructor.


Member Function Documentation

TBTreeDictionary< K, O > & operator= ( const TBTreeDictionary< K, O > &  dict  )  [inline]

Assignment operator.

Assignment operator "=" copies the specified dictionary into this dictionary.

bool addKey ( const K &  key  )  [inline]

Add an association with a key and a default object.

"addKey" adds an association with the specified key to the dictionary. If the key is already contained in the dictionary nothing is added.

Returns:
was an association added?
bool addKeyAndObject ( const K &  key,
const O &  obj 
) [inline]

Add an association with a key and an object.

"addKeyAndObject" adds an association with the specified key and the specified object to the dictionary. If the key is already contained in the dictionary nothing is added.

Returns:
was an association added?
bool addAssoc ( const TAssociation< K, O > &  assoc  )  [inline]

Add the passed association.

"addAssoc" adds the specified association to the dictionary. If the key of the association is already contained in the dictionary nothing is added.

Returns:
was the association added?
bool replace ( const K &  key,
const O &  obj 
) [inline]

Replace the object associated with key with the passed object.

"replace" finds the first occurrence of an association containing the specified key and replaces the object value. If the key is not contained in the dictionary nothing is done.

Returns:
was the object value of key replaced?
bool removeKey ( const K &  key  )  [inline]

Remove the association with the key.

"removeKey" removes the first association containing the specified key from the dictionary.

Returns:
was an association removed?
const K & lookupKey ( const K &  key  )  const [inline]

Returns an equal key contained in the dictionary.

Returns:
a copy of the key out of the first occurrence of an association containing the specified key. If no association with the key is found returns the key of the default error object (see error() in TContainer).
const O & lookupObject ( const K &  key  )  const [inline]

Returns the object associated with key.

Returns:
a copy of the object out of the first occurrence of an association containing the specified key. If no association with the key is found returns the object-part of the default error object (see error() in TContainer).
bool containsKey ( const K &  key  )  const [inline]

Returns if the key is contained in the dictionary.

Returns:
does the dictionary contain an association with the specified key?
const TAssociation< K, O > & lookupAssoc ( const K &  key  )  const [inline]

Lookup an association, that has the passed key.

Returns:
a copy of the first occurrence of an association containing the specified key. If no association with the key is found returns the default error object (see error() in TContainer).
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Empty

Copyright ©2013 Steinberg Media Technologies GmbH. All Rights Reserved.