gwnavruntime/kernel/HeapMH/HeapMH_AllocBitSet2.h Source File

HeapMH_AllocBitSet2.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 /**************************************************************************
8 
9 Filename : HeapMH_AllocBitSet2.h
10 Content : "Magic-header based" Bit-set based allocator, 2 bits
11  per block.
12 
13 Created : 2009
14 Authors : Maxim Shemanarev
15 
16 **************************************************************************/
17 
18 #pragma once
19 
22 
23 namespace Kaim { namespace HeapMH {
24 
25 //------------------------------------------------------------------------
26 class AllocBitSet2MH
27 {
28 public:
29  AllocBitSet2MH();
30 
31  void Reset() { Bin.Reset(); }
32 
33  void InitPage(PageMH* page, UInt32 index);
34  void ReleasePage(UByte* start);
35 
36  void* Alloc(UPInt size, MagicHeadersInfo* headers);
37  void* Alloc(UPInt size, UPInt alignSize, MagicHeadersInfo* headers);
38  void* ReallocInPlace(PageMH* page, void* oldPtr, UPInt newSize, UPInt* oldSize, MagicHeadersInfo* headers);
39  void Free(PageMH* page, void* ptr, MagicHeadersInfo* headers, UPInt* oldBytes);
40 
41  UPInt GetUsableSize(const PageMH* page, const void* ptr) const;
42 
43 private:
44  ListBinMH Bin;
45 };
46 
47 }} // Kaim::HeapMH
48 
49 
std::uint8_t UByte
uint8_t
Definition: SF_Types.h:134
std::uint32_t UInt32
uint32_t
Definition: SF_Types.h:137
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17