973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | |
42cf5bc1 |
15 | #include <Interface_Check.hxx> |
16 | #include <Standard_Transient.hxx> |
17 | #include <Standard_Type.hxx> |
18 | #include <TColStd_HArray1OfInteger.hxx> |
19 | #include <Transfer_Binder.hxx> |
20 | #include <Transfer_ResultFromTransient.hxx> |
21 | #include <Transfer_TransientProcess.hxx> |
7fd59977 |
22 | |
92efcf78 |
23 | IMPLEMENT_STANDARD_RTTIEXT(Transfer_ResultFromTransient,MMgt_TShared) |
24 | |
7fd59977 |
25 | static Handle(Interface_Check) voidcheck = new Interface_Check; |
26 | |
27 | Transfer_ResultFromTransient::Transfer_ResultFromTransient () { } |
28 | |
29 | void Transfer_ResultFromTransient::SetStart |
30 | (const Handle(Standard_Transient)& start) |
31 | { thestart = start; } |
32 | |
33 | void Transfer_ResultFromTransient::SetBinder |
34 | (const Handle(Transfer_Binder)& binder) |
35 | { thebinder = binder; } |
36 | |
37 | Handle(Standard_Transient) Transfer_ResultFromTransient::Start () const |
38 | { return thestart; } |
39 | |
40 | Handle(Transfer_Binder) Transfer_ResultFromTransient::Binder () const |
41 | { return thebinder; } |
42 | |
43 | Standard_Boolean Transfer_ResultFromTransient::HasResult () const |
44 | { return (thebinder.IsNull() ? Standard_False : thebinder->HasResult()); } |
45 | |
46 | |
47 | const Handle(Interface_Check) Transfer_ResultFromTransient::Check () const |
48 | { |
49 | if (thebinder.IsNull()) return voidcheck; |
50 | return thebinder->Check(); |
51 | } |
52 | |
53 | Interface_CheckStatus Transfer_ResultFromTransient::CheckStatus () const |
54 | { |
55 | if (thebinder.IsNull()) return Interface_CheckOK; |
56 | const Handle(Interface_Check) ach = thebinder->Check(); |
57 | return ach->Status(); |
58 | } |
59 | |
60 | |
61 | Handle(Transfer_ResultFromTransient) Transfer_ResultFromTransient::ResultFromKey |
62 | (const Handle(Standard_Transient)& key) const |
63 | { |
64 | Handle(Transfer_ResultFromTransient) res; |
65 | if (key == thestart) return this; |
66 | Standard_Integer i, nb = NbSubResults(); |
67 | for (i = 1; i <= nb; i ++) { |
68 | res = SubResult(i)->ResultFromKey(key); |
69 | if (!res.IsNull()) return res; |
70 | } |
71 | return res; |
72 | } |
73 | |
74 | void Transfer_ResultFromTransient::FillMap |
75 | (TColStd_IndexedMapOfTransient& map) const |
76 | { |
77 | if (thesubs.IsNull()) return; |
78 | Standard_Integer i, nb = thesubs->Length(); |
79 | for (i = 1; i <= nb; i ++) map.Add (thesubs->Value(i)); |
80 | for (i = 1; i <= nb; i ++) SubResult(i)->FillMap(map); |
81 | } |
82 | |
83 | // ##### SUBS ##### |
84 | |
85 | void Transfer_ResultFromTransient::ClearSubs () |
86 | { thesubs.Nullify(); } |
87 | |
88 | void Transfer_ResultFromTransient::AddSubResult |
89 | (const Handle(Transfer_ResultFromTransient)& sub) |
90 | { |
91 | if (sub.IsNull()) return; |
92 | if (thesubs.IsNull()) thesubs = new TColStd_HSequenceOfTransient(); |
93 | thesubs->Append (sub); |
94 | } |
95 | |
96 | Standard_Integer Transfer_ResultFromTransient::NbSubResults () const |
97 | { return (thesubs.IsNull() ? 0 : thesubs->Length()); } |
98 | |
99 | Handle(Transfer_ResultFromTransient) Transfer_ResultFromTransient::SubResult |
100 | (const Standard_Integer num) const |
101 | { |
102 | Handle(Transfer_ResultFromTransient) sub; |
103 | if (thesubs.IsNull()) return sub; |
104 | if (num < 1 || num > thesubs->Length()) return sub; |
105 | return Handle(Transfer_ResultFromTransient)::DownCast(thesubs->Value(num)); |
106 | } |
107 | |
108 | void Transfer_ResultFromTransient::Fill |
109 | (const Handle(Transfer_TransientProcess)& /*TP*/) |
110 | { |
111 | //abv: WARNING: to be removed (scopes) |
112 | return; |
113 | } |
114 | |
115 | void Transfer_ResultFromTransient::Strip () |
116 | { |
117 | //abv: WARNING: to be removed (scopes) |
118 | } |
119 | |
120 | void Transfer_ResultFromTransient::FillBack |
121 | (const Handle(Transfer_TransientProcess)& /*TP*/) const |
122 | { |
123 | //abv: WARNING: to be removed (scopes) |
124 | } |