52#include <Inventor/SoLists.h>
97 return static_cast<T*
>(
getElement(T::getClassTypeId(), T::getClassStackIndex()));
114 return static_cast<const T*
>(
getConstElement(T::getClassTypeId(), T::getClassStackIndex(),
true));
162 PushPop(
SoState* state) : m_state(state) { m_state->push(); }
163 ~PushPop() { m_state->pop(); }
170 inline SbBool isElementEnabled(
const SoType& type,
const int stackIndex,
SbBool checkType = TRUE)
const
172 if ( !s_checkStateElementsType )
173 return isElementEnabled(stackIndex);
174 return isElementEnabledChecked(type,stackIndex,checkType);
178 inline SbBool isElementEnabled(
const int stackIndex)
const
180 if (m_stack && (stackIndex < m_numStacks))
181 return (m_stack[stackIndex] != NULL);
187 inline int getDepth()
const
193 inline void setCacheOpen(
const SbBool flag)
194 { m_cacheOpen = flag; }
196 inline SbBool isCacheOpen()
const
197 {
return m_cacheOpen; }
203 inline bool trackDependencies(
bool flag)
205 bool oldValue = m_trackElementsDependencies;
206 m_trackElementsDependencies = flag;
211 bool isTrackingDependencies()
const;
220 inline T* getElementNoPush()
const
222 return static_cast<T*
>(getElementNoPush(T::getClassTypeId(), T::getClassStackIndex()));
231 inline SoElement* getElementNoPush(
SoType type,
const int stackIndex)
const
240 void popElement(
const int classStackIndex) ;
251 const SoElement* elt = stackIndex < m_numStacks ? m_stack[stackIndex] : NULL;
254 enableMissingElement(type, stackIndex, checkType);
255 return m_stack[stackIndex];
261 inline const SoElement* getTopElement()
const {
return m_topElement; }
271 SoElement* getElementNoPush(
const int stackIndex)
const;
282 void enableSendToGL(
bool enable);
289 bool isSendToGLEnabled()
const;
294 SbBool isElementEnabledChecked(
const SoType& type,
const int stackIndex,
SbBool checkType = TRUE)
const;
300 void createDepth0Element(
int stackIndex);
303 void displayStack(
const char *funcStr);
306 void checkStateConsistency(
const char *funcStr);
309 void enableMissingElement(
const SoType& type,
int stackIndex,
bool checkType)
const;
318 bool m_enableSendToGL;
319 bool m_trackElementsDependencies;
322 bool m_actionNeedDependencies;
325 bool m_usingGLAction;
328 static int s_checkStateConsistency;
329 static int s_displayStateElements;
330 static int s_checkStateElementsType;
331 static bool s_printStateDepth;
332 static FILE* s_stateDepthFile;
Abstract base class for all actions.
Abstract base class for all state elements.
T * getElement()
Returns a writable instance of the element on the top of the stack with the given type.
void push()
Pushes (saves) the current state until a pop() restores it.
SoDEPRECATED SoElement * getElement(const int stackIndex)
Returns a writable instance of the element on the top of the stack with the given stack index.
SoAction * getAction() const
Returns the action instance the state is part of.
const T * getConstElement() const
Returns the top (read-only) instance of the given element.
void print(FILE *fp)
Prints state to file (for debugging)
SoState(SoAction *action, const SoTypeList &enabledElements)
Constructor.
void pop()
Pops the state, restoring the state to just before the last push().
SoDEPRECATED const SoElement * getConstElement(const int stackIndex) const
Returns the top (read-only) instance of the given element stack.
SoElement * 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.
const SoElement * getConstElement(const SoType &type, const int stackIndex) const
Returns the top (read-only) instance of the given element stack.
Stores runtime type information.
Maintains a list of SoTypes.