SbDict(3)

πŸ“¦ version 2.5.0, in fedora 43, fedora 44

πŸ’– 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