VTK
dox
Common
Misc
vtkHeap.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Visualization Toolkit
4
Module: vtkHeap.h
5
6
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7
All rights reserved.
8
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10
This software is distributed WITHOUT ANY WARRANTY; without even
11
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12
PURPOSE. See the above copyright notice for more information.
13
14
=========================================================================*/
45
#ifndef vtkHeap_h
46
#define vtkHeap_h
47
48
#include "vtkCommonMiscModule.h"
// For export macro
49
#include "
vtkObject.h
"
50
51
class
vtkHeapBlock;
//forward declaration
52
53
class
VTKCOMMONMISC_EXPORT
vtkHeap
:
public
vtkObject
54
{
55
public
:
56
static
vtkHeap
*
New
();
57
vtkTypeMacro(
vtkHeap
,
vtkObject
);
58
void
PrintSelf
(ostream& os,
vtkIndent
indent) VTK_OVERRIDE;
59
63
void
* AllocateMemory(
size_t
n);
64
66
71
virtual
void
SetBlockSize(
size_t
);
72
virtual
size_t
GetBlockSize
() {
return
this->BlockSize;};
74
76
79
vtkGetMacro(NumberOfBlocks,
int
);
80
vtkGetMacro(NumberOfAllocations,
int
);
82
89
void
Reset();
90
94
char
* StringDup(
const
char
* str);
95
96
protected
:
97
vtkHeap
();
98
~
vtkHeap
() VTK_OVERRIDE;
99
100
void
Add(
size_t
blockSize);
101
void
CleanAll();
102
vtkHeapBlock* DeleteAndNext();
103
104
size_t
BlockSize;
105
int
NumberOfAllocations;
106
int
NumberOfBlocks;
107
size_t
Alignment;
108
109
// Manage the blocks
110
vtkHeapBlock* First;
111
vtkHeapBlock* Last;
112
vtkHeapBlock* Current;
113
// Manage the memory in the block
114
size_t
Position;
//the position in the Current block
115
116
private:
117
vtkHeap
(const
vtkHeap
&) VTK_DELETE_FUNCTION;
118
void
operator=(const
vtkHeap
&) VTK_DELETE_FUNCTION;
119
};
120
121
#endif
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkObject
abstract base class for most VTK objects
Definition:
vtkObject.h:59
vtkHeap::GetBlockSize
virtual size_t GetBlockSize()
Definition:
vtkHeap.h:72
vtkIndent
a simple class to control print indentation
Definition:
vtkIndent.h:39
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkHeap
replacement for malloc/free and new/delete
Definition:
vtkHeap.h:53
vtkObject.h
Generated by
1.8.17