SBLIST(3coin2)

πŸ“¦
version 2.5.0 Β· 2 versions
, in fedora 43

πŸ‘‘ SbList<Type>(3) πŸ‘‘

okay so bestie, welcome to the Library Functions Manual, and today's main character is literally SbList< Type >(3). she's a template container class for lists and she ate. let's get into it πŸ’…


✨ NAME ✨

SbList< Type > β€” The SbList class is a template container class for lists. periodt.


🌸 SYNOPSIS 🌸

#include <Inventor/lists/SbList.h>

πŸ’– Public Member Functions πŸ’–

SbList (const int sizehint=DEFAULTSIZE)
SbList (const SbList< Type > &l)
~SbList ()
void copy (const SbList< Type > &l)
SbList< Type > & operator= (const SbList< Type > &l)
void fit (void)
void append (const Type item)
int find (const Type item) const
void insert (const Type item, const int insertbefore)
void removeItem (const Type item)
void remove (const int index)
void removeFast (const int index)
int getLength (void) const
void truncate (const int length, const int dofit=0)
void push (const Type item)
Type pop (void)
const Type * getArrayPtr (const int start=0) const
Type operator[] (const int index) const
Type & operator[] (const int index)
int operator== (const SbList< Type > &l) const
int operator!= (const SbList< Type > &l) const

πŸ›‘οΈ Protected Member Functions πŸ›‘οΈ

void expand (const int size)
int getArraySize (void) const

🌈 Detailed Description 🌈

πŸ¦‹ template&lt;class Type&gt; class SbList&lt; Type &gt; πŸ¦‹

so the actual class definition is:

template<class Type>
class SbList< Type >

and here's the tea, no cap:

SbList is an extension of the Coin library versus the original Open Inventor API. Open Inventor handles most list classes by inheriting the SbPList class, which contains an array of generic void* pointers. By using this template-based class instead, we can share more code and make the list handling code more typesafe.

Care has been taken to make sure the list classes which are part of the Open Inventor API to still be compatible with their original interfaces, as derived from the SbPList base class. But if you still bump into any problems when porting your Open Inventor applications, let us know and we'll do our best to sort them out. 🫢

A feature with this class is that the list object arrays grow dynamically as you append() more items to the list. The actual growing technique used is to double the list size when it becomes too small. iconic behavior honestly.

There are also other array-related convenience methods; e.g. finding item indices, inserting items at any position, removing items (and shrink the array), copying of arrays, etc. she does it all, lowkey.

πŸ‘€ See also

SbPList


πŸŽ€ Constructor & Destructor Documentation πŸŽ€

🌟 template&lt;class Type&gt; SbList&lt; Type &gt;::SbList (const int sizehint = DEFAULTSIZE) [inline] 🌟

Default constructor.

The sizehint argument hints about how many elements the list will contain, so memory allocation can be done efficiently.

Important note: explicitly specifying an sizehint value does not mean that the list will initially contain this number of values. After construction, the list will contain zero items, just as for the default constructor. Here's a good example on how to give yourself hard to find bugs:
SbList<SbBool> flags(2); // Assume we need only 2 elements. Note
                         // that the list is still 0 elements long.
flags[0] = TRUE;         // Ouch. List is still 0 elements long.

Since this conceptual misunderstanding is so easy to make, you're probably better (or at least safer) off leaving the sizehint argument to its default value by not explicitly specifying it. fr fr, don't do it to yourself πŸ’€

It improves performance if you know the approximate total size of the list in advance before adding list elements, as the number of reallocations will be minimized.

Referenced by copy(), operator!=(), operator=(), operator==(), and SbList().

πŸ¦‹ template&lt;class Type&gt; SbList&lt; Type &gt;::SbList (const SbList&lt; Type &gt; & l) [inline] πŸ¦‹

Copy constructor. Creates a complete copy of the given list. twin energy ✨

References copy(), and SbList().

🌷 template&lt;class Type&gt; SbList&lt; Type &gt;::~SbList () [inline] 🌷

