0020716: Eliminate usage of "config.h" header file
[occt.git] / src / Standard / Standard_MMgrRoot.hxx
CommitLineData
b311480e 1// Created on: 2005-03-15
2// Created by: Peter KURNEV
973c2be1 3// Copyright (c) 2005-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 7// This library is free software; you can redistribute it and/or modify it under
8// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9// by the Free Software Foundation, with special exception defined in the file
10// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11// distribution for complete text of the license and disclaimer of any warranty.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
7fd59977 15
16#ifndef _Standard_MMgrRoot_HeaderFile
17#define _Standard_MMgrRoot_HeaderFile
18
ebc93ae7 19#include <Standard_TypeDef.hxx>
7fd59977 20
21/**
22* Root class for Open CASCADE mmemory managers.
23* Defines only abstract interface functions.
24*/
25
26class Standard_MMgrRoot
27{
28 public:
29
30 //! Virtual destructor; required for correct inheritance
31 Standard_EXPORT virtual ~Standard_MMgrRoot();
32
33 //! Allocate specified number of bytes.
34 //! The actually allocated space should be rounded up to
35 //! double word size (4 bytes), as this is expected by implementation
36 //! of some classes in OCC (e.g. TCollection_AsciiString)
37 Standard_EXPORT virtual Standard_Address Allocate (const Standard_Size theSize)=0;
38
39 //! Reallocate previously allocated memory to contain at least theSize bytes.
547702a1 40 //! In case of success, new pointer is returned.
41 Standard_EXPORT virtual Standard_Address Reallocate (Standard_Address thePtr,
7fd59977 42 const Standard_Size theSize)=0;
43
44 //! Frees previously allocated memory at specified address.
547702a1 45 Standard_EXPORT virtual void Free(Standard_Address thePtr)=0;
7fd59977 46
47 //! Purge internally cached unused memory blocks (if any)
48 //! by releasing them to the operating system.
49 //! Must return non-zero if some memory has been actually released,
50 //! or zero otherwise.
51 //!
52 //! If option isDestroyed is True, this means that memory
53 //! manager is not expected to be used any more; note however
54 //! that in general case it is still possible to have calls to that
55 //! instance of memory manager after this (e.g. to free memory
56 //! of static objects in OCC). Thus this option should
57 //! command the memory manager to release any cached memory
58 //! to the system and not cache any more, but still remain operable...
59 //!
60 //! Default implementation does nothing and returns 0.
61 Standard_EXPORT virtual Standard_Integer Purge(Standard_Boolean isDestroyed=Standard_False);
7fd59977 62};
63
64#endif