1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License version 2.1 as published
8 // by the Free Software Foundation, with special exception defined in the file
9 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10 // distribution for complete text of the license and disclaimer of any warranty.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
15 #ifndef _Standard_Transient_proto_HeaderFile
16 #define _Standard_Transient_proto_HeaderFile
18 #include <Standard_DefineAlloc.hxx>
19 #include <Standard_Macro.hxx>
20 #include <Standard.hxx>
22 class Handle_Standard_Transient;
24 class Handle_Standard_Type;
26 //! Abstract class which forms the root of the entire
27 //! Transient class hierarchy.
29 class Standard_Transient
31 //---- uses the friend Standard_Transient class
32 friend class Handle(Standard_Transient);
39 Standard_Transient() : count(0) {}
41 //! Copy constructor -- does nothing
42 Standard_Transient(const Standard_Transient&) : count(0) {}
44 //! Assignment operator, needed to avoid copying reference counter
45 Standard_Transient& operator= (const Standard_Transient&) { return *this; }
47 //! Destructor must be virtual
48 Standard_EXPORT virtual ~Standard_Transient();
50 //! Memory deallocator for transient classes
51 Standard_EXPORT virtual void Delete() const;
53 //! Returns a type information object about this object.
54 Standard_EXPORT virtual const Handle_Standard_Type& DynamicType() const;
56 //! Returns a true value if this is an instance of Type.
57 Standard_EXPORT Standard_Boolean IsInstance(const Handle_Standard_Type& theType) const;
59 //! Returns a true value if this is an instance of TypeName.
60 Standard_EXPORT Standard_Boolean IsInstance(const Standard_CString theTypeName) const;
62 //! Returns true if this is an instance of Type or an
63 //! instance of any class that inherits from Type.
64 //! Note that multiple inheritance is not supported by OCCT RTTI mechanism.
65 Standard_EXPORT Standard_Boolean IsKind(const Handle_Standard_Type& theType) const;
67 //! Returns true if this is an instance of TypeName or an
68 //! instance of any class that inherits from TypeName.
69 //! Note that multiple inheritance is not supported by OCCT RTTI mechanism.
70 Standard_EXPORT Standard_Boolean IsKind(const Standard_CString theTypeName) const;
72 //! Returns a Handle which references this object.
73 //! Must never be called to objects created in stack.
74 Standard_EXPORT virtual Handle_Standard_Transient This() const;
76 //! Get the reference counter of this object.
77 Standard_EXPORT Standard_Integer GetRefCount() const { return count; }
81 volatile Standard_Integer count;
84 Standard_EXPORT const Handle(Standard_Type)& STANDARD_TYPE(Standard_Transient);