VTK
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
dox
Common
vtkGarbageCollector.h
Go to the documentation of this file.
1
/*=========================================================================
2
3
Program: Visualization Toolkit
4
Module: vtkGarbageCollector.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
=========================================================================*/
81
#ifndef __vtkGarbageCollector_h
82
#define __vtkGarbageCollector_h
83
84
#include "
vtkObject.h
"
85
#include "
vtkGarbageCollectorManager.h
"
// Needed for singleton initialization.
86
87
// This function is a friend of the collector so that it can call the
88
// internal report method.
89
void
VTK_COMMON_EXPORT
90
vtkGarbageCollectorReportInternal
(
vtkGarbageCollector
*,
91
vtkObjectBase
*,
void
*,
92
const
char
*);
93
94
// This allows vtkObjectBase to get at the methods it needs.
95
class
vtkObjectBaseToGarbageCollectorFriendship;
96
97
class
VTK_COMMON_EXPORT
vtkGarbageCollector
:
public
vtkObject
98
{
99
public
:
100
vtkTypeMacro(
vtkGarbageCollector
,
vtkObject
);
101
void
PrintSelf
(ostream& os,
vtkIndent
indent);
102
static
vtkGarbageCollector
*
New
();
103
113
static
void
Collect();
114
123
static
void
Collect(
vtkObjectBase
* root);
124
126
130
static
void
DeferredCollectionPush();
131
static
void
DeferredCollectionPop();
133
135
137
static
void
SetGlobalDebugFlag(
int
flag);
138
static
int
GetGlobalDebugFlag();
140
141
protected
:
142
vtkGarbageCollector
();
143
~
vtkGarbageCollector
();
144
145
private
:
146
154
static
int
GiveReference(
vtkObjectBase
* obj);
155
161
static
int
TakeReference(
vtkObjectBase
* obj);
162
163
// Singleton management functions.
164
static
void
ClassInitialize();
165
static
void
ClassFinalize();
166
167
//BTX
168
friend
class
vtkGarbageCollectorManager
;
169
friend
class
vtkObjectBaseToGarbageCollectorFriendship;
170
//ETX
171
172
// Internal report callback and friend function that calls it.
173
virtual
void
Report(
vtkObjectBase
* obj,
void
* ptr,
const
char
* desc);
174
friend
void
VTK_COMMON_EXPORT
175
vtkGarbageCollectorReportInternal
(
vtkGarbageCollector
*,
176
vtkObjectBase
*,
void
*,
177
const
char
*);
178
179
private
:
180
vtkGarbageCollector
(
const
vtkGarbageCollector
&);
// Not implemented.
181
void
operator=(
const
vtkGarbageCollector
&);
// Not implemented.
182
};
183
184
//BTX
185
class
vtkSmartPointerBase
;
186
188
189
void
VTK_COMMON_EXPORT
190
vtkGarbageCollectorReport
(
vtkGarbageCollector
* collector,
191
vtkSmartPointerBase
& ptr,
192
const
char
* desc);
194
196
197
template
<
class
T>
198
void
vtkGarbageCollectorReport
(
vtkGarbageCollector
* collector, T*& ptr,
199
const
char
* desc)
200
{
201
vtkGarbageCollectorReportInternal
(collector, ptr, &ptr, desc);
202
}
203
//ETX
205
206
#endif
Generated on Wed May 30 2012 13:21:50 for VTK by
1.8.1