00001 #ifndef COIN_SOSTATE_H
00002 #define COIN_SOSTATE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <Inventor/SbBasic.h>
00028 #include <stdio.h>
00029 #include <assert.h>
00030
00031 class SoAction;
00032 class SoTypeList;
00033 class SoElement;
00034
00035 class COIN_DLL_API SoState {
00036 public:
00037 SoState(SoAction * action,
00038 const SoTypeList & enabledelements);
00039 ~SoState(void);
00040
00041 SoAction * getAction(void) const;
00042
00043 SoElement * getElement(const int stackindex);
00044 const SoElement * getConstElement(const int stackindex) const;
00045
00046 void push(void);
00047 void pop(void);
00048
00049 void print(FILE * const file = stdout) const;
00050
00051 SbBool isElementEnabled(const int stackindex) const;
00052
00053 int getDepth(void) const;
00054
00055 void setCacheOpen(const SbBool flag);
00056 SbBool isCacheOpen(void) const;
00057
00058 SoElement * getElementNoPush(const int stackindex) const;
00059
00060 private:
00061 SoElement ** stack;
00062 int numstacks;
00063 SbBool cacheopen;
00064 class SoStateP * pimpl;
00065 };
00066
00067
00068
00069 inline SbBool
00070 SoState::isElementEnabled(const int stackindex) const
00071 {
00072 return (stackindex < this->numstacks) && (this->stack[stackindex] != NULL);
00073 }
00074
00075 inline const SoElement *
00076 SoState::getConstElement(const int stackindex) const
00077 {
00078 assert(this->isElementEnabled(stackindex));
00079 return this->stack[stackindex];
00080 }
00081
00082 inline SbBool
00083 SoState::isCacheOpen(void) const
00084 {
00085 return this->cacheopen;
00086 }
00087
00088 inline SoElement *
00089 SoState::getElementNoPush(const int stackindex) const
00090 {
00091 assert(this->isElementEnabled(stackindex));
00092 return this->stack[stackindex];
00093 }
00094
00095
00096 #endif // !COIN_SOSTATE_H