00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _ONEHEAP_H_
00028 #define _ONEHEAP_H_
00029
00030
00031
00032
00033
00034 namespace HL {
00035
00036 template <class SuperHeap>
00037 class OneHeap {
00038 public:
00039 OneHeap (void)
00040 : theHeap (getHeap())
00041 {}
00042
00043 inline void * malloc (const size_t sz) {
00044 return theHeap->malloc (sz);
00045 }
00046 inline void free (void * ptr) {
00047 theHeap->free (ptr);
00048 }
00049 inline int remove (void * ptr) {
00050 return theHeap->remove (ptr);
00051 }
00052 inline void clear (void) {
00053 theHeap->clear();
00054 }
00055 inline size_t getSize (void * ptr) {
00056 return theHeap->getSize (ptr);
00057 }
00058
00059 enum { Alignment = SuperHeap::Alignment };
00060
00061 private:
00062
00063 SuperHeap * theHeap;
00064
00065 inline static SuperHeap * getHeap (void) {
00066 static SuperHeap theHeap;
00067 return &theHeap;
00068 }
00069
00070 };
00071
00072 }
00073
00074 #endif