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 Types | Public Member Functions
THashDictionary< TKey, TObject > Class Template Reference

Hash dictionary template definition. More...

#include <tdictionary.h>

+ Inheritance diagram for THashDictionary< TKey, TObject >:

Public Types

typedef uint32(* THashFunc )(const TAssociation< TKey, TObject > &, uint32)
 Hash function type. More...
 
- Public Types inherited from THashTable< TAssociation< TKey, TObject > >
typedef uint32(* THashFunc )(const TAssociation< TKey, TObject > &, uint32)
 Hash function type. More...
 

Public Member Functions

 THashDictionary (THashFunc hashFunc, int32=10)
 Default constructor. More...
 
 THashDictionary (const THashDictionary< TKey, TObject > &)
 Copy constructor. More...
 
 ~THashDictionary ()
 Destructor. More...
 
THashDictionary< TKey, TObject > & operator= (const THashDictionary< TKey, TObject > &)
 Assignment operator. More...
 
bool addKey (const TKey &)
 Add key. More...
 
bool addKeyAndObject (const TKey &, const TObject &)
 Add key/object. More...
 
bool addAssoc (const TAssociation< TKey, TObject > &)
 Add association. More...
 
bool replace (const TKey &, const TObject &)
 Replace object at key. More...
 
bool removeKey (const TKey &)
 Remove association at key. More...
 
const TKey & lookupKey (const TKey &) const
 Return equal key. More...
 
const TObject & lookupObject (const TKey &) const
 Return object by key. More...
 
bool containsKey (const TKey &) const
 Test if key is in dictionary. More...
 
int32 occurrencesOfKey (const TKey &) const
 How many equal keys. More...
 
const TAssociation< TKey,
TObject > & 
lookupAssoc (const TKey &) const
 Lookup association at key. More...
 
- Public Member Functions inherited from THashTable< TAssociation< TKey, TObject > >
 THashTable (THashFunc, int32=10)
 Constructor with hash function. More...
 
 THashTable (const THashTable< TAssociation< TKey, TObject > > &)
 Copy constructor. More...
 
 THashTable (THashFunc, const TContainer< TAssociation< TKey, TObject > > &)
 Constructor with container. More...
 
 ~THashTable ()
 Destructor. More...
 
THashTable< TAssociation< TKey,
TObject > > & 
operator= (const THashTable< TAssociation< TKey, TObject > > &)
 Assignment operator, uses copy. More...
 
void setHashFunction (THashFunc)
 Set hash function. More...
 
bool resize (int32)
 Resize the table, set number of hash buckets. More...
 
virtual TContainer
< TAssociation< TKey, TObject > > * 
newInstance () const
 
virtual int32 total () const
 
virtual bool isEmpty () const
 
virtual bool add (const TAssociation< TKey, TObject > &item)
 
virtual bool remove (const TAssociation< TKey, TObject > &item)
 
virtual bool remove (const TIterator< TAssociation< TKey, TObject > > &iter)
 
virtual bool removeAt (int32 index)
 
virtual void removeAll ()
 
virtual TAssociation< TKey,
TObject > & 
lookup (const TAssociation< TKey, TObject > &item) const
 
virtual bool contains (const TAssociation< TKey, TObject > &item) const
 
virtual int32 occurrences (const TAssociation< TKey, TObject > &item) const
 
virtual TIterator
< TAssociation< TKey, TObject > > * 
newIterator () const
 
- Public Member Functions inherited from TContainer< TAssociation< TKey, TObject > >
 TContainer ()
 
 TContainer (const TContainer< TAssociation< TKey, TObject > > &)
 
virtual ~TContainer ()
 
bool operator== (const TContainer< TAssociation< TKey, TObject > > &) const
 
bool operator!= (const TContainer< TAssociation< TKey, TObject > > &) const
 
TAssociation< TKey, TObject > & operator[] (int32) const
 "[]" indexing operator returns the item at the specified index. More...
 
virtual int32 size () const
 Returns the container size. More...
 
virtual TAssociation< TKey,
TObject > & 
at (int32 index) const
 Get item at index. More...
 
TContainer< TAssociation< TKey,
TObject > > * 
lookupAll (const TAssociation< TKey, TObject > &item) const
 Allocate and returns a container with all items in this container equal to the specified item. More...
 
bool addAllFrom (const TContainer< TAssociation< TKey, TObject > > &container)
 Adds all the items from the specified container to this container. More...
 
bool addNewFrom (const TContainer< TAssociation< TKey, TObject > > &container)
 Adds the items from the specified container to this container that are not in this container already. More...
 
TAssociation< TKey, TObject > & error () const
 Access error object. More...
 

Additional Inherited Members

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

Detailed Description

template<class TKey, class TObject>
class Steinberg::THashDictionary< TKey, TObject >

Hash dictionary template definition.

A dictionary is a container that holds value pairs, a key and its associated value object.

The difference to the normal TDictionary template is, that THashDictionary gets implemented as a hash table. The interface and usage of both is same.

To understand the benefits and implications of hashes see e.g.: http://en.wikipedia.org/wiki/Hash_table

Member Typedef Documentation

typedef uint32(* THashFunc)(const TAssociation< TKey, TObject > &, uint32)

Hash function type.

Constructor & Destructor Documentation

THashDictionary ( THashFunc  hashFunc,
int32  size = 10 
)

Default constructor.

THashDictionary ( const THashDictionary< TKey, TObject > &  dict)

Copy constructor.

Creates a new dictionary and assigns it with a copy of the specified dictionary.

~THashDictionary ( )
inline

Destructor.

Member Function Documentation

THashDictionary< TKey, TObject > & operator= ( const THashDictionary< TKey, TObject > &  dict)

Assignment operator.

Copies the dictionary specified on the right side of the operator into the dictionary on the left side.

bool addKey ( const TKey &  rKey)

Add key.

A new association between the specified key and a default constructed object value gets added.

bool addKeyAndObject ( const TKey &  rKey,
const TObject &  rObj 
)

Add key/object.

Adds a new association of specified key and object to the dictionary.

bool addAssoc ( const TAssociation< TKey, TObject > &  rAssoc)

Add association.

Adds the specified association to the dictionary.

bool replace ( const TKey &  rKey,
const TObject &  rObj 
)

Replace object at key.

Finds the first occurrence of an association containing the specified key and replaces its value by the specified object value.

bool removeKey ( const TKey &  rKey)

Remove association at key.

Finds the first association at the specified key and removes it if found.

const TKey & lookupKey ( const TKey &  rKey) const

Return equal key.

Returns the key of the first occurrence of an association containing the specified key.

const TObject & lookupObject ( const TKey &  rKey) const

Return object by key.

Returns a copy of the object of the first occurrence of an association containing the specified key.

bool containsKey ( const TKey &  rKey) const

Test if key is in dictionary.

Returns true if the dictionary contains an association with the specified key.

int32 occurrencesOfKey ( const TKey &  rKey) const

How many equal keys.

Returns the number of associations containing the specified key.

const TAssociation< TKey, TObject > & lookupAssoc ( const TKey &  rKey) const

Lookup association at key.

Returns a copy of the first occurrence of an association containing the specified key.

Empty

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