.TH "SoState" 3 "Tue Dec 26 2023 17:59:22" "Version 4.0.2" "Coin" \" -*- nroff -*- .ad l .nh .SH NAME SoState \- The \fBSoState\fP class manages the Coin scene graph traversal state data\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBSoState\fP (\fBSoAction\fP *action, \fBconst\fP \fBSoTypeList\fP &\fBenabledelements\fP)" .br .ti -1c .RI "\fB~SoState\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBSoAction\fP * \fBgetAction\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBSoElement\fP * \fBgetElement\fP (\fBconst\fP int \fBstackindex\fP)" .br .ti -1c .RI "\fBconst\fP \fBSoElement\fP * \fBgetConstElement\fP (\fBconst\fP int \fBstackindex\fP) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBpush\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvoid\fP \fBpop\fP (\fBvoid\fP)" .br .ti -1c .RI "\fBvoid\fP \fBprint\fP (\fBFILE\fP *\fBconst\fP \fBfile\fP=\fBstdout\fP) \fBconst\fP" .br .ti -1c .RI "SbBool \fBisElementEnabled\fP (\fBconst\fP int \fBstackindex\fP) \fBconst\fP" .br .ti -1c .RI "int \fBgetDepth\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBvoid\fP \fBsetCacheOpen\fP (\fBconst\fP SbBool \fBflag\fP)" .br .ti -1c .RI "SbBool \fBisCacheOpen\fP (\fBvoid\fP) \fBconst\fP" .br .ti -1c .RI "\fBSoElement\fP * \fBgetElementNoPush\fP (\fBconst\fP int \fBstackindex\fP) \fBconst\fP" .br .in -1c .SH "Detailed Description" .PP The \fBSoState\fP class manages the Coin scene graph traversal state data\&. The \fBSoState\fP class is used by actions derived from the \fBSoAction\fP class\&. It manages the scene graph state as stacks of elements (i\&.e\&. instances of classes derived from \fBSoElement\fP)\&. .PP 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, \fBconst\fP \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 (\fBvoid\fP)" 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 (\fBvoid\fP) const" This method returns the pointer to the action instance given to the constructor\&. .SS "\fBSoElement\fP * SoState::getElement (\fBconst\fP int stackindex)" This method returns a modifiable instance of the element on the top of the stack with the given \fIstackindex\fP\&. Because of lazy programming, this function may need to do some work, so \fBSoState::getConstElement()\fP should be used instead whenever possible\&. .SS "\fBconst\fP \fBSoElement\fP * SoState::getConstElement (\fBconst\fP int stackIndex) 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-effects 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 "\fBvoid\fP SoState::push (\fBvoid\fP)" 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 "\fBvoid\fP SoState::pop (\fBvoid\fP)" 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 "\fBvoid\fP SoState::print (\fBFILE\fP *\fBconst\fP file = \fC\fBstdout\fP\fP) const" This method is just for debugging purposes\&. .SS "SbBool SoState::isElementEnabled (\fBconst\fP int stackindex) 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 (\fBvoid\fP) const" This method returns the current depth of the state stack\&. .PP The depth is 'virtual', not necessarily physical\&. .SS "\fBvoid\fP SoState::setCacheOpen (\fBconst\fP SbBool open)" Controls whether a cache is open\&. .SS "SbBool SoState::isCacheOpen (\fBvoid\fP) const\fC [inline]\fP" Returns whether a cache is open\&. .SH "Author" .PP Generated automatically by Doxygen for Coin from the source code\&.