summaryrefslogtreecommitdiff
path: root/inc/TopoDS.lxx
blob: 8764a5fd341a2fd6da5d3f273dfdbb5c11bce58a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
// File:	TopoDS.lxx
// Created:	Mon Mar  8 10:41:53 1993
// Author:	Remi LEQUETTE
//		<rle@phobox>


#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_TypeMismatch.hxx>

// return True if the Shape has not the expected type
inline static Standard_Boolean TopoDS_Mismatch(const TopoDS_Shape& S,
					       const TopAbs_ShapeEnum T)
{
  return S.IsNull() ? Standard_False : S.ShapeType() != T;
}

//=======================================================================
//function : Vertex
//purpose  : 
//=======================================================================

inline const TopoDS_Vertex&  TopoDS::Vertex(const TopoDS_Shape& S)
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_VERTEX),"TopoDS::Vertex");
  return *(TopoDS_Vertex*) &S;
}


//=======================================================================
//function : Vertex
//purpose  : 
//=======================================================================

inline TopoDS_Vertex& TopoDS::Vertex(TopoDS_Shape& S) 
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_VERTEX),"TopoDS::Vertex");
  return *(TopoDS_Vertex*) &S;
}


//=======================================================================
//function : Edge
//purpose  : 
//=======================================================================

inline const TopoDS_Edge&  TopoDS::Edge(const TopoDS_Shape& S)
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_EDGE),"TopoDS::Edge");
  return *(TopoDS_Edge*) &S;
}


//=======================================================================
//function : Edge
//purpose  : 
//=======================================================================

inline TopoDS_Edge& TopoDS::Edge(TopoDS_Shape& S) 
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_EDGE),"TopoDS::Edge");
  return *(TopoDS_Edge*) &S;
}


//=======================================================================
//function : Wire
//purpose  : 
//=======================================================================

inline const TopoDS_Wire&  TopoDS::Wire(const TopoDS_Shape& S)
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_WIRE),"TopoDS::Wire");
  return *(TopoDS_Wire*) &S;
}


//=======================================================================
//function : Wire
//purpose  : 
//=======================================================================

inline TopoDS_Wire& TopoDS::Wire(TopoDS_Shape& S) 
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_WIRE),"TopoDS::Wire");
  return *(TopoDS_Wire*) &S;
}


//=======================================================================
//function : Face
//purpose  : 
//=======================================================================

inline const TopoDS_Face&  TopoDS::Face(const TopoDS_Shape& S)
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_FACE),"TopoDS::Face");
  return *(TopoDS_Face*) &S;
}


//=======================================================================
//function : Face
//purpose  : 
//=======================================================================

inline TopoDS_Face& TopoDS::Face(TopoDS_Shape& S) 
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_FACE),"TopoDS::Face");
  return *(TopoDS_Face*) &S;
}


//=======================================================================
//function : Shell
//purpose  : 
//=======================================================================

inline const TopoDS_Shell&  TopoDS::Shell(const TopoDS_Shape& S)
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_SHELL),"TopoDS::Shell");
  return *(TopoDS_Shell*) &S;
}


//=======================================================================
//function : Shell
//purpose  : 
//=======================================================================

inline TopoDS_Shell& TopoDS::Shell(TopoDS_Shape& S) 
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_SHELL),"TopoDS::Shell");
  return *(TopoDS_Shell*) &S;
}


//=======================================================================
//function : Solid
//purpose  : 
//=======================================================================

inline const TopoDS_Solid&  TopoDS::Solid(const TopoDS_Shape& S)
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_SOLID),"TopoDS::Solid");
  return *(TopoDS_Solid*) &S;
}


//=======================================================================
//function : Solid
//purpose  : 
//=======================================================================

inline TopoDS_Solid& TopoDS::Solid(TopoDS_Shape& S) 
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_SOLID),"TopoDS::Solid");
  return *(TopoDS_Solid*) &S;
}


//=======================================================================
//function : CompSolid
//purpose  : 
//=======================================================================

inline const TopoDS_CompSolid&  TopoDS::CompSolid(const TopoDS_Shape& S)
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_COMPSOLID),"TopoDS::CompSolid");
  return *(TopoDS_CompSolid*) &S;
}


//=======================================================================
//function : CompSolid
//purpose  : 
//=======================================================================

inline TopoDS_CompSolid& TopoDS::CompSolid(TopoDS_Shape& S) 
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_COMPSOLID),"TopoDS::CompSolid");
  return *(TopoDS_CompSolid*) &S;
}


//=======================================================================
//function : Compound
//purpose  : 
//=======================================================================

inline const TopoDS_Compound&  TopoDS::Compound(const TopoDS_Shape& S)
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_COMPOUND),"TopoDS::Compound");
  return *(TopoDS_Compound*) &S;
}


//=======================================================================
//function : Compound
//purpose  : 
//=======================================================================

inline TopoDS_Compound& TopoDS::Compound(TopoDS_Shape& S) 
{
  Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_COMPOUND),"TopoDS::Compound");
  return *(TopoDS_Compound*) &S;
}