http://www.coin3d.org/
http://www.kongsberg.com/kogt/
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
include
Inventor
elements
SoElement.h
1
#ifndef COIN_SOELEMENT_H
2
#define COIN_SOELEMENT_H
3
4
/**************************************************************************\
5
* Copyright (c) Kongsberg Oil & Gas Technologies AS
6
* All rights reserved.
7
*
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted provided that the following conditions are
10
* met:
11
*
12
* Redistributions of source code must retain the above copyright notice,
13
* this list of conditions and the following disclaimer.
14
*
15
* Redistributions in binary form must reproduce the above copyright
16
* notice, this list of conditions and the following disclaimer in the
17
* documentation and/or other materials provided with the distribution.
18
*
19
* Neither the name of the copyright holder nor the names of its
20
* contributors may be used to endorse or promote products derived from
21
* this software without specific prior written permission.
22
*
23
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
\**************************************************************************/
35
36
#include <Inventor/SbBasic.h>
37
#include <
Inventor/SoType.h
>
38
#include <Inventor/misc/SoState.h>
39
#include <stdio.h>
40
41
class
SoNode
;
42
43
class
COIN_DLL_API
SoElement
{
44
public
:
45
static
void
initClass(
void
);
46
47
static
SoType
getClassTypeId(
void
);
48
static
int
getClassStackIndex(
void
);
49
const
SoType
getTypeId(
void
)
const
;
50
int
getStackIndex(
void
)
const
;
51
52
virtual
void
init(
SoState
* state);
53
54
virtual
void
push(
SoState
* state);
55
virtual
void
pop(
SoState
* state,
const
SoElement
* prevTopElement);
56
57
virtual
SbBool matches(
const
SoElement
* element)
const
= 0;
58
virtual
SoElement
* copyMatchInfo(
void
)
const
= 0;
59
60
static
void
initElements(
void
);
// only for base class (SoElement)
61
62
static
int
getNumStackIndices(
void
);
63
static
SoType
getIdFromStackIndex(
const
int
stackIndex);
64
65
void
setDepth(
const
int
depth);
66
67
int
getDepth(
void
)
const
;
68
69
virtual
void
print(FILE * file = stdout)
const
;
70
virtual
~
SoElement
();
71
72
protected
:
73
SoElement
(
void
);
74
static
int
classStackIndex
;
75
76
static
SoElement
* getElement(
SoState
*
const
state,
const
int
stackIndex);
77
static
const
SoElement
* getConstElement(
SoState
*
const
state,
const
int
stackIndex);
78
79
void
capture(
SoState
*
const
state)
const
;
80
81
virtual
void
captureThis(
SoState
* state)
const
;
82
83
void
setTypeId(
const
SoType
typeId);
84
void
setStackIndex(
const
int
index);
85
86
SoType
typeId
;
87
int
stackIndex
;
88
89
static
int
createStackIndex(
const
SoType
id
);
90
static
SoTypeList
*
stackToType
;
91
92
int
depth
;
93
94
SoElement
* getNextInStack(
void
)
const
;
95
SoElement
* getNextFree(
void
)
const
;
96
97
private
:
98
99
static
SoType
classTypeId;
100
101
friend
class
SoState
;
// FIXME: bad design. 19990629 mortene.
102
static
void
cleanup(
void
);
103
SoElement
* nextup;
104
SoElement
* nextdown;
105
};
106
107
// inlined methods
108
109
inline
SoElement
*
110
SoElement::getElement
(
SoState
*
const
state,
111
const
int
stackIndex)
112
{
113
return
state->
getElement
(stackIndex);
114
}
115
116
inline
void
117
SoElement::capture
(
SoState
*
const
state)
const
118
{
119
if
(state->
isCacheOpen
()) this->
captureThis
(state);
120
}
121
122
inline
const
SoElement
*
123
SoElement::getConstElement
(
SoState
*
const
state,
124
const
int
stackIndex)
125
{
126
const
SoElement
* element = state->
getConstElement
(stackIndex);
127
element->
capture
(state);
128
return
element;
129
}
130
131
#endif // !COIN_SOELEMENT_H
Copyright © by
Kongsberg Oil & Gas Technologies
. All rights reserved.
Generated on Wed May 29 2013 18:21:20 for Coin by
Doxygen
1.8.1.2.