Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://coin3d.github.io
https://www.kongsberg.com/en/kogt/
SoElement Class Referenceabstract

SoElement is the abstract base class for all elements. More...

#include <Inventor/elements/SoElement.h>

Inheritance diagram for SoElement:
SoAccumulatedElement SoCacheElement SoCacheHintElement SoCullElement SoDepthBufferElement SoFloatElement SoGLCacheContextElement SoGLRenderPassElement SoGLUpdateAreaElement SoGLVBOElement SoInt32Element SoLazyElement SoLocalBBoxMatrixElement SoMultiTextureCoordinateElement SoMultiTextureEnabledElement SoMultiTextureImageElement SoOverrideElement SoPickRayElement SoProfilerElement SoReplacedElement SoResetMatrixElement SoShapeHintsElement SoShapeStyleElement SoTextureCombineElement SoTextureOverrideElement SoViewportRegionElement SoWindowElement

Public Member Functions

const SoType getTypeId (void) const
 
int getStackIndex (void) const
 
virtual void init (SoState *state)
 
virtual void push (SoState *state)
 
virtual void pop (SoState *state, const SoElement *prevTopElement)
 
virtual SbBool matches (const SoElement *element) const =0
 
virtual SoElementcopyMatchInfo (void) const =0
 
void setDepth (const int depth)
 
int getDepth (void) const
 
virtual void print (FILE *file=stdout) const
 
virtual ~SoElement ()
 

Static Public Member Functions

static void initClass (void)
 
static SoType getClassTypeId (void)
 
static int getClassStackIndex (void)
 
static void initElements (void)
 
static int getNumStackIndices (void)
 
static SoType getIdFromStackIndex (const int stackIndex)
 

Protected Member Functions

 SoElement (void)
 
void capture (SoState *const state) const
 
virtual void captureThis (SoState *state) const
 
void setTypeId (const SoType typeId)
 
void setStackIndex (const int index)
 
SoElementgetNextInStack (void) const
 
SoElementgetNextFree (void) const
 

Static Protected Member Functions

static SoElementgetElement (SoState *const state, const int stackIndex)
 
static const SoElementgetConstElement (SoState *const state, const int stackIndex)
 
static int createStackIndex (const SoType id)
 

Protected Attributes

SoType typeId
 
int stackIndex
 
int depth
 

Static Protected Attributes

static int classStackIndex
 
static SoTypeListstackToType
 

Detailed Description

SoElement is the abstract base class for all elements.

This is the base class for all the element classes in Coin.

Constructor & Destructor Documentation

◆ ~SoElement()

SoElement::~SoElement ( )
virtual

The destructor.

◆ SoElement()

SoElement::SoElement ( void  )
protected

The constructor. To create element instances, use SoType::createInstance() for the elements type identifier.

Member Function Documentation

◆ initClass()

void SoElement::initClass ( void  )
static

Initialize relevant common data for all instances, like the type system.

◆ getClassTypeId()

SoType SoElement::getClassTypeId ( void  )
static

This static method returns the SoType object associated with objects of this class.

◆ getClassStackIndex()

int SoElement::getClassStackIndex ( void  )
static

This static method returns the state stack index for the class.

◆ getTypeId()

const SoType SoElement::getTypeId ( void  ) const

Returns the type identification of an object derived from a class inheriting SoElement. This is used for runtime type checking and "downward" casting.

For a more thorough explanation of the runtime type identification functionality, see the documentation of SoBase::getTypeId().

◆ getStackIndex()

int SoElement::getStackIndex ( void  ) const

Returns the stack index for an element instance.

◆ init()

void SoElement::init ( SoState state)
virtual

This function initializes the element type in the given SoState. It is called for the first element of each enabled element type in SoState objects.

