0024710: Avoid including Handle_Class.hxx headers except where necessary
[occt.git] / src / Standard / Standard_Persistent.cxx
CommitLineData
b311480e 1// Copyright (c) 1998-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 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
973c2be1 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.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
7fd59977 14
7fd59977 15#include <Standard_Persistent.hxx>
16
17#include <Standard_Failure.hxx>
18#include <Standard_NullObject.hxx>
19#include <Standard_RangeError.hxx>
20#include <Standard_ImmutableObject.hxx>
21#include <Standard_TypeMismatch.hxx>
22#include <Standard_NotImplemented.hxx>
23#include <Standard_Type.hxx>
24
7fd59977 25// The Initialization of the Standard_Persistent variables
34781c33 26const Handle_Standard_Type& Standard_Persistent_Type_()
7fd59977 27{
28 static const Handle_Standard_Type _Ancestors[]={NULL};
29 static Handle_Standard_Type _aType
30 = new Standard_Type("Standard_Persistent",
31 sizeof(Standard_Persistent),
32 0,
33 (Standard_Address) _Ancestors,
34 NULL);
35
36 return _aType;
37}
38
39//
40// The Standard_Persistent Methods
41//
42
43// The Method This
44//
45Handle_Standard_Persistent Standard_Persistent::This() const
46{
47 Handle_Standard_Persistent aHand(this);
48
49 return aHand;
50}
51
52// The Method ShallowCopy
53//
54Handle_Standard_Persistent Standard_Persistent::ShallowCopy() const
55{
56 //the method must be redefined in the every subclass that is expected to use it
57 Standard_NotImplemented::Raise ("The ShallowCopy() method must be redefined in the subclass");
58 return This(); // for compilation only
59}
60
61// Empty Constructor
62//
63// Standard_Persistent::Standard_Persistent()
64// {
65// }
66
67// Empty Destructor
68//
69Standard_Persistent::~Standard_Persistent()
70{
71}
72
73// Constructor from a Standard_Persistent
74//
75// Standard_Persistent::Standard_Persistent(const Standard_Persistent& )
76// {
77// }
78
79// Operator= with a Standard_Persistent
80//
81Standard_Persistent& Standard_Persistent::operator=(const Standard_Persistent& )
82{
83 return *this;
84}
85
86//
87//
88Standard_Boolean Standard_Persistent::IsInstance(const Handle(Standard_Type)
89 &AType) const
90{
91 return (Standard_Boolean) (AType == DynamicType());
92}
93
94//
95//
96const Handle(Standard_Type)& Standard_Persistent::DynamicType () const
97{
98 return STANDARD_TYPE(Standard_Persistent);
99}
100
101//
102//
103Standard_Boolean Standard_Persistent::IsKind (const Handle(Standard_Type)& aType) const
104{
105 return DynamicType()->SubType ( aType );
106// return (aType == STANDARD_TYPE(Standard_Persistent));
107}
108
7fd59977 109void Standard_Persistent::ShallowDump(Standard_OStream& AStream) const
110{
111 Handle(Standard_Persistent) me = this;
112 ::ShallowDump(me, AStream);
113}
114
115
116void Standard_Persistent::Delete() const
117 {
118 delete((Standard_Persistent *)this);
119 }
120
121const Handle(Standard_Persistent) Handle(Standard_Persistent)::DownCast(const Handle(Standard_Persistent)& AnObject)
122{
123 Handle(Standard_Persistent) _anOtherObject;
124
125 if (!AnObject.IsNull())
126 if (AnObject->IsKind(STANDARD_TYPE(Standard_Persistent)))
127 {
128 _anOtherObject = Handle(Standard_Persistent)((Handle(Standard_Persistent)&)AnObject);
129 }
130
131 return _anOtherObject ;
132}
133
134Handle(Standard_Persistent)::~Handle(Standard_Persistent)()
135{
136 EndScope();
137}
138
139void Handle_Standard_Persistent::RaiseNullObject(const Standard_CString S) const
140{
141 Standard_NullObject::Raise(S);
142}
143
144void Handle(Standard_Persistent)::Dump(Standard_OStream& out) const
145{
146 out << ControlAccess();
147}
148
149