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 | #include <Transfer_MultipleBinder.ixx> |
15 | #include <Transfer_TransferFailure.hxx> |
ec357c5c |
16 | #include <Standard_Transient.hxx> |
7fd59977 |
17 | |
18 | |
19 | |
20 | // Resultat Multiple |
21 | // Possibilite de definir un Resultat Multiple : plusieurs objets resultant |
22 | // d un Transfert, sans pouvoir les distinguer |
23 | // N.B. : Pour l heure, tous Transients (pourra evoluer) |
24 | |
25 | |
26 | |
b311480e |
27 | Transfer_MultipleBinder::Transfer_MultipleBinder () { } |
7fd59977 |
28 | |
29 | |
30 | Standard_Boolean Transfer_MultipleBinder::IsMultiple () const |
31 | { |
32 | if (themulres.IsNull()) return Standard_False; |
33 | return (themulres->Length() != 1); |
34 | } |
35 | |
36 | Handle(Standard_Type) Transfer_MultipleBinder::ResultType () const |
37 | { return STANDARD_TYPE(Standard_Transient); } |
38 | |
39 | Standard_CString Transfer_MultipleBinder::ResultTypeName () const |
40 | { return "(list)"; } |
41 | |
42 | // .... Gestion du Resultat Multiple .... |
43 | |
44 | void Transfer_MultipleBinder::AddResult |
45 | (const Handle(Standard_Transient)& res) |
46 | { |
47 | if (themulres.IsNull()) themulres = new TColStd_HSequenceOfTransient(); |
48 | themulres->Append(res); |
49 | } |
50 | |
51 | Standard_Integer Transfer_MultipleBinder::NbResults () const |
52 | { return (themulres.IsNull() ? 0 : themulres->Length()); } |
53 | |
54 | Handle(Standard_Transient) Transfer_MultipleBinder::ResultValue |
55 | (const Standard_Integer num) const |
56 | { return themulres->Value(num); } |
57 | |
58 | Handle(TColStd_HSequenceOfTransient) Transfer_MultipleBinder::MultipleResult |
59 | () const |
60 | { |
61 | if (!themulres.IsNull()) return themulres; |
62 | return new TColStd_HSequenceOfTransient(); |
63 | } |
64 | |
65 | void Transfer_MultipleBinder::SetMultipleResult |
66 | (const Handle(TColStd_HSequenceOfTransient)& mulres) |
67 | { themulres = mulres; } |