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

Common/vtkHeap.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkHeap.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00051 #ifndef __vtkHeap_h
00052 #define __vtkHeap_h
00053 
00054 #include "vtkObject.h"
00055 
00056 //BTX
00057 class VTK_COMMON_EXPORT vtkHeapNode
00058 {
00059 public:
00060   void* Ptr;
00061   vtkHeapNode* Next;
00062   vtkHeapNode():Ptr(0),Next(0) {};
00063 };
00064 //ETX
00065 
00066 class VTK_COMMON_EXPORT vtkHeap : public vtkObject
00067 {
00068 public:
00069   static vtkHeap *New();
00070   vtkTypeRevisionMacro(vtkHeap,vtkObject);
00071   void PrintSelf(ostream& os, vtkIndent indent);
00072 
00074   void* AllocateMemory(size_t n);
00075   
00077   char* StringDup(const char* str);
00078 
00080 
00081   vtkGetMacro(NumberOfAllocations,int);
00083 
00084 protected:  
00085   vtkHeap();
00086   ~vtkHeap();
00087 
00088   void Add(vtkHeapNode* node);
00089   void CleanAll();
00090   vtkHeapNode* DeleteAndNext();
00091 
00092   vtkHeapNode* First;
00093   vtkHeapNode* Last;
00094   vtkHeapNode* Current;
00095 
00096   int NumberOfAllocations;
00097 private:
00098   vtkHeap(const vtkHeap&); // Not implemented.
00099   void operator=(const vtkHeap&);  // Not implemented.
00100 };
00101 
00102 #endif