SoState Class Reference
[General]

Traversal state. More...

#include <Inventor/misc/SoState.h>

List of all members.

Classes

class  PushPop
 Push SoState in constructor and pop it in destructor.

Public Member Functions

 SoState (SoAction *action, const SoTypeList &enabledElements)
 ~SoState ()
SoActiongetAction () const
template<typename T >
T * getElement ()
SoElementgetElement (const SoType &type, const int stackIndex)
template<typename T >
const T * getConstElement () const
const SoElementgetConstElement (const SoType &type, const int stackIndex) const
void push ()
void pop ()
void print (FILE *fp)

Deprecated



SoDEPRECATED SoElementgetElement (const int stackIndex)
SoDEPRECATED const SoElementgetConstElement (const int stackIndex) const

Detailed Description

Traversal state.

An SoState collects and holds state while traversing a scene graph. A state is composed of a variety of elements, each of which holds some specific information, such as coordinates or diffuse color of the surface material.

Each element is stored in its own stack so that save and restore can be implemented as push and pop. These stack operations are performed lazily, so that pushing of a value occurs only when the value would be overwritten, for efficiency.


Constructor & Destructor Documentation

SoState::SoState ( SoAction action,
const SoTypeList enabledElements 
)

Constructor.

Takes pointer to action instance this state is part of and a list of type-ids of elements that are enabled.

SoState::~SoState (  ) 

Destructor.


Member Function Documentation

SoAction* SoState::getAction (  )  const [inline]

Returns the action instance the state is part of.

SoDEPRECATED const SoElement* SoState::getConstElement ( const int  stackIndex  )  const

Returns the top (read-only) instance of the given element stack.

Deprecated:

Deprecated since Open Inventor 9000
Use the type safe templated version instead.
const SoElement* SoState::getConstElement ( const SoType type,
const int  stackIndex 
) const [inline]

Returns the top (read-only) instance of the given element stack.


We recommend using the templated type safe version.

template<typename T >
const T* SoState::getConstElement (  )  const [inline]

Returns the top (read-only) instance of the given element.

Warning:
This method doesn't capture dependency on current cache
SoDEPRECATED SoElement* SoState::getElement ( const int  stackIndex  ) 

Returns a writable instance of the element on the top of the stack with the given stack index.

Deprecated:

Deprecated since Open Inventor 9000
Use the templated version instead.
SoElement* SoState::getElement ( const SoType type,
const int  stackIndex 
)

Returns a writable instance of the element on the top of the stack with the given index and type.


We recommend using the templated type safe version.

template<typename T >
T* SoState::getElement (  )  [inline]

Returns a writable instance of the element on the top of the stack with the given type.

void SoState::pop (  ) 

Pops the state, restoring the state to just before the last push().

void SoState::print ( FILE *  fp  ) 

Prints state to file (for debugging).

void SoState::push (  ) 

Pushes (saves) the current state until a pop() restores it.

The push is done lazily: this just increments the depth in the state. When an element is accessed with getElement() and its depth is less than the current depth, it is then pushed individually.


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

Open Inventor Toolkit reference manual, generated on 15 Mar 2023
Copyright © Thermo Fisher Scientific All rights reserved.
http://www.openinventor.com/