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 | |
42cf5bc1 |
17 | |
18 | #include <Standard_Type.hxx> |
7fd59977 |
19 | #include <TopOpeBRepDS_define.hxx> |
42cf5bc1 |
20 | #include <TopOpeBRepDS_Marker.hxx> |
21 | |
92efcf78 |
22 | IMPLEMENT_STANDARD_RTTIEXT(TopOpeBRepDS_Marker,MMgt_TShared) |
23 | |
7fd59977 |
24 | //#include <TopExp.hxx> |
25 | //#include <TopTools_IndexedMapOfShape.hxx> |
7fd59977 |
26 | TopOpeBRepDS_Marker::TopOpeBRepDS_Marker() |
27 | { |
28 | Reset(); |
29 | } |
30 | |
31 | void TopOpeBRepDS_Marker::Reset() |
32 | { |
33 | myhe.Nullify(); |
34 | myne = 0; |
35 | } |
36 | |
37 | void TopOpeBRepDS_Marker::Set(const Standard_Integer ie, const Standard_Boolean b) |
38 | { |
39 | Allocate(ie); |
40 | if (!(ie>=1 && ie<=myne)) return; |
41 | myhe->SetValue(ie,b); |
42 | } |
43 | |
44 | void TopOpeBRepDS_Marker::Set(const Standard_Boolean b, const Standard_Integer na, const Standard_Address aa) |
45 | { |
46 | char ** a = (char**)aa; |
47 | // Standard_Integer ia,ie; |
48 | Standard_Integer ia; |
49 | if (!na) myhe->Init(b); |
50 | else for (ia=0; ia<na; ia++) Set(atoi(a[ia]),b); |
51 | } |
52 | |
53 | Standard_Boolean TopOpeBRepDS_Marker::GetI(const Standard_Integer ie) const |
54 | { |
55 | if (myhe.IsNull()) return Standard_False; |
56 | if (!(ie>=1 && ie<=myne)) return Standard_False; |
57 | return myhe->Value(ie); |
58 | } |
59 | |
60 | void TopOpeBRepDS_Marker::Allocate(const Standard_Integer n) |
61 | { |
62 | Standard_Boolean all = (n > myne); |
63 | Standard_Integer nall = n; |
64 | if (all) { |
65 | if (myne == 0) nall = 1000; |
66 | myhe = new TColStd_HArray1OfBoolean(0,nall); |
67 | myhe->Init(Standard_False); |
68 | } |
69 | if (nall) myne = nall; |
70 | } |