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
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _Transfer_SimpleBinderOfTransient_HeaderFile
18 #define _Transfer_SimpleBinderOfTransient_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Transfer_Binder.hxx>
26 class Transfer_SimpleBinderOfTransient;
27 DEFINE_STANDARD_HANDLE(Transfer_SimpleBinderOfTransient, Transfer_Binder)
29 //! An adapted instantiation of SimpleBinder for Transient Result,
30 //! i.e. ResultType can be computed from the Result itself,
31 //! instead of being static
32 class Transfer_SimpleBinderOfTransient : public Transfer_Binder
38 //! Creates an empty SimpleBinderOfTransient
39 //! Returns True if a starting object is bound with SEVERAL
40 //! results : Here, returns always False
42 Standard_EXPORT Transfer_SimpleBinderOfTransient();
44 //! Returns the Effective (Dynamic) Type of the Result
45 //! (Standard_Transient if no Result is defined)
46 Standard_EXPORT Handle(Standard_Type) ResultType() const Standard_OVERRIDE;
48 //! Returns the Effective Name of (Dynamic) Type of the Result
49 //! (void) if no result is defined
50 Standard_EXPORT Standard_CString ResultTypeName() const Standard_OVERRIDE;
52 //! Defines the Result
53 Standard_EXPORT void SetResult (const Handle(Standard_Transient)& res);
55 //! Returns the defined Result, if there is one
56 Standard_EXPORT const Handle(Standard_Transient)& Result() const;
58 //! Returns a transient result according to its type (IsKind)
59 //! i.e. the result itself if IsKind(atype), else searches in
60 //! NextResult, until first found, then returns True
61 //! If not found, returns False (res is NOT touched)
63 //! This syntactic form avoids to do DownCast : if a result is
64 //! found with the good type, it is loaded in <res> and can be
65 //! immediately used, well initialised
66 Standard_EXPORT static Standard_Boolean GetTypedResult (const Handle(Transfer_Binder)& bnd, const Handle(Standard_Type)& atype, Handle(Standard_Transient)& res);
71 DEFINE_STANDARD_RTTIEXT(Transfer_SimpleBinderOfTransient,Transfer_Binder)
81 Handle(Standard_Transient) theres;
92 #endif // _Transfer_SimpleBinderOfTransient_HeaderFile