![]() |
http://www.sim.no http://www.coin3d.org |
#include <Inventor/SbDict.h>
It uses hashing to quickly insert and find entries in the dictionary. An entry consists of an unique key and a generic pointer.
Public Member Functions | |
SbDict (const int entries=251) | |
SbDict (const SbDict &from) | |
~SbDict () | |
SbDict & | operator= (const SbDict &from) |
void | applyToAll (void(*rtn)(unsigned long key, void *value)) const |
void | applyToAll (void(*rtn)(unsigned long key, void *value, void *data), void *data) const |
void | clear (void) |
SbBool | enter (const unsigned long key, void *const value) |
SbBool | find (const unsigned long key, void *&value) const |
void | makePList (SbPList &keys, SbPList &values) |
SbBool | remove (const unsigned long key) |
void | setHashingFunction (unsigned long(*func)(const unsigned long key)) |
|
Constructor with entries specifying the initial number of buckets in the hash list -- so it need to be larger than 0. Other than this, no special care needs to be taken in choosing the value since it is always rounded up to the nearest power of two. |
|
Copy constructor. |
|
Destructor. |
|
Make a shallow copy of the contents of dictionary from into this dictionary. |
|
Applies rtn to all entries in the dictionary. |
|
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. |
|
Clear all entries in the dictionary. |
|
Inserts a new entry into the dictionary. key should be a unique number, and value is the generic user data.
If key does not exist in the dictionary, a new entry is created and |
|
Searches for key in the dictionary. If an entry with this key exists, |
|
Creates lists with all entries in the dictionary. |
|
Removes the entry with key key. |
|
Sets a new hashing function for this dictionary. Default hashing function just returns the key. If you find that items entered into the dictionary seems to make clusters in only a few buckets, you should try setting a hashing function. If you're for instance using strings, you could use the static SbString::hash() function (you'd need to make a static function that will cast from unsigned long to char * of course). This function is not part of the OIV API. |
Copyright © 1998-2005 by Systems in Motion AS. All rights reserved.
Generated on Wed May 3 11:18:21 2006 for Coin by Doxygen. 1.4.6