Open Inventor Reference
SoElement Class Reference

This is the abstract base class for all state elements. More...

#include <Inventor/elements/SoElement.h>

Inheritance diagram for SoElement:
SoAccumulatedElement SoCacheElement SoFloatElement SoGLCacheContextElement SoGLRenderPassElement SoGLUpdateAreaElement SoGLVBOElement SoInt32Element SoLazyElement SoLocalBBoxMatrixElement SoOverrideElement SoPickRayElement SoReplacedElement SoShapeHintsElement SoShapeStyleElement SoTextureOverrideElement SoViewportRegionElement SoWindowElement

List of all members.

Public Member Functions

virtual void init (SoState *state)
 Initializes element.
virtual void push (SoState *state)
 Pushes/pops element.
virtual void pop (SoState *state, const SoElement *prevTopElement)
virtual void print (FILE *fp) const
 Prints element (for debugging)
virtual SbBool matches (const SoElement *elt) const =0
 Returns TRUE if the element matches another element (of the same class, presumably) with respect to cache validity.
virtual SoElementcopyMatchInfo () const =0
 Create a copy that we can put in a cache used list and call matches() on later.
SoType getTypeId () const
 Returns type identifier for element instance.
int getStackIndex () const
 Returns the stack index for an element instance.
void setDepth (int dpth)
 Sets stuff in an element instance.
void setNext (SoElement *nxt)
void setNextInStack (SoElement *nxt)
void setNextFree (SoElement *nxt)
int getDepth () const
 Returns stuff from element instance.
SoElementgetNext () const
virtual ~SoElement ()
 Destructor.

Static Public Member Functions

static SoType getClassTypeId ()
 Returns type identifier for SoElement class.
static void initElements ()
 Initialize ALL Inventor element classes.
static void initClass ()
 Initializes the SoElement class.
static int getNumStackIndices ()
 Returns the number of stack indices allocated.
static SoType getIdFromStackIndex (int stackIndex)
 Returns the id for the element with the given stack index.

Protected Member Functions

 SoElement ()
 Constructor; use typeId.createInstance to create elements.
void capture (SoState *state) const
 Does whatever is necessary in state to capture this element for caching purposes.
virtual void captureThis (SoState *state) const
 Really captures this element, once it has been determined that a cache is open to capture it.
void setTypeId (SoType id)
 Sets typeId in instance.
void setStackIndex (int index)
 Sets stackIndex in instance.
SoElementgetNextInStack () const
 Returns next instance in specific element stack.
SoElementgetNextFree () const
 Returns next free element in a specific element stack.

Static Protected Member Functions

static SoElementgetElement (SoState *state, int stackIndex)
 Returns an instance of an element from the stack with the given index in the given state.
static const SoElementgetConstElement (SoState *state, int stackIndex)
 Returns a read-only pointer to the top instance in the given element stack.
static int createStackIndex (SoType id)
 Creates and returns a new stack index.

Static Protected Attributes

static int classStackIndex
 Stack index for SoElement class.

Friends

class SoState

Detailed Description

This class defines the following features for all of its derived classes:

Type identifiers. Each class of element has a unique (static) SoType identifier. The correct type id is also stored in each instance for easy access.

Copying. Elements are copied into the list of elements used in an SoCache. Performing any operation other than matches() on a copied element is not guaranteed to work (and will not work for things like Coordinates, if the coordinate they were pointing to has been deleted).

Stack indices. Since a subclass of an element class needs to be in the same state stack as the class from which it is derived, stack indices are inherited.

Capturing. Each time an element's value is accessed, that element is added to the elements-used list of all currently open caches.

Definition at line 96 of file SoElement.h.


Constructor & Destructor Documentation

virtual SoElement::~SoElement ( ) [virtual]
SoElement::SoElement ( ) [protected]

Member Function Documentation

void SoElement::capture ( SoState state) const [inline, protected]

Should be called by subclasses whenever any value in the element is accessed.

Definition at line 173 of file SoElement.h.

References SoState::isCacheOpen().

Referenced by getConstElement().

virtual void SoElement::captureThis ( SoState state) const [protected, virtual]

Reimplemented in SoAccumulatedElement.

static int SoElement::createStackIndex ( SoType  id) [static, protected]
static SoType SoElement::getClassTypeId ( ) [inline, static]

Definition at line 121 of file SoElement.h.

const SoElement * SoElement::getConstElement ( SoState state,
int  stackIndex 
) [inline, static, protected]

Description: Returns a read-only pointer to the top instance in the given element stack.

inline to speed up traversal.

Use: protected //////////////////////////////////////////////////////////////////////

Definition at line 234 of file SoElement.h.

References capture(), and SoState::getConstElement().

Referenced by SoInt32Element::get(), SoFloatElement::get(), SoNormalElement::getInstance(), and SoCoordinateElement::getInstance().

int SoElement::getDepth ( ) const [inline]

Definition at line 149 of file SoElement.h.

static SoElement* SoElement::getElement ( SoState state,
int  stackIndex 
) [inline, static, protected]

This instance is writeable. This returns NULL if no writable instance can be returned.

Definition at line 162 of file SoElement.h.

References SoState::getElement().

static SoType SoElement::getIdFromStackIndex ( int  stackIndex) [static]
SoElement* SoElement::getNext ( ) const [inline]

Definition at line 150 of file SoElement.h.

SoElement* SoElement::getNextFree ( ) const [inline, protected]

Definition at line 190 of file SoElement.h.

