b311480e |
1 | // Created on: 1997-10-22 |
2 | // Created by: Jean Yves LEBEY |
3 | // Copyright (c) 1997-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 | |
0797d9d3 |
17 | #ifdef OCCT_DEBUG |
7fd59977 |
18 | |
19 | #include <TopOpeBRepTool_STATE.hxx> |
20 | |
21 | TopOpeBRepTool_STATE::TopOpeBRepTool_STATE |
22 | (const char* name, const Standard_Boolean b) : |
23 | myin(Standard_False),myout(Standard_False), |
24 | myon(Standard_False),myunknown(Standard_False), |
25 | myonetrue(Standard_False) |
26 | { |
27 | strcpy(myname,name); |
28 | Set(b); |
29 | } |
30 | |
31 | void TopOpeBRepTool_STATE::Set(const Standard_Boolean b) |
32 | { |
33 | Set(TopAbs_IN,b); |
34 | Set(TopAbs_OUT,b); |
35 | Set(TopAbs_ON,b); |
36 | Set(TopAbs_UNKNOWN,b); |
37 | } |
38 | |
39 | void TopOpeBRepTool_STATE::Set |
40 | (const TopAbs_State S,const Standard_Boolean b) |
41 | { |
42 | switch(S) { |
43 | case TopAbs_IN : myin = b; break; |
44 | case TopAbs_OUT : myout = b; break; |
45 | case TopAbs_ON : myon = b; break; |
46 | case TopAbs_UNKNOWN : myunknown = b; break; |
47 | } |
48 | myonetrue = myin || myout || myon || myunknown; |
49 | } |
50 | |
51 | void TopOpeBRepTool_STATE::Set(const Standard_Boolean b, |
52 | Standard_Integer n, char** a) |
53 | { |
54 | if (!n) Set(b); |
55 | else { |
56 | Set(Standard_False); |
57 | for (Standard_Integer i=0; i < n; i++) { |
58 | const char *p = a[i]; |
59 | if ( !strcmp(p,"IN") ) Set(TopAbs_IN,b); |
60 | else if ( !strcmp(p,"OUT") ) Set(TopAbs_OUT,b); |
61 | else if ( !strcmp(p,"ON") ) Set(TopAbs_ON,b); |
62 | else if ( !strcmp(p,"UNKNOWN") ) Set(TopAbs_UNKNOWN,b); |
63 | } |
64 | Print(); |
65 | } |
66 | } |
67 | |
68 | Standard_Boolean TopOpeBRepTool_STATE::Get(const TopAbs_State S) |
69 | { |
1d47d8d0 |
70 | Standard_Boolean b = Standard_False; |
7fd59977 |
71 | switch(S) { |
72 | case TopAbs_IN : b = myin; break; |
73 | case TopAbs_OUT : b = myout; break; |
74 | case TopAbs_ON : b = myon; break; |
75 | case TopAbs_UNKNOWN : b = myunknown; break; |
76 | } |
77 | return b; |
78 | } |
79 | |
80 | void TopOpeBRepTool_STATE::Print() |
81 | { |
04232180 |
82 | std::cout<<myname<<" : "; |
83 | std::cout<<"IN/OUT/ON/UNKNOWN = "; |
84 | std::cout<<Get(TopAbs_IN)<<Get(TopAbs_OUT)<<Get(TopAbs_ON)<<Get(TopAbs_UNKNOWN); |
85 | std::cout<<std::endl; |
7fd59977 |
86 | } |
87 | |
7fd59977 |
88 | #endif |