SbHeap(3)

πŸ“¦
version 4.0.10 Β· 4 versions
, in fedora 43, fedora 44

πŸ’– SbHeap(3) β€” NAME πŸ’–

SbHeap β€” bestie, it's the SbHeap class, a generic heap class. That's the whole vibe. ✨


🌸 SYNOPSIS 🌸

#include <Inventor/SbHeap.h>

πŸŽ€ Public Member Functions πŸŽ€

SbHeap (const SbHeapFuncs &SbHeapFuncs, const int initsize=1024)
~SbHeap ()
void emptyHeap (void)
int size (void) const
int add (void *obj)
void remove (const int pos)
void remove (void *obj)
void * extractMin ()
void * getMin ()
void * operator[] (const int idx)
void newWeight (void *obj, int hpos=-1)
SbBool buildHeap (SbBool(*progresscb)(float percentage, void *data)=NULL, void *data=NULL)
SbBool traverseHeap (SbBool(*func)(void *, void *), void *userdata) const

πŸ¦‹ Detailed Description πŸ¦‹

okay so. The SbHeap class is a generic heap class. That's it, that's the description. πŸ’…

FIXME: write doc πŸ™ˆ β€” yeah, the docs are not giving what they need to give here, bestie. Not me exposing the upstream TODO but here we are.
Note: SbHeap is an extension versus the Open Inventor API. So it's not vanilla Open Inventor, it's Coin doing its own lil thing. iykyk. ⭐

πŸ‘‘ Constructor & Destructor Documentation πŸ‘‘

πŸ’œ SbHeap::SbHeap (const SbHeapFuncs & hFuncs, const int initsize = 1024)

Constructor, periodt. hFuncs is the set of functions that tell the heap how to modify and return info about the heap object. initsize is the initial number of allocated elements β€” so like, how much room it gets to start with. 🫢

This array will automatically grow when necessary, no cap. But listen: if you already know roughly how many elements the heap is gonna hold, supply it so you can dodge some reallocs. Slay. ✨

πŸ’€ SbHeap::~SbHeap (void )

Destructor. It's over, it's done, the heap has left the chat. πŸ’€


🌈 Member Function Documentation 🌈

🧚 void SbHeap::emptyHeap (void )

Removes all the elements from the heap. Everything. Gone. Clean slate energy. πŸŽ€

πŸ“ int SbHeap::size (void ) const

Returns the number of elements in the heap. Just the count, bestie. πŸ”’

✨ int SbHeap::add (void * obj)

Adds an element to the heap. Returns the element's heap position β€” hold onto that number, it's the receipts. πŸ’…

🌸 void SbHeap::remove (const int idx)

Removes an element from the heap. Bye bestie πŸ‘‹

πŸ¦‹ void SbHeap::remove (void * obj)

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

πŸ‘‘ void * SbHeap::extractMin (void )

Returns and removes the first element in the heap, or NULL if the heap is empty. Note that it does both β€” it takes the min and dips. πŸ”₯

πŸ’œ void * SbHeap::getMin (void )

Returns the first element in the heap, or NULL if the heap is empty. This one peeks, it doesn't remove. Look but don't touch. πŸ™ˆ

🌟 void * SbHeap::operator[] (const int idx)

Returns the heap element at index idx in the heap. Array-style access, iconic. ⭐

πŸŽ€ void SbHeap::newWeight (void * obj, int hpos = -1)

Fixes the heap if necessary when the element at hpos has changed weight. If you already know the element's heap position, you can supply it in hpos. Save the lookup, treat yourself. πŸ’–

🌈 SbBool SbHeap::buildHeap (SbBool(* progresscb )(float percentage, void *data) = NULL, void * data = NULL)

Builds a heap out of a randomly ordered data-structure. Unruly input goes in, tidy heap comes out. progresscb gets a percentage and your data, and defaults to NULL β€” same for data. ✨

🫢 SbBool SbHeap::traverseHeap (SbBool(* func )(void *, void *), void * userdata) const

Traverses each heap element, and calls func for each element. You bring the function, it brings the elements, and userdata rides along. πŸ’œ


πŸ’Œ Author πŸ’Œ

Generated automatically by Doxygen for Coin from the source code. The robots wrote the bio, we just gave it a makeover. πŸ€–πŸ’…


and that's a wrap, bestie!! πŸŽ€βœ¨ This lil masterpiece is Version 4.0.10, dated Thu Jun 25 2026 00:00:00, and it's filed under SbHeap(3). mwah, go build a heap, you got this πŸ«ΆπŸ’–

πŸ“¦ where this page comes from