Destructor, frees all internal resources used by the list container. she's done, she's resting, she deserves it 😌


πŸ’œ Member Function Documentation πŸ’œ

πŸ’« template&lt;class Type&gt; void SbList&lt; Type &gt;::copy (const SbList&lt; Type &gt; & l) [inline] πŸ’«

Make this list a copy of l.

References expand(), and SbList().

Referenced by operator=(), and SbList().

πŸ’« template&lt;class Type&gt; SbList&lt; Type &gt; & SbList&lt; Type &gt;::operator= (const SbList&lt; Type &gt; & l) [inline] πŸ’«

Make this list a copy of l.

References copy(), and SbList().

πŸ’« template&lt;class Type&gt; void SbList&lt; Type &gt;::fit (void ) [inline] πŸ’«

Fit the allocated array exactly around the length of the list, descarding memory spent on unused pre-allocated array cells.

You should normally not need or want to call this method, and it is only available for the sake of having the option to optimize memory usage for the unlikely event that you should throw around huge SbList objects within your application.

Referenced by truncate().

πŸ’« template&lt;class Type&gt; void SbList&lt; Type &gt;::append (const Type item) [inline] πŸ’«

Append the item at the end of list, expanding the list array by one. adding to the group chat, basically πŸ’¬

Referenced by SoFieldData::addEnumValue(), SoOutput::addRoute(), SoNodekitCatalog::clone(), SoBaseKit::copyContents(), SoLinearProfile::getTrimCurve(), SoNurbsProfile::getTrimCurve(), SoLinearProfile::getVertices(), SoNurbsProfile::getVertices(), SoOffscreenRenderer::getWriteFiletypeInfo(), SoType::init(), SoEngineOutput::prepareToWrite(), push(), SoBaseKit::readInstance(), SoVRMLParent::updateChildList(), and SoAction::usePathCode().

πŸ’« template&lt;class Type&gt; int SbList&lt; Type &gt;::find (const Type item) const [inline] πŸ’«

Return index of first occurrence of item in the list, or -1 if item is not present. she'll find them, she always does πŸ”

Referenced by SoFieldData::addEnumValue(), and removeItem().

πŸ’« template&lt;class Type&gt; void SbList&lt; Type &gt;::insert (const Type item, const int insertbefore) [inline] πŸ’«

Insert item at index insertbefore.

insertbefore should not be larger than the current number of items in the list. don't be extra, stay in bounds bestie 🚧

Referenced by SoFieldContainer::initCopyDict(), SoSensorManager::insertDelaySensor(), and SoSensorManager::insertTimerSensor().

πŸ’« template&lt;class Type&gt; void SbList&lt; Type &gt;::removeItem (const Type item) [inline] πŸ’«

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 removed, sorry πŸ’…

References find(), and remove().

πŸ’« template&lt;class Type&gt; void SbList&lt; Type &gt;::remove (const int index) [inline] πŸ’«

Remove the item at index, moving all subsequent items downwards one place in the list.

Referenced by SoFieldContainer::copyDone(), and removeItem().

πŸ’« template&lt;class Type&gt; void SbList&lt; Type &gt;::removeFast (const int index) [inline] πŸ’«

Remove the item at index, moving the last item into its place and truncating the list. she's fast, she's efficient, she does NOT shuffle everybody down πŸ’¨

πŸ’« template&lt;class Type&gt; int SbList&lt; Type &gt;::getLength (void ) const [inline] πŸ’«

Returns number of items in the list.

Referenced by SoFieldData::copy(), SoBaseKit::copyContents(), SoBase::destroy(), SoContextHandler::destructingContext(), SbBSPTree::findClosest(), SoFieldContainer::findCopy(), SoVRMLExtrusion::generatePrimitives(), SoOutput::getCurrentProto(), SoFieldData::getEnumData(), SoVRMLExtrusion::getPrimitiveCount(), SoNurbsProfile::getVertices(), SoVRMLExtrusion::GLRender(), SoSensorManager::insertDelaySensor(), SoSensorManager::insertTimerSensor(), SoOutput::popProto(), SoOutput::reset(), SoOutput::resolveRoutes(), SoInteractionKit::setDefaultOnNonWritingFields(), SoVRMLParent::updateChildList(), and SoAction::usePathCode().

