0024805: Eliminate unused static functions and methods: ShallowDump(), ShallowCopy...
[occt.git] / src / Standard / Standard_Transient_proto.hxx
1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
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.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15 #ifndef _Standard_Transient_proto_HeaderFile
16 #define _Standard_Transient_proto_HeaderFile
17
18 #include <Standard_DefineAlloc.hxx>
19 #include <Standard_Macro.hxx>
20 #include <Standard.hxx>
21
22 class Handle_Standard_Transient;
23 class Standard_Type;
24 class Handle_Standard_Type;
25
26 //! Abstract class which forms the root of the entire 
27 //! Transient class hierarchy.
28
29 class Standard_Transient
30 {
31     //---- uses the friend Standard_Transient class
32     friend class Handle(Standard_Transient);
33
34  public:
35     
36     DEFINE_STANDARD_ALLOC
37
38     //! Empty constructor
39     Standard_Transient() : count(0) {}
40
41     //! Copy constructor -- does nothing
42     Standard_Transient(const Standard_Transient&) : count(0) {}
43
44     //! Assignment operator, needed to avoid copying reference counter
45     Standard_Transient& operator= (const Standard_Transient&) { return *this; }
46
47     //! Destructor must be virtual
48     Standard_EXPORT virtual ~Standard_Transient();
49
50     //! Memory deallocator for transient classes
51     Standard_EXPORT virtual void Delete() const;
52
53     //! Returns a type information object about this object.
54     Standard_EXPORT virtual const Handle_Standard_Type& DynamicType() const;
55
56     //! Returns a true value if this is an instance of Type.
57     Standard_EXPORT Standard_Boolean IsInstance(const Handle_Standard_Type& theType) const;  
58
59     //! Returns a true value if this is an instance of TypeName.
60     Standard_EXPORT Standard_Boolean IsInstance(const Standard_CString theTypeName) const;  
61
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;
66
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;
71
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;
75
76     //! Get the reference counter of this object.
77     Standard_EXPORT Standard_Integer GetRefCount() const { return count; }
78
79  private:
80
81    volatile Standard_Integer count;
82 };
83
84 Standard_EXPORT const Handle(Standard_Type)& STANDARD_TYPE(Standard_Transient);
85
86 #endif