.TH "SoState" 3 "Thu May 29 2014" "Version 4.0.0a" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SoState \- .PP The \fBSoState\fP class manages the Coin scenegraph traversal state data\&. .PP The \fBSoState\fP class is used by actions derived from the \fBSoAction\fP class\&. It manages the scenegraph state as stacks of elements (ie instances of classes derived from \fBSoElement\fP)\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBSoState\fP (\fBSoAction\fP *action, const \fBSoTypeList\fP &enabledelements)" .br .ti -1c .RI "\fB~SoState\fP (void)" .br .ti -1c .RI "\fBSoAction\fP * \fBgetAction\fP (void) const " .br .ti -1c .RI "\fBSoElement\fP * \fBgetElement\fP (const int stackindex)" .br .ti -1c .RI "const \fBSoElement\fP * \fBgetConstElement\fP (const int stackindex) const " .br .ti -1c .RI "void \fBpush\fP (void)" .br .ti -1c .RI "void \fBpop\fP (void)" .br .ti -1c .RI "void \fBprint\fP (FILE *const file=stdout) const " .br .ti -1c .RI "SbBool \fBisElementEnabled\fP (const int stackindex) const " .br .ti -1c .RI "int \fBgetDepth\fP (void) const " .br .ti -1c .RI "void \fBsetCacheOpen\fP (const SbBool flag)" .br .ti -1c .RI "SbBool \fBisCacheOpen\fP (void) const " .br .ti -1c .RI "\fBSoElement\fP * \fBgetElementNoPush\fP (const int stackindex) const " .br .in -1c .SH "Detailed Description" .PP The \fBSoState\fP class manages the Coin scenegraph traversal state data\&. .PP The \fBSoState\fP class is used by actions derived from the \fBSoAction\fP class\&. It manages the scenegraph state as stacks of elements (ie instances of classes derived from \fBSoElement\fP)\&. For more information on the inner workings of traversal states in Coin, we recommend the book «The Inventor Toolmaker» (ISBN 0-201-62493-1), also available at SGI's \fConline library\fP\&. Search for 'Toolmaker'\&. .SH "Constructor & Destructor Documentation" .PP .SS "SoState::SoState (\fBSoAction\fP *theAction, const \fBSoTypeList\fP &enabledelements)" The constructor\&. The \fItheAction\fP argument is the action object the state is part of, and the \fIenabledElements\fP argument is an \fBSoTypeList\fP of the elements that are enabled for this action\&. .PP The constructor pushes a default element onto the indexes of all the enabled element stacks\&. \fBSoElement::push()\fP is not called on the initial elements in the \fBSoState\fP stacks, but \fBSoElement::init()\fP is\&. .SS "SoState::~SoState (void)" The destructor\&. .PP Note that when destruction happens, lagging events caused by lazy evaluation won't be performed\&. .SH "Member Function Documentation" .PP .SS "\fBSoAction\fP * SoState::getAction (void) const" This method returns the pointer to the action instance given to the constructor\&. .SS "\fBSoElement\fP * SoState::getElement (const intstackindex)" This method returns a modifyable instance of the element on the top of the stack with the given stackindex\&. Because of lazy programming, this function may need to do some work, so \fBSoState::getConstElement()\fP should be used instead whenever possible\&. .SS "const \fBSoElement\fP * SoState::getConstElement (const intstackIndex) const\fC [inline]\fP" This method returns a pointer to the top element of the given element stack\&. The element is read-only and must not be changed under any circumstances or strange side-effect will occur\&. .PP Note that this function will assert if the element with the given stack identity value is not presently on the state stack\&. To check whether or not an element is present in the stack, use \fBSoState::isElementEnabled()\fP\&. .SS "void SoState::push (void)" This method pushes the state one level down\&. This saves the state so it can be changed and later restored to this state by calling \fBSoState::pop()\fP\&. .PP The push and pop mechanism is performed lazily for efficiency reasons (avoids a lot of memory allocation and copying)\&. Only when a state element is actually going to be changed, that element will be pushed for real\&. .SS "void SoState::pop (void)" This method pops the state to restore it to a previous state\&. Pops are performed eagerly but the code is very tight so there is no reason to worry about efficiency\&. .SS "void SoState::print (FILE *constfile = \fCstdout\fP) const" This method is just for debugging purposes\&. .SS "SbBool SoState::isElementEnabled (const intstackindex) const\fC [inline]\fP" This method returns TRUE if the element with the given element stack index is enabled, and FALSE otherwise\&. .SS "int SoState::getDepth (void) const" This method returns the current depth of the state stack\&. .PP The depth is 'virtual', not necessarily physical\&. .SS "void SoState::setCacheOpen (const SbBoolopen)" Controls whether a cache is open\&. .SS "SbBool SoState::isCacheOpen (void) const\fC [inline]\fP" Returns whether a cache is open\&. .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.