00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00044 #ifndef __vtkHeap_h
00045 #define __vtkHeap_h
00046
00047 #include "vtkObject.h"
00048
00049 class vtkHeapBlock;
00050
00051 class VTK_COMMON_EXPORT vtkHeap : public vtkObject
00052 {
00053 public:
00054 static vtkHeap *New();
00055 vtkTypeRevisionMacro(vtkHeap,vtkObject);
00056 void PrintSelf(ostream& os, vtkIndent indent);
00057
00059 void* AllocateMemory(size_t n);
00060
00062
00064 virtual void SetBlockSize(size_t);
00065 virtual size_t GetBlockSize() { return this->BlockSize;};
00067
00069
00070 vtkGetMacro(NumberOfBlocks,int);
00071 vtkGetMacro(NumberOfAllocations,int);
00073
00077 void Reset();
00078
00080 char* StringDup(const char* str);
00081
00082 protected:
00083 vtkHeap();
00084 ~vtkHeap();
00085
00086 void Add(size_t blockSize);
00087 void CleanAll();
00088 vtkHeapBlock* DeleteAndNext();
00089
00090 size_t BlockSize;
00091 int NumberOfAllocations;
00092 int NumberOfBlocks;
00093 int Alignment;
00094
00095
00096 vtkHeapBlock* First;
00097 vtkHeapBlock* Last;
00098 vtkHeapBlock* Current;
00099
00100 size_t Position;
00101
00102 private:
00103 vtkHeap(const vtkHeap&);
00104 void operator=(const vtkHeap&);
00105 };
00106
00107 #endif