SbDict(3)
π SbDict β the whole vibe, bestie π
okay so real talk: this is the SbDict class, and she organizes a dictionary of keys and values. that's it. that's the girl. π
β¨ SYNOPSIS β¨
#include <Inventor/SbDict.h>
π Public Types π
typedef unsigned long Keyβ your key is just a big ol' unsigned number, slay
π«Ά Public Member Functions π«Ά
SbDict (const int entries=251)
SbDict (const SbDict &from)
~SbDict ()
SbDict & operator= (const SbDict &from)
void applyToAll (void(*rtn)(Key key, void *value)) const
void applyToAll (void(*rtn)(Key key, void *value, void *data), void *data) const
void clear (void)
SbBool enter (const Key key, void *const value)
SbBool find (const Key key, void *&value) const
void makePList (SbPList &keys, SbPList &values)
SbBool remove (const Key key)
void setHashingFunction (Key(*func)(const Key key))
πΈ Detailed Description πΈ
The SbDict class organizes a dictionary of keys and values. no cap, that's literally the whole job description. π
She uses hashing to quickly insert and find entries in the dictionary β fast girlie behavior fr fr. An entry is made of two things: a unique key and a generic pointer. that's the whole entry. iconic duo honestly. β¨
π¦ Constructor & Destructor Documentation π¦
π SbDict::SbDict (const int entries = 251)
Constructor where entries says how many buckets the hash list starts out with β so bestie, it needs to be larger than 0, ok?? besides that, don't stress about picking the "perfect" value, because it always gets rounded up to the nearest power of two anyway. so chill. π§
Referenced by operator=(), and SbDict().
π SbDict::SbDict (const SbDict & from)
Copy constructor. clone her, she's iconic. π
References operator=(), and SbDict().
π SbDict::~SbDict ()
Destructor. say bye bestie π«Ά
π Member Function Documentation π
β SbDict & SbDict::operator= (const SbDict & from)
Makes a shallow copy of the contents of dictionary from into this dictionary. shallow, not deep β remember that, iykyk.
References applyToAll(), clear(), and SbDict().
Referenced by SbDict().
β void SbDict::applyToAll (void(* rtn )(Key key, void *value)) const
Applies rtn to all the entries in the dictionary. every single one. no skipping. π
Referenced by operator=().
β void SbDict::applyToAll (void(* rtn )(Key key, void *value, void *data), void * data) const
okay this one is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. that's the whole difference. periodt.
β void SbDict::clear (void )
Clears all entries in the dictionary. poof. gone. π
Referenced by operator=().
β SbBool SbDict::enter (const Key key, void *const value)
Inserts a new entry into the dictionary. key should be a unique number, and value is the generic user data.
So here's the tea π: if key does not already exist in the dictionary, a brand new entry gets created and TRUE is returned. otherwise, the generic user data gets changed to value, and FALSE is returned. that's the whole plot twist.
β SbBool SbDict::find (const Key key, void *& value) const
Searches for key in the dictionary. If an entry with this key exists, TRUE is returned and the entry value is handed back in value. Otherwise, FALSE is returned. simple as that, bestie. β¨
β void SbDict::makePList (SbPList & keys, SbPList & values)
Creates lists with all the entries in the dictionary. two lists, one for keys and one for values. organized queen. π
β SbBool SbDict::remove (const Key key)
Removes the entry with key key. TRUE comes back if an entry with this key was actually present, FALSE otherwise. no entry, no problem.
β void SbDict::setHashingFunction (Key(* func )(const Key key))
Sets a new hashing function for this dictionary. the default hashing function just returns the key. yes, really, it just. returns. the key. π
If you notice that items entered into the dictionary seem 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 β and you'd need to make a static function that will cast from SbDict::Key to char * of course. π
heads up: this function is not part of the OIV API. just so you know. π«Ά
π Author π
Generated automatically by Doxygen for Coin from the source code. the robots did this one, not me. π€β¨
and that's the whole page bestie, mwah π β this was Coin, Version 2.5.0, and yeah it's literally called SbDict(3) in the man pages. go forth and hash responsibly. π¦π
π¦ where this page comes from
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms