0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / Transfer / Transfer_SimpleBinderOfTransient.cxx
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_Transient.hxx>
16 #include <Standard_Type.hxx>
17 #include <Transfer_Binder.hxx>
18 #include <Transfer_SimpleBinderOfTransient.hxx>
19 #include <Transfer_TransferFailure.hxx>
20
21 IMPLEMENT_STANDARD_RTTIEXT(Transfer_SimpleBinderOfTransient,Transfer_Binder)
22
23 //  "Handle(Standard_Transient)" : la classe de base pour le Resultat
24 Transfer_SimpleBinderOfTransient::Transfer_SimpleBinderOfTransient () { }
25
26
27 //    Standard_Boolean  Transfer_SimpleBinderOfTransient::IsMultiple() const
28 //      {  return Standard_False;  }
29
30
31     Handle(Standard_Type)  Transfer_SimpleBinderOfTransient::ResultType () const
32 {
33   if (!HasResult() || theres.IsNull()) return STANDARD_TYPE(Standard_Transient);
34   return Result()->DynamicType();
35 }
36
37     Standard_CString  Transfer_SimpleBinderOfTransient::ResultTypeName () const
38 {
39   if (!HasResult() || theres.IsNull()) return "(void)";
40   return Result()->DynamicType()->Name();
41 }
42
43
44     void  Transfer_SimpleBinderOfTransient::SetResult
45   (const Handle(Standard_Transient)& res)
46 {
47   SetResultPresent();
48   theres = res;
49 }
50
51
52     const Handle(Standard_Transient)&  Transfer_SimpleBinderOfTransient::Result () const
53       {  return theres;  }
54
55     Standard_Boolean  Transfer_SimpleBinderOfTransient::GetTypedResult
56   (const Handle(Transfer_Binder)& bnd, const Handle(Standard_Type)& atype,
57    Handle(Standard_Transient)& res)
58 {
59   if (atype.IsNull()) return Standard_False;
60   Handle(Transfer_Binder) bn = bnd;
61   while (!bn.IsNull()) {
62     Handle(Transfer_SimpleBinderOfTransient) trb =
63       Handle(Transfer_SimpleBinderOfTransient)::DownCast(bn);
64     bn = bn->NextResult();
65     if (trb.IsNull()) continue;
66     const Handle(Standard_Transient)& rs = trb->Result();
67     if (rs.IsNull()) continue;
68     if (!rs->IsKind(atype)) continue;
69     res = rs;
70     return Standard_True;
71   }
72   return Standard_False;
73 }