0031642: Visualization - crash in Graphic3d_Structure::SetVisual() on redisplaying...
[occt.git] / src / Transfer / Transfer_SimpleBinderOfTransient.hxx
1 // Created on: 1993-06-10
2 // Created by: Christian CAILLET
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
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
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.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Transfer_SimpleBinderOfTransient_HeaderFile
18 #define _Transfer_SimpleBinderOfTransient_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <Transfer_Binder.hxx>
24 #include <Standard_Type.hxx>
25 #include <Standard_CString.hxx>
26 #include <Standard_Boolean.hxx>
27 class Standard_Transient;
28 class Transfer_TransferFailure;
29 class Transfer_Binder;
30
31
32 class Transfer_SimpleBinderOfTransient;
33 DEFINE_STANDARD_HANDLE(Transfer_SimpleBinderOfTransient, Transfer_Binder)
34
35 //! An adapted instantiation of SimpleBinder for Transient Result,
36 //! i.e. ResultType can be computed from the Result itself,
37 //! instead of being static
38 class Transfer_SimpleBinderOfTransient : public Transfer_Binder
39 {
40
41 public:
42
43   
44   //! Creates an empty SimpleBinderOfTransient
45   //! Returns True if a starting object is bound with SEVERAL
46   //! results : Here, returns allways False
47   //! See Binder itself
48   Standard_EXPORT Transfer_SimpleBinderOfTransient();
49   
50   //! Returns the Effective (Dynamic) Type of the Result
51   //! (Standard_Transient if no Result is defined)
52   Standard_EXPORT Handle(Standard_Type) ResultType() const Standard_OVERRIDE;
53   
54   //! Returns the Effective Name of (Dynamic) Type of the Result
55   //! (void) if no result is defined
56   Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE;
57   
58   //! Defines the Result
59   Standard_EXPORT void SetResult (const Handle(Standard_Transient)& res);
60   
61   //! Returns the defined Result, if there is one
62   Standard_EXPORT const Handle(Standard_Transient)& Result() const;
63   
64   //! Returns a transient result according to its type (IsKind)
65   //! i.e. the result itself if IsKind(atype), else searches in
66   //! NextResult, until first found, then returns True
67   //! If not found, returns False (res is NOT touched)
68   //!
69   //! This syntactic form avoids to do DownCast : if a result is
70   //! found with the good type, it is loaded in <res> and can be
71   //! immediately used, well initialised
72   Standard_EXPORT static Standard_Boolean GetTypedResult (const Handle(Transfer_Binder)& bnd, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& res);
73
74
75
76
77   DEFINE_STANDARD_RTTIEXT(Transfer_SimpleBinderOfTransient,Transfer_Binder)
78
79 protected:
80
81
82
83
84 private:
85
86
87   Handle(Standard_Transient) theres;
88
89
90 };
91
92
93
94
95
96
97
98 #endif // _Transfer_SimpleBinderOfTransient_HeaderFile