Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkHeap.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkHeap.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00044 #ifndef __vtkHeap_h
00045 #define __vtkHeap_h
00046 
00047 #include "vtkObject.h"
00048 
00049 class vtkHeapBlock; //forward declaration
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   // Manage the blocks
00096   vtkHeapBlock* First;
00097   vtkHeapBlock* Last;
00098   vtkHeapBlock* Current;
00099   // Manage the memory in the block
00100   size_t Position; //the position in the Current block
00101   
00102 private:
00103   vtkHeap(const vtkHeap&); // Not implemented.
00104   void operator=(const vtkHeap&);  // Not implemented.
00105 };
00106 
00107 #endif

Generated on Mon Jan 21 23:07:17 2008 for VTK by  doxygen 1.4.3-20050530