Base Module  VST 3.6.5
SDK for developing VST Plug-in
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions
TBTreeDictionary< K, O > Class Template Reference

B-Tree dictionary template definition. More...

#include <tbtreedictionary.h>

+ Inheritance diagram for TBTreeDictionary< K, O >:

Public Member Functions

 TBTreeDictionary (int32 order=3)
 Default constructor. More...
 
 TBTreeDictionary (const TBTreeDictionary< K, O > &dict)
 Copy constructor. More...
 
 ~TBTreeDictionary ()
 Destructor. More...
 
TBTreeDictionary< K, O > & operator= (const TBTreeDictionary< K, O > &dict)
 Assignment operator. More...
 
bool addKey (const K &key)
 Add an association with a key and a default object. More...
 
bool addKeyAndObject (const K &key, const O &object)
 Add an association with a key and an object. More...
 
bool addAssoc (const TAssociation< K, O > &assoc)
 Add the passed association. More...
 
bool replace (const K &key, const O &object)
 Replace the object associated with key with the passed object. More...
 
bool removeKey (const K &key)
 Remove the association with the key. More...
 
const K & lookupKey (const K &key) const
 Returns an equal key contained in the dictionary. More...
 
const O & lookupObject (const K &key) const
 Returns the object associated with key. More...
 
bool containsKey (const K &key) const
 Returns if the key is contained in the dictionary. More...
 
const TAssociation< K, O > & lookupAssoc (const K &key) const
 Lookup an association, that has the passed key. More...
 
- Public Member Functions inherited from TBTree< TAssociation< K, O > >
 TBTree (int32=3)
 Default tree constructor. More...
 
 TBTree (const TBTree< TAssociation< K, O > > &)
 Tree copy constructor. More...
 
 TBTree (const TContainer< TAssociation< K, O > > &)
 Construct from container. More...
 
 ~TBTree ()
 Tree destructor. More...
 
TContainer< TAssociation< K, O > > * newInstance () const
 
TBTree< TAssociation< K, O > > & operator= (const TBTree< TAssociation< K, O > > &)
 Assignment operator. More...
 
int32 order () const
 Return tree order. More...
 
int32 height () const
 Return tree height. More...
 
virtual bool add (const TAssociation< K, O > &)
 Add item to tree. More...
 
virtual bool remove (const TAssociation< K, O > &)
 Remove item from tree. More...
 
virtual bool remove (const TIterator< TAssociation< K, O > > &)
 Remove iterator item. More...
 
virtual bool removeAt (int32)
 Remove at index. More...
 
virtual void removeAll ()
 Remove all items. More...
 
virtual TAssociation< K, O > & lookup (const TAssociation< K, O > &) const
 Find equal item in tree. More...
 
bool lookup (const TAssociation< K, O > &, TBTreeIterator< TAssociation< K, O > > &)
 
bool lookupLowerEqual (const TAssociation< K, O > &, TBTreeIterator< TAssociation< K, O > > &)
 
virtual bool contains (const TAssociation< K, O > &) const
 See if tree contains equal. More...
 
virtual int32 occurrences (const TAssociation< K, O > &) const
 Count occurrences of equal. More...
 
TIterator< TAssociation< K, O > > * lookupIterator (const TAssociation< K, O > &) const
 
TIterator< TAssociation< K, O > > * newIterator () const
 Create tree iterator. More...
 
- Public Member Functions inherited from TContainer< TAssociation< K, O > >
 TContainer ()
 
 TContainer (const TContainer< TAssociation< K, O > > &)
 
virtual ~TContainer ()
 
bool operator== (const TContainer< TAssociation< K, O > > &) const
 
bool operator!= (const TContainer< TAssociation< K, O > > &) const
 
TAssociation< K, O > & operator[] (int32) const
 "[]" indexing operator returns the item at the specified index. More...
 
virtual int32 total () const
 Return number of items. More...
 
virtual bool isEmpty () const
 Is container empty? More...
 
virtual int32 size () const
 Returns the container size. More...
 
virtual TAssociation< K, O > & at (int32 index) const
 Get item at index. More...
 
TContainer< TAssociation< K, O > > * lookupAll (const TAssociation< K, O > &item) const
 Allocate and returns a container with all items in this container equal to the specified item. More...
 
bool addAllFrom (const TContainer< TAssociation< K, O > > &container)
 Adds all the items from the specified container to this container. More...
 
bool addNewFrom (const TContainer< TAssociation< K, O > > &container)
 Adds the items from the specified container to this container that are not in this container already. More...
 
TAssociation< K, O > & error () const
 Access error object. More...
 

Additional Inherited Members

- Protected Member Functions inherited from TContainer< TAssociation< K, O > >
void copy (const TContainer< TAssociation< K, O > > &container)
 Internal copy method. Copies the contents of the specified container into this container. More...
 
- Protected Attributes inherited from TContainer< TAssociation< K, O > >
TAssociation< K, O > errorObject
 Object used as return value when methods returning a T& fail. More...
 
int32 _size
 Container size. More...
 

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)

Default constructor.

"TBTreeDictionary" is the default dictionary constructor.

Parameters
orderthe 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)

Copy constructor.

~TBTreeDictionary ( )
inline

Destructor.

Member Function Documentation

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

Assignment operator.

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

bool addKey ( const K &  key)

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 
)

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)

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 
)

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)

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

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

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

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

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).
Empty

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