Warning, /include/opencascade/TopoDS.lxx is written in an unsupported language. File is not indexed.
0001 // Created on: 1993-03-08
0002 // Created by: Remi LEQUETTE
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016
0017 #include <TopAbs_ShapeEnum.hxx>
0018 #include <TopoDS_Shape.hxx>
0019 #include <Standard_TypeMismatch.hxx>
0020
0021 // return True if the Shape has not the expected type
0022 inline static Standard_Boolean TopoDS_Mismatch(const TopoDS_Shape& S,
0023 const TopAbs_ShapeEnum T)
0024 {
0025 return S.IsNull() ? Standard_False : S.ShapeType() != T;
0026 }
0027
0028 //=======================================================================
0029 //function : Vertex
0030 //purpose :
0031 //=======================================================================
0032
0033 inline const TopoDS_Vertex& TopoDS::Vertex(const TopoDS_Shape& S)
0034 {
0035 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_VERTEX),"TopoDS::Vertex");
0036 return *(TopoDS_Vertex*) &S;
0037 }
0038
0039
0040 //=======================================================================
0041 //function : Vertex
0042 //purpose :
0043 //=======================================================================
0044
0045 inline TopoDS_Vertex& TopoDS::Vertex(TopoDS_Shape& S)
0046 {
0047 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_VERTEX),"TopoDS::Vertex");
0048 return *(TopoDS_Vertex*) &S;
0049 }
0050
0051
0052 //=======================================================================
0053 //function : Edge
0054 //purpose :
0055 //=======================================================================
0056
0057 inline const TopoDS_Edge& TopoDS::Edge(const TopoDS_Shape& S)
0058 {
0059 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_EDGE),"TopoDS::Edge");
0060 return *(TopoDS_Edge*) &S;
0061 }
0062
0063
0064 //=======================================================================
0065 //function : Edge
0066 //purpose :
0067 //=======================================================================
0068
0069 inline TopoDS_Edge& TopoDS::Edge(TopoDS_Shape& S)
0070 {
0071 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_EDGE),"TopoDS::Edge");
0072 return *(TopoDS_Edge*) &S;
0073 }
0074
0075
0076 //=======================================================================
0077 //function : Wire
0078 //purpose :
0079 //=======================================================================
0080
0081 inline const TopoDS_Wire& TopoDS::Wire(const TopoDS_Shape& S)
0082 {
0083 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_WIRE),"TopoDS::Wire");
0084 return *(TopoDS_Wire*) &S;
0085 }
0086
0087
0088 //=======================================================================
0089 //function : Wire
0090 //purpose :
0091 //=======================================================================
0092
0093 inline TopoDS_Wire& TopoDS::Wire(TopoDS_Shape& S)
0094 {
0095 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_WIRE),"TopoDS::Wire");
0096 return *(TopoDS_Wire*) &S;
0097 }
0098
0099
0100 //=======================================================================
0101 //function : Face
0102 //purpose :
0103 //=======================================================================
0104
0105 inline const TopoDS_Face& TopoDS::Face(const TopoDS_Shape& S)
0106 {
0107 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_FACE),"TopoDS::Face");
0108 return *(TopoDS_Face*) &S;
0109 }
0110
0111
0112 //=======================================================================
0113 //function : Face
0114 //purpose :
0115 //=======================================================================
0116
0117 inline TopoDS_Face& TopoDS::Face(TopoDS_Shape& S)
0118 {
0119 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_FACE),"TopoDS::Face");
0120 return *(TopoDS_Face*) &S;
0121 }
0122
0123
0124 //=======================================================================
0125 //function : Shell
0126 //purpose :
0127 //=======================================================================
0128
0129 inline const TopoDS_Shell& TopoDS::Shell(const TopoDS_Shape& S)
0130 {
0131 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_SHELL),"TopoDS::Shell");
0132 return *(TopoDS_Shell*) &S;
0133 }
0134
0135
0136 //=======================================================================
0137 //function : Shell
0138 //purpose :
0139 //=======================================================================
0140
0141 inline TopoDS_Shell& TopoDS::Shell(TopoDS_Shape& S)
0142 {
0143 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_SHELL),"TopoDS::Shell");
0144 return *(TopoDS_Shell*) &S;
0145 }
0146
0147
0148 //=======================================================================
0149 //function : Solid
0150 //purpose :
0151 //=======================================================================
0152
0153 inline const TopoDS_Solid& TopoDS::Solid(const TopoDS_Shape& S)
0154 {
0155 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_SOLID),"TopoDS::Solid");
0156 return *(TopoDS_Solid*) &S;
0157 }
0158
0159
0160 //=======================================================================
0161 //function : Solid
0162 //purpose :
0163 //=======================================================================
0164
0165 inline TopoDS_Solid& TopoDS::Solid(TopoDS_Shape& S)
0166 {
0167 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_SOLID),"TopoDS::Solid");
0168 return *(TopoDS_Solid*) &S;
0169 }
0170
0171
0172 //=======================================================================
0173 //function : CompSolid
0174 //purpose :
0175 //=======================================================================
0176
0177 inline const TopoDS_CompSolid& TopoDS::CompSolid(const TopoDS_Shape& S)
0178 {
0179 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_COMPSOLID),"TopoDS::CompSolid");
0180 return *(TopoDS_CompSolid*) &S;
0181 }
0182
0183
0184 //=======================================================================
0185 //function : CompSolid
0186 //purpose :
0187 //=======================================================================
0188
0189 inline TopoDS_CompSolid& TopoDS::CompSolid(TopoDS_Shape& S)
0190 {
0191 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_COMPSOLID),"TopoDS::CompSolid");
0192 return *(TopoDS_CompSolid*) &S;
0193 }
0194
0195
0196 //=======================================================================
0197 //function : Compound
0198 //purpose :
0199 //=======================================================================
0200
0201 inline const TopoDS_Compound& TopoDS::Compound(const TopoDS_Shape& S)
0202 {
0203 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_COMPOUND),"TopoDS::Compound");
0204 return *(TopoDS_Compound*) &S;
0205 }
0206
0207
0208 //=======================================================================
0209 //function : Compound
0210 //purpose :
0211 //=======================================================================
0212
0213 inline TopoDS_Compound& TopoDS::Compound(TopoDS_Shape& S)
0214 {
0215 Standard_TypeMismatch_Raise_if(TopoDS_Mismatch(S,TopAbs_COMPOUND),"TopoDS::Compound");
0216 return *(TopoDS_Compound*) &S;
0217 }
0218
0219