Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:59

0001 // Created on: 2005-03-15
0002 // Created by: Peter KURNEV
0003 // Copyright (c) 2005-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _Standard_MMgrRoot_HeaderFile
0017 #define _Standard_MMgrRoot_HeaderFile
0018 
0019 #include <Standard_TypeDef.hxx>
0020 
0021 /** 
0022 * Root class for Open CASCADE mmemory managers.
0023 * Defines only abstract interface functions.
0024 */
0025 
0026 class Standard_MMgrRoot
0027 {
0028  public:
0029 
0030   //! Virtual destructor; required for correct inheritance
0031   Standard_EXPORT virtual ~Standard_MMgrRoot();
0032   
0033   //! Allocate specified number of bytes.
0034   //! The actually allocated space should be rounded up to 
0035   //! double word size (4 bytes), as this is expected by implementation 
0036   //! of some classes in OCC (e.g. TCollection_AsciiString)
0037   Standard_EXPORT virtual Standard_Address Allocate (const Standard_Size theSize)=0;
0038   
0039   //! Reallocate previously allocated memory to contain at least theSize bytes.
0040   //! In case of success, new pointer is returned.
0041   Standard_EXPORT virtual Standard_Address Reallocate (Standard_Address thePtr, 
0042                                                        const Standard_Size theSize)=0;
0043   
0044   //! Frees previously allocated memory at specified address.
0045   Standard_EXPORT virtual void Free(Standard_Address thePtr)=0;
0046   
0047   //! Purge internally cached unused memory blocks (if any) 
0048   //! by releasing them to the operating system.
0049   //! Must return non-zero if some memory has been actually released, 
0050   //! or zero otherwise.
0051   //! 
0052   //! If option isDestroyed is True, this means that memory 
0053   //! manager is not expected to be used any more; note however 
0054   //! that in general case it is still possible to have calls to that 
0055   //! instance of memory manager after this (e.g. to free memory
0056   //! of static objects in OCC). Thus this option should 
0057   //! command the memory manager to release any cached memory
0058   //! to the system and not cache any more, but still remain operable...
0059   //!
0060   //! Default implementation does nothing and returns 0.
0061   Standard_EXPORT virtual Standard_Integer Purge(Standard_Boolean isDestroyed=Standard_False);
0062 };
0063 
0064 #endif