SoState.h Source File

| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

SoState.h
1 #ifndef COIN_SOSTATE_H
2 #define COIN_SOSTATE_H
3
4 /**************************************************************************\
5 *
6 * This file is part of the Coin 3D visualization library.
7 * Copyright (C) by Kongsberg Oil & Gas Technologies.
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * ("GPL") version 2 as published by the Free Software Foundation.
12 * See the file LICENSE.GPL at the root directory of this source
13 * distribution for additional information about the GNU GPL.
14 *
15 * For using Coin with software that can not be combined with the GNU
16 * GPL, and for taking advantage of the additional benefits of our
17 * support services, please contact Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23 * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24 *
25 \**************************************************************************/
26
27 #include <Inventor/SbBasic.h>
28 #include <stdio.h>
29 #include <assert.h>
30
31 class SoAction;
32 class SoTypeList;
33 class SoElement;
34
35 class COIN_DLL_API SoState {
36 public:
37 SoState(SoAction * action,
38 const SoTypeList & enabledelements);
39 ~SoState(void);
40
41 SoAction * getAction(void) const;
42
43 SoElement * getElement(const int stackindex);
44 const SoElement * getConstElement(const int stackindex) const;
45
46 void push(void);
47 void pop(void);
48
49 void print(FILE * const file = stdout) const;
50
51 SbBool isElementEnabled(const int stackindex) const;
52
53 int getDepth(void) const;
54
55 void setCacheOpen(const SbBool flag);
56 SbBool isCacheOpen(void) const;
57
58 SoElement * getElementNoPush(const int stackindex) const;
59
60 private:
61 SoElement ** stack;
62 int numstacks;
63 SbBool cacheopen;
64 class SoStateP * pimpl;
65 };
66
67 // these methods are used very often, and is therefore inlined
68
69 inline SbBool
70 SoState::isElementEnabled(const int stackindex) const
71 {
72 return (stackindex < this->numstacks) && (this->stack[stackindex] != NULL);
73 }
74
75 inline const SoElement *
76 SoState::getConstElement(const int stackindex) const
77 {
78 assert(this->isElementEnabled(stackindex));
79 return this->stack[stackindex];
80 }
81
82 inline SbBool
83 SoState::isCacheOpen(void) const
84 {
85 return this->cacheopen;
86 }
87
88 inline SoElement *
89 SoState::getElementNoPush(const int stackindex) const
90 {
91 assert(this->isElementEnabled(stackindex));
92 return this->stack[stackindex];
93 }
94
95
96 #endif // !COIN_SOSTATE_H
SoState::isElementEnabled
SbBool isElementEnabled(const int stackindex) const
Definition: SoState.h:70
SoState::getConstElement
const SoElement * getConstElement(const int stackindex) const
Definition: SoState.h:76
SoElement
SoElement is the abstract base class for all elements.
Definition: SoElement.h:34
SoState
The SoState class manages the Coin scenegraph traversal state data.The SoState class is used by actio...
Definition: SoState.h:35
SoTypeList
The SoTypeList class is a container class for arrays of SoType objects.
Definition: SoTypeList.h:30
SoAction
The SoAction class is the base class for all traversal actions.Applying actions is the basic mechanis...
Definition: SoAction.h:68
SoState::isCacheOpen
SbBool isCacheOpen(void) const
Definition: SoState.h:83

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.