Common/vtkHeap.h Source File

Main Page Class Hierarchy Alphabetical List Compound List File List Compound 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 =========================================================================*/
    00049 #ifndef __vtkHeap_h
    00050 #define __vtkHeap_h
    00051
    00052 #include "vtkObject.h"
    00053
    00054 //BTX
    00055 class VTK_COMMON_EXPORT vtkHeapNode
    00056 {
    00057 public:
    00058   void* Ptr;
    00059   vtkHeapNode* Next;
    00060   vtkHeapNode():Ptr(0),Next(0) {};
    00061 };
    00062 //ETX
    00063
    00064 class VTK_COMMON_EXPORT vtkHeap : public vtkObject
    00065 {
    00066 public:
    00067   static vtkHeap *New();
    00068   vtkTypeRevisionMacro(vtkHeap,vtkObject);
    00069   void PrintSelf(ostream& os, vtkIndent indent);
    00070
    00072   void* AllocateMemory(size_t n);
    00073
    00075   char* StringDup(const char* str);
    00076
    00078
    00079   vtkGetMacro(NumberOfAllocations,int);
    00081
    00082 protected:
    00083   vtkHeap();
    00084   ~vtkHeap();
    00085
    00086   void Add(vtkHeapNode* node);
    00087   void CleanAll();
    00088   vtkHeapNode* DeleteAndNext();
    00089
    00090   vtkHeapNode* First;
    00091   vtkHeapNode* Last;
    00092   vtkHeapNode* Current;
    00093
    00094   int NumberOfAllocations;
    00095 private:
    00096   vtkHeap(const vtkHeap&); // Not implemented.
    00097   void operator=(const vtkHeap&);  // Not implemented.
    00098 };
    00099
    00100 #endif