Reimplemented in SoLazyElement, SoOverrideElement, SoTextureCombineElement, SoMultiTextureImageElement, SoDepthBufferElement, SoShapeStyleElement, SoUnitsElement, SoMultiTextureCoordinateElement, SoShapeHintsElement, SoGLVBOElement, SoMaterialBindingElement, SoNormalBindingElement, SoMultiTextureEnabledElement, SoGLCacheContextElement, SoEnvironmentElement, SoPickStyleElement, SoProfileElement, SoTextureOverrideElement, SoVertexAttributeBindingElement, SoDrawStyleElement, SoProfileCoordinateElement, SoShadowStyleElement, SoComplexityTypeElement, SoGLShadowCullingElement, SoCacheHintElement, SoGLLazyElement, SoPolygonOffsetElement, SoTextureCoordinateBindingElement, SoWindowElement, SoCullElement, SoGLMultiTextureImageElement, SoLightElement, SoLightModelElement, SoLinePatternElement, SoAccumulatedElement, SoAnnoText3FontSizeHintElement, SoAnnoText3RenderPrintElement, SoBumpMapElement, SoGeoElement, SoDiffuseColorElement, SoGLMultiTextureCoordinateElement, SoMultiTextureMatrixElement, SoTextureUnitElement, SoVertexAttributeElement, SoResetMatrixElement, SoAmbientColorElement, SoBBoxModelMatrixElement, SoCacheElement, SoClipPlaneElement, SoCoordinateElement, SoDecimationTypeElement, SoEmissiveColorElement, SoGLColorIndexElement, SoGLMultiTextureEnabledElement, SoGLMultiTextureMatrixElement, SoGLPointSizeElement, SoGLUpdateAreaElement, SoModelMatrixElement, SoNormalElement, SoSpecularColorElement, SoBumpMapCoordinateElement, SoBumpMapMatrixElement, SoFontNameElement, SoInt32Element, SoLightAttenuationElement, SoListenerDopplerElement, SoListenerOrientationElement, SoListenerPositionElement, SoPickRayElement, SoProjectionMatrixElement, SoReplacedElement, SoTransparencyElement, SoViewVolumeElement, SoViewingMatrixElement, SoViewportRegionElement, SoAnnoText3CharOrientElement, SoComplexityElement, SoCreaseAngleElement, SoDecimationPercentageElement, SoFloatElement, SoFocalDistanceElement, SoFontSizeElement, SoGLClipPlaneElement, SoGLDrawStyleElement, SoGLEnvironmentElement, SoGLLightIdElement, SoGLLinePatternElement, SoGLLineWidthElement, SoGLModelMatrixElement, SoGLNormalElement, SoGLPolygonOffsetElement, SoGLRenderPassElement, SoGLShaderProgramElement, SoGLShapeHintsElement, SoGLVertexAttributeElement, SoGLViewingMatrixElement, SoGLViewportRegionElement, SoLineWidthElement, SoListenerGainElement, SoLocalBBoxMatrixElement, SoPointSizeElement, SoShininessElement, SoSoundElement, SoSwitchElement, SoTextOutlineEnabledElement, SoTextureQualityElement, and SoGLDepthBufferElement.

◆ push()

void SoElement::push ( SoState state)
virtual

This method is called every time a new element is required in one of the stacks. This happens when a writable element is requested, using SoState::getElement() or indirectly SoElement::getElement(), and the depth of the current element is less than the state depth.

Override this method if your element needs to copy data from the previous top of stack. The push() method is called on the new element, and the previous element can be found using SoElement::getNextInStack().

Reimplemented in SoMultiTextureImageElement, SoMultiTextureCoordinateElement, SoLazyElement, SoTextureCombineElement, SoOverrideElement, SoShapeStyleElement, SoDepthBufferElement, SoMultiTextureEnabledElement, SoShapeHintsElement, SoSoundElement, SoGLVBOElement, SoGLShadowCullingElement, SoProfileElement, SoTextureOverrideElement, SoWindowElement, SoCacheHintElement, SoGLLazyElement, SoGLShaderProgramElement, SoCullElement, SoGLMultiTextureImageElement, SoLightElement, SoAccumulatedElement, SoVertexAttributeElement, SoBBoxModelMatrixElement, SoCacheElement, SoGLMultiTextureCoordinateElement, SoGLMultiTextureEnabledElement, SoGLPointSizeElement, SoMultiTextureMatrixElement, SoClipPlaneElement, SoGLMultiTextureMatrixElement, SoGLUpdateAreaElement, SoModelMatrixElement, SoBumpMapMatrixElement, SoGLDrawStyleElement, SoGLLightIdElement, SoGLLinePatternElement, SoGLLineWidthElement, SoGLModelMatrixElement, SoGLShapeHintsElement, SoGLViewingMatrixElement, SoLocalBBoxMatrixElement, SoTextOutlineEnabledElement, SoGLPolygonOffsetElement, SoGLViewportRegionElement, and SoGLDepthBufferElement.