SoElement* SoElement::getNextInStack ( ) const [inline, protected]

Definition at line 187 of file SoElement.h.

Referenced by SoCacheElement::getNextCacheElement().

static int SoElement::getNumStackIndices ( ) [inline, static]

Definition at line 134 of file SoElement.h.

int SoElement::getStackIndex ( ) const [inline]

Definition at line 140 of file SoElement.h.

SoType SoElement::getTypeId ( ) const [inline]

Definition at line 124 of file SoElement.h.

virtual void SoElement::init ( SoState state) [virtual]

Called for first element of its kind in stack. Default method does nothing.

Reimplemented in SoBBoxModelMatrixElement, SoCacheElement, SoClipPlaneElement, SoComplexityElement, SoComplexityTypeElement, SoCoordinateElement, SoCreaseAngleElement, SoDrawStyleElement, SoFocalDistanceElement, SoFontNameElement, SoFontSizeElement, SoGLCacheContextElement, SoGLDrawStyleElement, SoGLLazyElement, SoGLLightIdElement, SoGLLinePatternElement, SoGLLineWidthElement, SoGLMaterialIndexElement, SoGLModelMatrixElement, SoGLNormalElement, SoGLPointSizeElement, SoGLRenderPassElement, SoGLShapeHintsElement, SoGLTextureCoordinateElement, SoGLTextureEnabledElement, SoGLTextureImageElement, SoGLUpdateAreaElement, SoGLViewingMatrixElement, SoGLViewportRegionElement, SoLazyElement, SoLightAttenuationElement, SoLinePatternElement, SoLineWidthElement, SoLocalBBoxMatrixElement, SoMaterialBindingElement, SoModelMatrixElement, SoNormalBindingElement, SoNormalElement, SoOverrideElement, SoPickRayElement, SoPickStyleElement, SoPointSizeElement, SoProfileCoordinateElement, SoProfileElement, SoProjectionMatrixElement, SoReplacedElement, SoShapeHintsElement, SoShapeStyleElement, SoSwitchElement, SoTextureCoordinateBindingElement, SoTextureCoordinateElement, SoTextureImageElement, SoTextureMatrixElement, SoTextureQualityElement, SoTextureOverrideElement, SoUnitsElement, SoViewingMatrixElement, SoViewportRegionElement, SoViewVolumeElement, SoWindowElement, SoGLPolygonOffsetElement, SoGLVBOElement, SoPolygonOffsetElement, and SoStencilBitsElement.

static void SoElement::initClass ( ) [static]

Reimplemented in SoAccumulatedElement, SoBBoxModelMatrixElement, SoCacheElement, SoClipPlaneElement, SoComplexityElement, SoComplexityTypeElement, SoCoordinateElement, SoCreaseAngleElement, SoDrawStyleElement, SoFloatElement, SoFocalDistanceElement, SoFontNameElement, SoFontSizeElement, SoGLCacheContextElement, SoGLClipPlaneElement, SoGLCoordinateElement, SoGLDrawStyleElement, SoGLLazyElement, SoGLLightIdElement, SoGLLinePatternElement, SoGLLineWidthElement, SoGLMaterialIndexElement, SoGLModelMatrixElement, SoGLNormalElement, SoGLPointSizeElement, SoGLProjectionMatrixElement, SoGLRenderPassElement, SoGLShapeHintsElement, SoGLTextureCoordinateElement, SoGLTextureEnabledElement, SoGLTextureImageElement, SoGLTextureMatrixElement, SoGLUpdateAreaElement, SoGLViewingMatrixElement, SoGLViewportRegionElement, SoInt32Element, SoLazyElement, SoLightAttenuationElement, SoLinePatternElement, SoLineWidthElement, SoLocalBBoxMatrixElement, SoMaterialBindingElement, SoModelMatrixElement, SoNormalBindingElement, SoNormalElement, SoOverrideElement, SoPickRayElement, SoPickStyleElement, SoPointSizeElement, SoProfileCoordinateElement, SoProfileElement, SoProjectionMatrixElement, SoReplacedElement, SoShapeHintsElement, SoShapeStyleElement, SoSwitchElement, SoTextureCoordinateBindingElement, SoTextureCoordinateElement, SoTextureImageElement, SoTextureMatrixElement, SoTextureQualityElement, SoTextureOverrideElement, SoUnitsElement, SoViewingMatrixElement, SoViewportRegionElement, SoViewVolumeElement, SoWindowElement, SoGLPolygonOffsetElement, SoGLStencilBitsElement, SoGLVBOElement, SoPolygonOffsetElement, and SoStencilBitsElement.

static void SoElement::initElements ( ) [static]
void SoElement::setDepth ( int  dpth) [inline]

Definition at line 143 of file SoElement.h.

void SoElement::setNext ( SoElement nxt) [inline]

Definition at line 144 of file SoElement.h.

void SoElement::setNextFree ( SoElement nxt) [inline]

Definition at line 146 of file SoElement.h.

void SoElement::setNextInStack ( SoElement nxt) [inline]

Definition at line 145 of file SoElement.h.

void SoElement::setStackIndex ( int  index) [inline, protected]

Definition at line 184 of file SoElement.h.

void SoElement::setTypeId ( SoType  id) [inline, protected]

Definition at line 181 of file SoElement.h.


Friends And Related Function Documentation

friend class SoState [friend]

Definition at line 223 of file SoElement.h.


Member Data Documentation

int SoElement::classStackIndex [static, protected]

Definition at line 193 of file SoElement.h.


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