Warnings on vc14 were eliminated
[occt.git] / src / TopoDS / TopoDS.lxx
CommitLineData
b311480e 1// Created on: 1993-03-08
2// Created by: Remi LEQUETTE
3// Copyright (c) 1993-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17#include <TopAbs_ShapeEnum.hxx>
18#include <TopoDS_Shape.hxx>
19#include <Standard_TypeMismatch.hxx>
20
21// return True if the Shape has not the expected type
22inline static Standard_Boolean TopoDS_Mismatch(const TopoDS_Shape& S,
23 const TopAbs_ShapeEnum T)
24{
25 return S.IsNull() ? Standard_False : S.ShapeType() != T;
26}
27
28//=======================================================================
29//function : Vertex
30//purpose :
31//=======================================================================
32
33inline const TopoDS_Vertex& TopoDS::Vertex(const TopoDS_Shape& S)
34{
35 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_VERTEX),"TopoDS::Vertex");
36 return *(TopoDS_Vertex*) &S;
37}
38
39
40//=======================================================================
41//function : Vertex
42//purpose :
43//=======================================================================
44
45inline TopoDS_Vertex& TopoDS::Vertex(TopoDS_Shape& S)
46{
47 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_VERTEX),"TopoDS::Vertex");
48 return *(TopoDS_Vertex*) &S;
49}
50
51
52//=======================================================================
53//function : Edge
54//purpose :
55//=======================================================================
56
57inline const TopoDS_Edge& TopoDS::Edge(const TopoDS_Shape& S)
58{
59 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_EDGE),"TopoDS::Edge");
60 return *(TopoDS_Edge*) &S;
61}
62
63
64//=======================================================================
65//function : Edge
66//purpose :
67//=======================================================================
68
69inline TopoDS_Edge& TopoDS::Edge(TopoDS_Shape& S)
70{
71 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_EDGE),"TopoDS::Edge");
72 return *(TopoDS_Edge*) &S;
73}
74
75
76//=======================================================================
77//function : Wire
78//purpose :
79//=======================================================================
80
81inline const TopoDS_Wire& TopoDS::Wire(const TopoDS_Shape& S)
82{
83 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_WIRE),"TopoDS::Wire");
84 return *(TopoDS_Wire*) &S;
85}
86
87
88//=======================================================================
89//function : Wire
90//purpose :
91//=======================================================================
92
93inline TopoDS_Wire& TopoDS::Wire(TopoDS_Shape& S)
94{
95 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_WIRE),"TopoDS::Wire");
96 return *(TopoDS_Wire*) &S;
97}
98
99
100//=======================================================================
101//function : Face
102//purpose :
103//=======================================================================
104
105inline const TopoDS_Face& TopoDS::Face(const TopoDS_Shape& S)
106{
107 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_FACE),"TopoDS::Face");
108 return *(TopoDS_Face*) &S;
109}
110
111
112//=======================================================================
113//function : Face
114//purpose :
115//=======================================================================
116
117inline TopoDS_Face& TopoDS::Face(TopoDS_Shape& S)
118{
119 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_FACE),"TopoDS::Face");
120 return *(TopoDS_Face*) &S;
121}
122
123
124//=======================================================================
125//function : Shell
126//purpose :
127//=======================================================================
128
129inline const TopoDS_Shell& TopoDS::Shell(const TopoDS_Shape& S)
130{
131 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_SHELL),"TopoDS::Shell");
132 return *(TopoDS_Shell*) &S;
133}
134
135
136//=======================================================================
137//function : Shell
138//purpose :
139//=======================================================================
140
141inline TopoDS_Shell& TopoDS::Shell(TopoDS_Shape& S)
142{
143 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_SHELL),"TopoDS::Shell");
144 return *(TopoDS_Shell*) &S;
145}
146
147
148//=======================================================================
149//function : Solid
150//purpose :
151//=======================================================================
152
153inline const TopoDS_Solid& TopoDS::Solid(const TopoDS_Shape& S)
154{
155 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_SOLID),"TopoDS::Solid");
156 return *(TopoDS_Solid*) &S;
157}
158
159
160//=======================================================================
161//function : Solid
162//purpose :
163//=======================================================================
164
165inline TopoDS_Solid& TopoDS::Solid(TopoDS_Shape& S)
166{
167 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_SOLID),"TopoDS::Solid");
168 return *(TopoDS_Solid*) &S;
169}
170
171
172//=======================================================================
173//function : CompSolid
174//purpose :
175//=======================================================================
176
177inline const TopoDS_CompSolid& TopoDS::CompSolid(const TopoDS_Shape& S)
178{
179 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_COMPSOLID),"TopoDS::CompSolid");
180 return *(TopoDS_CompSolid*) &S;
181}
182
183
184//=======================================================================
185//function : CompSolid
186//purpose :
187//=======================================================================
188
189inline TopoDS_CompSolid& TopoDS::CompSolid(TopoDS_Shape& S)
190{
191 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_COMPSOLID),"TopoDS::CompSolid");
192 return *(TopoDS_CompSolid*) &S;
193}
194
195
196//=======================================================================
197//function : Compound
198//purpose :
199//=======================================================================
200
201inline const TopoDS_Compound& TopoDS::Compound(const TopoDS_Shape& S)
202{
203 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_COMPOUND),"TopoDS::Compound");
204 return *(TopoDS_Compound*) &S;
205}
206
207
208//=======================================================================
209//function : Compound
210//purpose :
211//=======================================================================
212
213inline TopoDS_Compound& TopoDS::Compound(TopoDS_Shape& S)
214{
215 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_COMPOUND),"TopoDS::Compound");
216 return *(TopoDS_Compound*) &S;
217}
218
219