◆ pop()

void SoElement::pop ( SoState state,
const SoElement prevTopElement 
)
virtual

◆ matches()

◆ copyMatchInfo()

◆ initElements()

void SoElement::initElements ( void  )
static

This function initializes all the built-in Coin element classes.

◆ getNumStackIndices()

int SoElement::getNumStackIndices ( void  )
static

Returns the number of allocated element stack index slots.

◆ getIdFromStackIndex()

SoType SoElement::getIdFromStackIndex ( const int  stackIndex)
static

Returns the SoType identifier for the element class with element state stack index stackIndex.

◆ setDepth()

void SoElement::setDepth ( const int  depth)

Sets the depth value of the element instance in the state stack.

◆ getDepth()

int SoElement::getDepth ( void  ) const

Returns the state stack depth value of the element instance.

◆ print()

void SoElement::print ( FILE *  file = stdout) const
virtual

◆ getElement()

SoElement * SoElement::getElement ( SoState *const  state,
const int  stackIndex 
)
inlinestaticprotected

This method returns the top instance (in the state stack) of the element class with stack index stackIndex.

The returned instance is writable. To make this instance, some lazy evaluation may have to be performed, so use getConstElement() instead if the instance shouldn't be modified.

If no instance is available and cannot be made, NULL is returned.

See also
const SoElement * SoElement::getConstElement(SoState * const state, const int stackIndex)

◆ getConstElement()

void const SoElement * SoElement::getConstElement ( SoState *const  state,
const int  stackIndex 
)
inlinestaticprotected

This method returns a reference to the top element of the class with stack index stackIndex. The returned element is non-mutable.

(Don't try to be clever and cast away the constness – if the returned instance is modified, strange, hard to find and generally wonderful bugs will most likely start to happen.)

If no instance can be returned, NULL is returned.

See also
SoElement * SoElement::getElement(SoState * const state, const int stackIndex)

◆ capture()

void SoElement::capture ( SoState *const  state) const
inlineprotected

This function does whatever is necessary in the state for caching purposes. If should be called by subclasses of SoElement whenever any value in the element is accessed.

◆ captureThis()

void SoElement::captureThis ( SoState state) const
protectedvirtual

Adds the element to the cache.

Reimplemented in SoAccumulatedElement.

◆ setTypeId()

void SoElement::setTypeId ( const SoType  typeId)
protected

Sets the type identifier of an instance.

Note that this is fundamentally different from the SoNode runtime type system.

◆ setStackIndex()

void SoElement::setStackIndex ( const int  stackIndex)
protected

Sets the stack index in an instance. Used in constructors of derived elements.

◆ createStackIndex()

int SoElement::createStackIndex ( const SoType  typeId)
staticprotected

Returns the value of a new available stack index.

◆ getNextInStack()

SoElement * SoElement::getNextInStack ( void  ) const
protected

Returns the next element down in the stack. Should be used in push() to get the previous element.

This method has a slightly misleading name, but we didn't change it to stay compatible with the original SGI Inventor API.

◆ getNextFree()

SoElement * SoElement::getNextFree ( void  ) const
protected

Returns the next free element, i.e. the next element up in the stack.

Member Data Documentation

◆ classStackIndex

int SoElement::classStackIndex
staticprotected

This is the static state stack index for the class.

◆ typeId

SoType SoElement::typeId
protected

The element's unique SoType type identification.

◆ stackIndex

int SoElement::stackIndex
protected

The index in the state stack for this particular element instance.

◆ stackToType

SoTypeList * SoElement::stackToType
staticprotected

Provides mapping from state stack indices to element types.

◆ depth

int SoElement::depth
protected

The depth of the element instance in the state stack.


The documentation for this class was generated from the following files: