SbDict(3)

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

✨ NAME ✨

SbDict β€” the SbDict class organizes a dictionary of keys and values. bestie it's literally a dictionary, keys in, values out, no cap πŸ’…


🌸 SYNOPSIS 🌸

#include <Inventor/SbDict.h>

πŸŽ€ Public Types

  • typedef uintptr_t Key β€” yep, that's the key type, it's a uintptr_t, iconic

πŸ¦‹ Public Member Functions

  • SbDict (const int entries=251)
  • SbDict (const SbDict &from)
  • ~SbDict ()
  • SbDict & operator= (const SbDict &from)
  • void applyToAll (SbDictApplyFunc *rtn) const
  • void applyToAll (SbDictApplyDataFunc *rtn, 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 (SbDictHashingFunc *func)

πŸ’– Detailed Description πŸ’–

The SbDict class organizes a dictionary of keys and values.

It uses hashing to quickly insert and find entries in the dictionary. An entry consists of an unique key and a generic pointer. that's the whole vibe, key + pointer, periodt ✨


🌈 Constructor & Destructor Documentation 🌈

SbDict::SbDict (const int entries = 251)

Constructor, with entries specifying the initial number of buckets in the hash list β€” so it needs to be larger than 0 bestie, don't play 😭. Other than that, no special care needs to be taken in choosing the value, since it is always rounded up to the nearest power of two. so like, chill, it handles it 🫢

SbDict::SbDict (const SbDict & from)

Copy constructor. πŸ’«

SbDict::~SbDict ()

Destructor. bye babe πŸ‘‹


πŸ‘‘ Member Function Documentation πŸ‘‘

SbDict & SbDict::operator= (const SbDict & from)

Make a shallow copy of the contents of dictionary from into this dictionary.

void SbDict::applyToAll (SbDictApplyFunc * rtn) const

Applies rtn to all entries in the dictionary. every single one, no skipping πŸ’…

void SbDict::applyToAll (SbDictApplyDataFunc * rtn, void * data) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void SbDict::clear (void )

Clear all entries in the dictionary. poof, gone, empty, a fresh start 🧚

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.

If key does not exist in the dictionary, a new entry is created and TRUE is returned. Otherwise, the generic user data is changed to value, and FALSE is returned. so like, heads up on that return value, it's giving "did I make a new one or not" 😌

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 returned in value. Otherwise, FALSE is returned.

void SbDict::makePList (SbPList & keys, SbPList & values)

Creates lists with all entries in the dictionary. yes, both of them, keys AND values, we love a matching set ✨

SbBool SbDict::remove (const Key key)

Removes the entry with key key. TRUE is returned if an entry with this key was present, FALSE otherwise.

void SbDict::setHashingFunction (SbDictHashingFunc * func)

Sets a new hashing function for this dictionary. Default hashing function just returns the key. simple, lowkey, does the job πŸ“

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 SbDict::Key to char * of course).

🚨 this function is not part of the OIV API. so like, don't go assuming it's in the public contract bestie πŸ’€

🫢 Author 🫢

Generated automatically by Doxygen for Coin from the source code.


and that's the whole page, we ate and left zero crumbs πŸ’…βœ¨ β€” with love from Coin, Version 3.1.3, the SbDict(3) bestie, mwah πŸŽ€

πŸ“¦ where this page comes from