bd05fb6d66375d0f990bbc1b4a18f933807e2078
[occt.git] / src / Standard / Standard_MMgrTBBalloc.hxx
1 // Created on: 2010-03-15
2 // Created by: Sergey KUUL
3 // Copyright (c) 2010-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
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
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.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16 #ifndef _Standard_MMgrTBBalloc_HeaderFile
17 #define _Standard_MMgrTBBalloc_HeaderFile
18
19 #ifndef _Standard_Address_HeaderFile
20 #include <Standard_Address.hxx>
21 #endif
22 #ifndef _Standard_Integer_HeaderFile
23 #include <Standard_Integer.hxx>
24 #endif
25 #ifndef _Standard_Macro_HeaderFile
26 #include <Standard_Macro.hxx>
27 #endif
28 #ifndef _Standard_MMgrRoot_HeaderFile
29 #include <Standard_MMgrRoot.hxx>
30 #endif
31
32 //!
33 //! Implementation of OCC memory manager which uses Intel TBB
34 //! scalable allocator.
35 //!
36 //! On configurations where TBB is not available standard RTL functions 
37 //! malloc() / free() are used.
38
39 class Standard_MMgrTBBalloc : public Standard_MMgrRoot
40 {
41  public:
42   //! Constructor; if aClear is True, the memory will be nullified
43   //! upon allocation.
44   Standard_EXPORT Standard_MMgrTBBalloc(const Standard_Boolean aClear=Standard_False);
45
46   //! Allocate aSize bytes 
47   Standard_EXPORT virtual Standard_Address Allocate(const Standard_Size aSize);
48   
49   //! Reallocate aPtr to the size aSize. 
50   //! The new pointer is returned.
51   Standard_EXPORT virtual Standard_Address Reallocate (Standard_Address thePtr,
52                                                        const Standard_Size theSize);
53   
54   //! Free allocated memory
55   Standard_EXPORT virtual void Free (Standard_Address thePtr);
56
57  protected:
58   Standard_Boolean myClear; //! Option to nullify allocated memory
59 };
60
61 #endif