1 // Created on: 1992-10-13
2 // Created by: Ramin BARRETO, CLE (1994 Standard Light)
3 // Copyright (c) 1992-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 _MMgt_TShared_HeaderFile
18 #define _MMgt_TShared_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Transient.hxx>
24 class Standard_OutOfMemory;
28 DEFINE_STANDARD_HANDLE(MMgt_TShared, Standard_Transient)
31 //! Intermediate class between Standard_Transient
33 //! The abstract class TShared is the root class of
34 //! managed objects. TShared objects are managed
35 //! by a memory manager based on reference
36 //! counting. They have handle semantics. In other
37 //! words, the reference counter is transparently
38 //! incremented and decremented according to the
39 //! scope of handles. When all handles, which
40 //! reference a single object are out of scope, the
41 //! reference counter becomes null and the object is
42 //! automatically deleted. The deallocated memory is
43 //! not given back to the system though. It is
44 //! reclaimed for new objects of the same size.
46 //! This memory management scheme does not
47 //! work for cyclic data structures. In such cases
48 //! (with back pointers for example), you should
49 //! interrupt the cycle in a class by using a full C++
50 //! pointer instead of a handle.
51 class MMgt_TShared : public Standard_Transient
57 Standard_EXPORT virtual void Delete() const Standard_OVERRIDE;
62 DEFINE_STANDARD_RTTIEXT(MMgt_TShared,Standard_Transient)
82 #endif // _MMgt_TShared_HeaderFile