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

# vtkHeap Class Reference

`#include <vtkHeap.h>`

Inheritance diagram for vtkHeap:

[legend]
Collaboration diagram for vtkHeap:

[legend]
List of all members.

## Detailed Description

replacement for malloc/free and new/delete

Date:
  2002/06/13 08:41:32

Revision:
  1.9

This class is a replacement for malloc/free and new/delete for software that has inherent memory leak problems. For example, external software such as the PLY library (vtkPLY) and VRML importer (vtkVRMLImporter) are often written with lots of malloc() calls but without the corresponding free() invocations. This class allows the replacement of malloc() with the method AllocateMemory(). Memory is then deleted with an invocation of CleanUp().

Warning:
  Do not use this method as a replacement for system memory allocation. This class should be used only as a last resort if memory leaks cannot be tracked down and eliminated by conventional means.

See also:
  vtkVRMLImporter vtkPLY

Created by:
  - Schroeder, Will

CVS contributions (if > 5%):
  - Schroeder, Will (85%)

CVS logs (CVSweb):
  - .`h` (`/Common/vtkHeap.h)`
  - .`cxx` (`/Common/vtkHeap.cxx)`

Definition at line 64 of file vtkHeap.h.

## Public Types

typedef vtkObject | Superclass

## Public Methods

virtual const char * | GetClassName ()
virtual int | IsA (const char *type)
void | PrintSelf (ostream &os, vtkIndent indent)
void * | AllocateMemory (size_t n)
char * | StringDup (const char *str)
virtual int | GetNumberOfAllocations ()

## Static Public Methods

vtkHeap * | New ()
int | IsTypeOf (const char *type)
vtkHeap * | SafeDownCast (vtkObject *o)

## Protected Methods

| vtkHeap ()
| ~vtkHeap ()
void | Add (vtkHeapNode *node)
void | CleanAll ()
vtkHeapNode * | DeleteAndNext ()

## Protected Attributes

vtkHeapNode * | First
vtkHeapNode * | Last
vtkHeapNode * | Current
int | NumberOfAllocations

## Member Typedef Documentation

typedef vtkObject vtkHeap::Superclass

| Reimplemented from vtkObject. Definition at line 68 of file vtkHeap.h.

## Constructor & Destructor Documentation

vtkHeap::vtkHeap | ( |  | ) | `[protected]`

vtkHeap::~vtkHeap | ( |  | ) | `[protected]`

## Member Function Documentation

vtkHeap* vtkHeap::New | ( |  | ) | `[static]`

| Create an object with Debug turned off, modified time initialized to zero, and reference counting on. Reimplemented from vtkObject.

virtual const char* vtkHeap::GetClassName | ( |  | ) | `[virtual]`

| Reimplemented from vtkObject.

int vtkHeap::IsTypeOf | ( | const char * | type | ) | `[static]`

| Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkObject.

virtual int vtkHeap::IsA | ( | const char * | type | ) | `[virtual]`

| Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkObject.

vtkHeap* vtkHeap::SafeDownCast | ( | vtkObject * | o | ) | `[static]`

| Reimplemented from vtkObject.

void vtkHeap::PrintSelf | ( | ostream & | os,
|  | vtkIndent | indent
| ) | `[virtual]`

| Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes. Reimplemented from vtkObject.

void* vtkHeap::AllocateMemory | ( | size_t | n | ) |

| Allocate the memory requested.

char* vtkHeap::StringDup | ( | const char * | str | ) |

| Convenience method performs string duplication.

virtual int vtkHeap::GetNumberOfAllocations | ( |  | ) | `[virtual]`

| Get the number of allocations thus far.

void vtkHeap::Add | ( | vtkHeapNode * | node | ) | `[protected]`

void vtkHeap::CleanAll | ( |  | ) | `[protected]`

vtkHeapNode* vtkHeap::DeleteAndNext | ( |  | ) | `[protected]`

## Member Data Documentation

vtkHeapNode* vtkHeap::First`[protected]`

| Definition at line 90 of file vtkHeap.h.

vtkHeapNode* vtkHeap::Last`[protected]`

| Definition at line 91 of file vtkHeap.h.

vtkHeapNode* vtkHeap::Current`[protected]`

| Definition at line 92 of file vtkHeap.h.

int vtkHeap::NumberOfAllocations`[protected]`

| Definition at line 94 of file vtkHeap.h.

The documentation for this class was generated from the following file:

- Common/vtkHeap.h