1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
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
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.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13 
14 
15 #include <Standard_OutOfRange.hxx>
16 #include <Standard_Transient.hxx>
17 #include <Standard_Type.hxx>
18 #include <Transfer_MultipleBinder.hxx>
19 #include <Transfer_TransferFailure.hxx>
20 
IMPLEMENT_STANDARD_RTTIEXT(Transfer_MultipleBinder,Transfer_Binder)21 IMPLEMENT_STANDARD_RTTIEXT(Transfer_MultipleBinder,Transfer_Binder)
22 
23 // Resultat Multiple
24 // Possibilite de definir un Resultat Multiple : plusieurs objets resultant
25 //  d un Transfert, sans pouvoir les distinguer
26 //  N.B. : Pour l heure, tous Transients (pourra evoluer)
27 Transfer_MultipleBinder::Transfer_MultipleBinder ()      { }
28 
29 
IsMultiple() const30     Standard_Boolean Transfer_MultipleBinder::IsMultiple () const
31 {
32   if (themulres.IsNull()) return Standard_False;
33   return (themulres->Length() != 1);
34 }
35 
Handle(Standard_Type)36     Handle(Standard_Type) Transfer_MultipleBinder::ResultType () const
37       {  return STANDARD_TYPE(Standard_Transient);  }
38 
ResultTypeName() const39     Standard_CString Transfer_MultipleBinder::ResultTypeName () const
40       {  return "(list)";  }
41 
42 //  ....        Gestion du Resultat Multiple        ....
43 
AddResult(const Handle (Standard_Transient)& res)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 
NbResults() const51     Standard_Integer  Transfer_MultipleBinder::NbResults () const
52       {  return (themulres.IsNull() ? 0 : themulres->Length());  }
53 
Handle(Standard_Transient)54     Handle(Standard_Transient) Transfer_MultipleBinder::ResultValue
55   (const Standard_Integer num) const
56       {  return themulres->Value(num);  }
57 
Handle(TColStd_HSequenceOfTransient)58     Handle(TColStd_HSequenceOfTransient) Transfer_MultipleBinder::MultipleResult
59   () const
60 {
61   if (!themulres.IsNull()) return themulres;
62   return new TColStd_HSequenceOfTransient();
63 }
64 
SetMultipleResult(const Handle (TColStd_HSequenceOfTransient)& mulres)65     void Transfer_MultipleBinder::SetMultipleResult
66   (const Handle(TColStd_HSequenceOfTransient)& mulres)
67       {  themulres = mulres;  }
68