a57ba2f8ef8b5de51ba00fbb09ddef0ba2b257a5
[occt.git] / src / TopoDS / TopoDS_TShape.lxx
1 // Created on: 1991-03-27
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1991-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <TopAbs.hxx>
18 #include <TopoDS_Shape.hxx>
19 #include <TopoDS_ListIteratorOfListOfShape.hxx>
20
21 // Defined mask values
22 #define TopoDS_TShape_Flags_Free       (1<<0)
23 #define TopoDS_TShape_Flags_Modified   (1<<1)
24 #define TopoDS_TShape_Flags_Checked    (1<<2)
25 #define TopoDS_TShape_Flags_Orientable (1<<3)
26 #define TopoDS_TShape_Flags_Closed     (1<<4)
27 #define TopoDS_TShape_Flags_Infinite   (1<<5)
28 #define TopoDS_TShape_Flags_Convex     (1<<6)
29
30
31 //=======================================================================
32 //function : TopoDS_TShape
33 //purpose  : Constructor, Empty TShape
34 //=======================================================================
35
36 inline TopoDS_TShape::TopoDS_TShape()
37  : myFlags(TopoDS_TShape_Flags_Free |
38            TopoDS_TShape_Flags_Modified |
39            TopoDS_TShape_Flags_Orientable)
40 {
41 }
42
43 //=======================================================================
44 //function : Free
45 //purpose  : 
46 //=======================================================================
47
48 inline Standard_Boolean TopoDS_TShape::Free() const
49 {
50   return ((myFlags & TopoDS_TShape_Flags_Free) != 0);
51 }
52
53 //=======================================================================
54 //function : Free
55 //purpose  : 
56 //=======================================================================
57
58 inline void TopoDS_TShape::Free(const Standard_Boolean F)
59 {
60   if (F) myFlags |=  TopoDS_TShape_Flags_Free;
61   else   myFlags &= ~TopoDS_TShape_Flags_Free;
62 }
63
64 //=======================================================================
65 //function : Modified
66 //purpose  : 
67 //=======================================================================
68
69 inline Standard_Boolean TopoDS_TShape::Modified() const
70 {
71   return ((myFlags & TopoDS_TShape_Flags_Modified) != 0);
72 }
73
74 //=======================================================================
75 //function : Modified
76 //purpose  : 
77 //=======================================================================
78
79 inline void TopoDS_TShape::Modified(const Standard_Boolean M)
80 {
81   if (M)
82   {
83     myFlags |= TopoDS_TShape_Flags_Modified;
84     // When a TShape is modified it is also unchecked
85     myFlags &= ~TopoDS_TShape_Flags_Checked;
86   }
87   else myFlags &= ~TopoDS_TShape_Flags_Modified;
88 }
89
90 //=======================================================================
91 //function : Checked
92 //purpose  : 
93 //=======================================================================
94
95 inline Standard_Boolean TopoDS_TShape::Checked() const
96 {
97   return ((myFlags & TopoDS_TShape_Flags_Checked) != 0);
98 }
99
100 //=======================================================================
101 //function : Checked
102 //purpose  : 
103 //=======================================================================
104
105 inline void TopoDS_TShape::Checked(const Standard_Boolean M)
106 {
107   if (M) myFlags |=  TopoDS_TShape_Flags_Checked;
108   else   myFlags &= ~TopoDS_TShape_Flags_Checked;
109 }
110
111 //=======================================================================
112 //function : Orientable
113 //purpose  : 
114 //=======================================================================
115
116 inline Standard_Boolean TopoDS_TShape::Orientable() const
117 {
118   return ((myFlags & TopoDS_TShape_Flags_Orientable) != 0);
119 }
120
121 //=======================================================================
122 //function : Orientable
123 //purpose  : 
124 //=======================================================================
125
126 inline void TopoDS_TShape::Orientable(const Standard_Boolean M)
127 {
128   if (M) myFlags |=  TopoDS_TShape_Flags_Orientable;
129   else   myFlags &= ~TopoDS_TShape_Flags_Orientable;
130 }
131
132 //=======================================================================
133 //function : Closed
134 //purpose  : 
135 //=======================================================================
136
137 inline Standard_Boolean TopoDS_TShape::Closed() const
138 {
139   return ((myFlags & TopoDS_TShape_Flags_Closed) != 0);
140 }
141
142 //=======================================================================
143 //function : Closed
144 //purpose  : 
145 //=======================================================================
146
147 inline void TopoDS_TShape::Closed(const Standard_Boolean M)
148 {
149   if (M) myFlags |=  TopoDS_TShape_Flags_Closed;
150   else   myFlags &= ~TopoDS_TShape_Flags_Closed;
151 }
152
153 //=======================================================================
154 //function : Infinite
155 //purpose  : 
156 //=======================================================================
157
158 inline Standard_Boolean TopoDS_TShape::Infinite() const
159 {
160   return ((myFlags & TopoDS_TShape_Flags_Infinite) != 0);
161 }
162
163 //=======================================================================
164 //function : Infinite
165 //purpose  : 
166 //=======================================================================
167
168 inline void TopoDS_TShape::Infinite(const Standard_Boolean M)
169 {
170   if (M) myFlags |=  TopoDS_TShape_Flags_Infinite;
171   else   myFlags &= ~TopoDS_TShape_Flags_Infinite;
172 }
173
174 //=======================================================================
175 //function : Convex
176 //purpose  : 
177 //=======================================================================
178
179 inline Standard_Boolean TopoDS_TShape::Convex() const
180 {
181   return ((myFlags & TopoDS_TShape_Flags_Convex) != 0);
182 }
183
184 //=======================================================================
185 //function : Convex
186 //purpose  : 
187 //=======================================================================
188
189 inline void TopoDS_TShape::Convex(const Standard_Boolean M)
190 {
191   if (M) myFlags |=  TopoDS_TShape_Flags_Convex;
192   else   myFlags &= ~TopoDS_TShape_Flags_Convex;
193 }
194
195 //=======================================================================
196 //function : Shapes
197 //purpose  : 
198 //=======================================================================
199
200 inline const TopoDS_ListOfShape& TopoDS_TShape::Shapes() const
201 {
202   return myShapes;
203 }
204
205 //=======================================================================
206 //function : ChangeShapes
207 //purpose  : 
208 //=======================================================================
209
210 inline TopoDS_ListOfShape& TopoDS_TShape::ChangeShapes()
211 {
212   return myShapes;
213 }