SbPList(3)
πΈ SbPList πΈ
okay so welcome to SbPList(3), bestie π this is section 3 of the manual (library functions, the fun ones), and it's all about a little container class that holds void pointers. yes, pointers. raw ones. we're in our C++ era and we're thriving.
β¨ NAME β¨
SbPList β the container class for void pointers. that's it. that's the whole job. she holds your pointers and she holds them well. π
π¦ SYNOPSIS π¦
#include <Inventor/lists/SbPList.h>
Inherited by SbIntList, SbStringList, SbVec3fList, SoActionMethodList, SoAuditorList [private], SoBaseList, SoDetailList, SoEngineOutputList, SoFieldList, SoPickedPointList, and SoTypeList.
not one, not two, but eleven whole classes are out here inheriting from her. main character energy fr fr π
π Public Member Functions π
SbPList (const int sizehint=DEFAULTSIZE)β builds you a fresh list and pre-reserves room forsizehintthings.SbPList (const SbPList &l)β copy constructor, aka the clone button.~SbPList ()β destructor, she's logging off.void copy (const SbPList &l)β makes this list an exact copy ofl.SbPList & operator= (const SbPList &l)β the assignment operator, the=of it all.void fit (void)β squeezes the allocated array down to exactly the list's length, yeeting all those unused pre-allocated cells.void append (void *item)β addsitemonto the end of the list.int find (void *item) constβ hunts downitemand tells you its index, or-1if she's not there.void insert (void *item, const int insertbefore)β dropsitemin at indexinsertbefore.void removeItem (void *item)β removes an item by value. duplicates? the lowest index goes first, no questions.void remove (const int index)β removes whatever's sitting atindexand shuffles everything after it down one spot.void removeFast (const int index)β removes the item atindexby slamming the last item into its place and truncating. fast, chaotic, effective.int getLength (void) constβ how many items are in the list rn.void truncate (const int length, const int fit=0)β chops the list down tolengthelements, deleting everything from indexlengthonward.void ** getArrayPtr (const int start=0) constβ hands you a pointer to a non-modifiable array of the list's elements, starting at indexstart.void *& operator[] (const int index) constβ gives you the element atindex. she will grow the internal array for you if you ask for something out of bounds.int operator== (const SbPList &l) constβ equality check.TRUEwhen the two lists are identical, same ordered set of elements and all.int operator!= (const SbPList &l) constβ inequality check.TRUEwhen they're not equal.void * get (const int index) constβ grabs the element atindex. no bounds expansion, no mercy.void set (const int index, void *item)β index operator that sets the element atindex. also does not expand bounds.
π Protected Member Functions π
void expand (const int size)β grows the list so it can holdsizeitems. heads up: the new items tacked on the end have undefined value, so don't go reading them like they mean something πint getArraySize (void) constβ tells you how many items there's actually allocated space for in the array.
π Detailed Description π
The SbPList class is a container class for void pointers.
that's the whole vibe check. pointers in, pointers out, iconic behaviour throughout π«Ά
π§ Constructor & Destructor Documentation π§
SbPList::SbPList (const int sizehint = DEFAULTSIZE)
This constructor sets up the internal allocated size of the list to sizehint. and bestie, note this: the list still starts out with zero items. the space is just... reserved. waiting. manifesting β¨
Default constructor.
SbPList::SbPList (const SbPList & l)
Copy constructor. she's a copycat and we love her for it π
SbPList::~SbPList ()
Destructor. say bye π
π Member Function Documentation π
void SbPList::copy (const SbPList & l)
Make this list a copy of l. boom. twin.
SbPList & SbPList::operator= (const SbPList & l)
Assignment operator π«
void SbPList::fit (void )
Fit the allocated array exactly around the length of the list, discarding the memory spent on unused pre-allocated array cells.
ngl you should normally not need or want to call this method. it's only here so you have the option to optimize memory usage in the unlikely event that you're throwing around huge SbList objects inside your application. rare behaviour. collector's item π
void SbPList::append (void * item)
Append item to the end of the list. β¨
She automatically allocates more items internally if needed, so you don't have to think about it. she's got you.
int SbPList::find (void * item) const
Return the index of the first occurrence of item in the list, or -1 if item is not present. no ghosting, just -1 π
void SbPList::insert (void * item, const int insertbefore)
Insert item at index insertbefore.
insertbefore should not be larger than the current number of items in the list. respect the bounds bestie π
void SbPList::removeItem (void * item)
Removes an item from the list. If there are several items with the same value, removes the item with the lowest index. first come, first gone.
void SbPList::remove (const int index)
Remove the item at index, moving all subsequent items downwards one place in the list. everyone shifts up in line πΆβοΈπΆβοΈπΆβοΈ
void SbPList::removeFast (const int index)
Remove the item at index, moving the last item into its place and truncating the list. no shuffling, no waiting, just vibes and speed π₯
int SbPList::getLength (void ) const
Returns the number of items in the list. the headcount π
void SbPList::truncate (const int length, const int fit = 0)
Shorten the list to contain length elements, removing items from index length and onwards.
If fit is non-zero, she'll also shrink the internal size of the allocated array. note that this is much less efficient than not re-fitting the array size β so maybe don't do it unless you mean it π
void ** SbPList::getArrayPtr (const int start = 0) const
Returns a pointer to a non-modifiable array of the list's elements. start specifies an index into the array.
The caller is not responsible for freeing up the array, because it's just a pointer into the internal array the list uses. don't you dare free() her, she's borrowed π«Ά
void *& SbPList::operator[] (const int index) const
Returns the element at index.
She'll automatically expand the size of the internal array if index is outside the current bounds of the list. The values of any additional pointers are then set to NULL. growing pains, but make it graceful π±
int SbPList::operator== (const SbPList & l) const
Equality operator. Returns TRUE if this list and l are identical, containing the exact same ordered set of elements. same order, same everything, or it's not a match β¨
int SbPList::operator!= (const SbPList & l) const
Inequality operator. Returns TRUE if this list and l are not equal. it's giving "we are not the same" π
void * SbPList::get (const int index) const
Returns the element at index. Does not expand array bounds if index is outside the list. she's not growing for you here, bestie.
void SbPList::set (const int index, void * item)
Index operator to set the element at index. Does not expand array bounds if index is outside the list. same energy as get, but make it a write βοΈ
void SbPList::expand (const int size)
(protected)
Expand the list to contain size items. The new items added at the end have undefined value.
undefined value means do NOT read them and assume anything. they are mystery meat. we do not consume mystery meat π₯π
int SbPList::getArraySize (void ) const
(protected)
Return the number of items there's allocated space for in the array.
See also: getLength()
π Author π
Generated automatically by Doxygen for Coin from the source code. (so yes, a robot wrote this and honestly? she ate. π π€)
okay that's the whole page bestie, you're officially fluent in SbPList πβ¨ this was Coin, Version 3.1.3, and you can find her hanging out in section 3 of the manual as SbPList(3). go forth and hold some pointers π«Άπ no cap, you got this π
π¦ where this page comes from
- fedora 43: Coin3-devel 3.1.3-40.fc43 Β· GPL-2.0-only
- fedora 43: Coin3-devel 3.1.3-40.fc43 Β· GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 Β· GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.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