πŸ’« template&lt;class Type&gt; void SbList&lt; Type &gt;::truncate (const int length, const int fit = 0) [inline] πŸ’«

Shorten the list to contain length elements, removing items from index length and onwards.

If fit is non-zero, will also shrink the internal size of the allocated array. Note that this is much less efficient than not re-fitting the array size. so like, only do it if you really mean it πŸ™ˆ

References fit().

Referenced by SbBSPTree::findClosest(), SoLinearProfile::getTrimCurve(), SoNurbsProfile::getTrimCurve(), SoLinearProfile::getVertices(), SoNurbsProfile::getVertices(), SoOffscreenRenderer::getWriteFiletypeInfo(), SoEngineOutput::prepareToWrite(), SoOutput::resolveRoutes(), and SoAction::usePathCode().

πŸ’« template&lt;class Type&gt; void SbList&lt; Type &gt;::push (const Type item) [inline] πŸ’«

This appends item at the end of the list in the same fashion as append() does. Provided as an abstraction for using the list class as a stack.

References append().

πŸ’« template&lt;class Type&gt; Type SbList&lt; Type &gt;::pop (void ) [inline] πŸ’«

Pops off the last element of the list and returns it. bye bestie, see you never πŸ‘‹

πŸ’« template&lt;class Type&gt; const Type * SbList&lt; Type &gt;::getArrayPtr (const int start = 0) const [inline] πŸ’«

Returns pointer to a non-modifiable array of the lists elements. start specifies an index into the array.

The caller is not responsible for freeing up the array, as it is just a pointer into the internal array used by the list. hands off, she owns that memory 🫡

Referenced by SoPath::containsPath(), SoContextHandler::destructingContext(), SoPath::findFork(), SoVRMLExtrusion::generatePrimitives(), SoFieldData::getEnumData(), SoLinearProfile::getTrimCurve(), SoNurbsProfile::getTrimCurve(), SoLinearProfile::getVertices(), SoNurbsProfile::getVertices(), SoVRMLExtrusion::GLRender(), SoPath::operator==, SoVRMLParent::updateChildList(), and SoAction::usePathCode().

πŸ’« template&lt;class Type&gt; Type SbList&lt; Type &gt;::operator[] (const int index) const [inline] πŸ’«

Returns a copy of item at index.

πŸ’« template&lt;class Type&gt; Type & SbList&lt; Type &gt;::operator[] (const int index) [inline] πŸ’«

Returns a reference to item at index.

πŸ’« template&lt;class Type&gt; int SbList&lt; Type &gt;::operator== (const SbList&lt; Type &gt; & l) const [inline] πŸ’«

Equality operator. Returns TRUE if this list and l are identical, containing the exact same set of elements. same energy, same vibes ✨

References SbList().

πŸ’« template&lt;class Type&gt; int SbList&lt; Type &gt;::operator!= (const SbList&lt; Type &gt; & l) const [inline] πŸ’«

Inequality operator. Returns TRUE if this list and l are not equal. not the same, we're different, periodt πŸ’…

References SbList().

πŸ’« template&lt;class Type&gt; void SbList&lt; Type &gt;::expand (const int size) [inline], [protected] πŸ’«

Expand the list to contain size items. The new items added at the end have undefined value. careful bestie, those cells are giving mystery 🫣

Referenced by copy().

πŸ’« template&lt;class Type&gt; int SbList&lt; Type &gt;::getArraySize (void ) const [inline], [protected] πŸ’«

Return 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. she didn't write herself, she was born this way 🧚


and that's the whole page, bestie β€” this gorgeous thing came out of Coin, Version 2.5.0, so go forth and slay your lists responsibly. mwah πŸ’–βœ¨

πŸ“¦ where this page comes from