SbPList(3)

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

🌸 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 for sizehint things.
  • 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 of l.
  • 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) β€” adds item onto the end of the list.
  • int find (void *item) const β€” hunts down item and tells you its index, or -1 if she's not there.
  • void insert (void *item, const int insertbefore) β€” drops item in at index insertbefore.
  • 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 at index and shuffles everything after it down one spot.
  • void removeFast (const int index) β€” removes the item at index by 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 to length elements, deleting everything from index length onward.
  • void ** getArrayPtr (const int start=0) const β€” hands you a pointer to a non-modifiable array of the list's elements, starting at index start.
  • void *& operator[] (const int index) const β€” gives you the element at index. she will grow the internal array for you if you ask for something out of bounds.
  • int operator== (const SbPList &l) const β€” equality check. TRUE when the two lists are identical, same ordered set of elements and all.
  • int operator!= (const SbPList &l) const β€” inequality check. TRUE when they're not equal.
  • void * get (const int index) const β€” grabs the element at index. no bounds expansion, no mercy.
  • void set (const int index, void *item) β€” index operator that sets the element at index. also does not expand bounds.

πŸŽ€ Protected Member Functions πŸŽ€

  • void expand (const int size) β€” grows the list so it can hold size items. 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