<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>VTK: dox/Common/vtkGarbageCollector.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.6 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <h1>dox/Common/vtkGarbageCollector.h</h1><a href="a02027.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*=========================================================================</span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment"> Program: Visualization Toolkit</span> <a name="l00004"></a>00004 <span class="comment"> Module: $RCSfile: vtkGarbageCollector.h,v $</span> <a name="l00005"></a>00005 <span class="comment"></span> <a name="l00006"></a>00006 <span class="comment"> Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen</span> <a name="l00007"></a>00007 <span class="comment"> All rights reserved.</span> <a name="l00008"></a>00008 <span class="comment"> See Copyright.txt or http://www.kitware.com/Copyright.htm for details.</span> <a name="l00009"></a>00009 <span class="comment"></span> <a name="l00010"></a>00010 <span class="comment"> This software is distributed WITHOUT ANY WARRANTY; without even</span> <a name="l00011"></a>00011 <span class="comment"> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR</span> <a name="l00012"></a>00012 <span class="comment"> PURPOSE. See the above copyright notice for more information.</span> <a name="l00013"></a>00013 <span class="comment"></span> <a name="l00014"></a>00014 <span class="comment">=========================================================================*/</span> <a name="l00081"></a>00081 <span class="preprocessor">#ifndef __vtkGarbageCollector_h</span> <a name="l00082"></a>00082 <span class="preprocessor"></span><span class="preprocessor">#define __vtkGarbageCollector_h</span> <a name="l00083"></a>00083 <span class="preprocessor"></span> <a name="l00084"></a>00084 <span class="preprocessor">#include "<a class="code" href="a02079.html">vtkObject.h</a>"</span> <a name="l00085"></a>00085 <span class="preprocessor">#include "<a class="code" href="a02028.html">vtkGarbageCollectorManager.h</a>"</span> <span class="comment">// Needed for singleton initialization.</span> <a name="l00086"></a>00086 <a name="l00087"></a>00087 <span class="comment">// This function is a friend of the collector so that it can call the</span> <a name="l00088"></a>00088 <span class="comment">// internal report method.</span> <a name="l00089"></a>00089 <span class="keywordtype">void</span> <a class="code" href="a02170.html#873ca0b83d0838a1df577536068a1730">VTK_COMMON_EXPORT</a> <a name="l00090"></a>00090 <a class="code" href="a02027.html#fcbd542f291676a9e1bd7063f4429186">vtkGarbageCollectorReportInternal</a>(<a class="code" href="a00572.html" title="Detect and break reference loops.">vtkGarbageCollector</a>*, <a name="l00091"></a>00091 <a class="code" href="a01085.html" title="abstract base class for most VTK objects">vtkObjectBase</a>*, <span class="keywordtype">void</span>*, <a name="l00092"></a>00092 <span class="keyword">const</span> <span class="keywordtype">char</span>*); <a name="l00093"></a>00093 <a name="l00094"></a>00094 <span class="comment">// This allows vtkObjectBase to get at the methods it needs.</span> <a name="l00095"></a>00095 <span class="keyword">class </span>vtkObjectBaseToGarbageCollectorFriendship; <a name="l00096"></a>00096 <a name="l00097"></a><a class="code" href="a00572.html">00097</a> <span class="keyword">class </span><a class="code" href="a02170.html#873ca0b83d0838a1df577536068a1730">VTK_COMMON_EXPORT</a> <a class="code" href="a00572.html" title="Detect and break reference loops.">vtkGarbageCollector</a> : <span class="keyword">public</span> <a class="code" href="a01084.html" title="abstract base class for most VTK objects">vtkObject</a> <a name="l00098"></a>00098 { <a name="l00099"></a>00099 <span class="keyword">public</span>: <a name="l00100"></a><a class="code" href="a00572.html#dd8f1906983f78e67090dda850b9e343">00100</a> vtkTypeRevisionMacro(<a class="code" href="a00572.html" title="Detect and break reference loops.">vtkGarbageCollector</a>,<a class="code" href="a01084.html" title="abstract base class for most VTK objects">vtkObject</a>); <a name="l00101"></a>00101 <span class="keywordtype">void</span> <a class="code" href="a01084.html#bf3dbb4154289b56a12483eee3866263">PrintSelf</a>(ostream& os, <a class="code" href="a00869.html" title="a simple class to control print indentation">vtkIndent</a> indent); <a name="l00102"></a>00102 <span class="keyword">static</span> <a class="code" href="a00572.html" title="Detect and break reference loops.">vtkGarbageCollector</a>* <a class="code" href="a01084.html#4d5b227267c076d6f9e38483370b6612">New</a>(); <a name="l00103"></a>00103 <a name="l00113"></a>00113 <span class="keyword">static</span> <span class="keywordtype">void</span> Collect(); <a name="l00114"></a>00114 <a name="l00123"></a>00123 <span class="keyword">static</span> <span class="keywordtype">void</span> Collect(<a class="code" href="a01085.html" title="abstract base class for most VTK objects">vtkObjectBase</a>* root); <a name="l00124"></a>00124 <a name="l00126"></a>00126 <a name="l00130"></a>00130 <span class="keyword">static</span> <span class="keywordtype">void</span> DeferredCollectionPush(); <a name="l00131"></a>00131 <span class="keyword">static</span> <span class="keywordtype">void</span> DeferredCollectionPop(); <a name="l00133"></a>00133 <a name="l00135"></a>00135 <a name="l00137"></a>00137 <span class="keyword">static</span> <span class="keywordtype">void</span> SetGlobalDebugFlag(<span class="keywordtype">int</span> flag); <a name="l00138"></a>00138 <span class="keyword">static</span> <span class="keywordtype">int</span> GetGlobalDebugFlag(); <a name="l00140"></a>00140 <a name="l00141"></a>00141 <span class="keyword">protected</span>: <a name="l00142"></a>00142 <a class="code" href="a00572.html" title="Detect and break reference loops.">vtkGarbageCollector</a>(); <a name="l00143"></a>00143 ~<a class="code" href="a00572.html" title="Detect and break reference loops.">vtkGarbageCollector</a>(); <a name="l00144"></a>00144 <a name="l00145"></a>00145 <span class="keyword">private</span>: <a name="l00146"></a>00146 <a name="l00154"></a>00154 <span class="keyword">static</span> <span class="keywordtype">int</span> GiveReference(<a class="code" href="a01085.html" title="abstract base class for most VTK objects">vtkObjectBase</a>* obj); <a name="l00155"></a>00155 <a name="l00161"></a>00161 <span class="keyword">static</span> <span class="keywordtype">int</span> TakeReference(<a class="code" href="a01085.html" title="abstract base class for most VTK objects">vtkObjectBase</a>* obj); <a name="l00162"></a>00162 <a name="l00163"></a>00163 <span class="comment">// Singleton management functions.</span> <a name="l00164"></a>00164 <span class="keyword">static</span> <span class="keywordtype">void</span> ClassInitialize(); <a name="l00165"></a>00165 <span class="keyword">static</span> <span class="keywordtype">void</span> ClassFinalize(); <a name="l00166"></a>00166 <a name="l00167"></a>00167 <span class="comment">//BTX</span> <a name="l00168"></a><a class="code" href="a00572.html#2396e0de1799e25bfb180082bba62467">00168</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="a00573.html" title="Manages the vtkGarbageCollector singleton.">vtkGarbageCollectorManager</a>; <a name="l00169"></a><a class="code" href="a00572.html#999cda672d0b1d118f9bf3705749c4d8">00169</a> <span class="keyword">friend</span> <span class="keyword">class </span>vtkObjectBaseToGarbageCollectorFriendship; <a name="l00170"></a>00170 <span class="comment">//ETX</span> <a name="l00171"></a>00171 <a name="l00172"></a>00172 <span class="comment">// Internal report callback and friend function that calls it.</span> <a name="l00173"></a>00173 <span class="keyword">virtual</span> <span class="keywordtype">void</span> Report(<a class="code" href="a01085.html" title="abstract base class for most VTK objects">vtkObjectBase</a>* obj, <span class="keywordtype">void</span>* ptr, <span class="keyword">const</span> <span class="keywordtype">char</span>* desc); <a name="l00174"></a>00174 <span class="keyword">friend</span> <span class="keywordtype">void</span> <a class="code" href="a02170.html#873ca0b83d0838a1df577536068a1730">VTK_COMMON_EXPORT</a> <a name="l00175"></a>00175 <a class="code" href="a02027.html#fcbd542f291676a9e1bd7063f4429186">vtkGarbageCollectorReportInternal</a>(<a class="code" href="a00572.html" title="Detect and break reference loops.">vtkGarbageCollector</a>*, <a name="l00176"></a>00176 <a class="code" href="a01085.html" title="abstract base class for most VTK objects">vtkObjectBase</a>*, <span class="keywordtype">void</span>*, <a name="l00177"></a>00177 <span class="keyword">const</span> <span class="keywordtype">char</span>*); <a name="l00178"></a>00178 <a name="l00179"></a>00179 <span class="keyword">private</span>: <a name="l00180"></a>00180 <a class="code" href="a00572.html" title="Detect and break reference loops.">vtkGarbageCollector</a>(<span class="keyword">const</span> <a class="code" href="a00572.html" title="Detect and break reference loops.">vtkGarbageCollector</a>&); <span class="comment">// Not implemented.</span> <a name="l00181"></a>00181 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="a00572.html" title="Detect and break reference loops.">vtkGarbageCollector</a>&); <span class="comment">// Not implemented.</span> <a name="l00182"></a>00182 }; <a name="l00183"></a>00183 <a name="l00184"></a>00184 <span class="comment">//BTX</span> <a name="l00185"></a>00185 <span class="keyword">class </span><a class="code" href="a01563.html" title="Non-templated superclass for vtkSmartPointer.">vtkSmartPointerBase</a>; <a name="l00186"></a>00186 <a name="l00188"></a>00188 <a name="l00189"></a>00189 <span class="keywordtype">void</span> <a class="code" href="a02170.html#873ca0b83d0838a1df577536068a1730">VTK_COMMON_EXPORT</a> <a name="l00190"></a>00190 <a class="code" href="a02027.html#6c10a99a4cb312499644f58e3b48b7c2">vtkGarbageCollectorReport</a>(<a class="code" href="a00572.html" title="Detect and break reference loops.">vtkGarbageCollector</a>* collector, <a name="l00191"></a>00191 <a class="code" href="a01563.html" title="Non-templated superclass for vtkSmartPointer.">vtkSmartPointerBase</a>& ptr, <a name="l00192"></a>00192 <span class="keyword">const</span> <span class="keywordtype">char</span>* desc); <a name="l00194"></a>00194 <a name="l00196"></a>00196 <a name="l00197"></a>00197 <span class="keyword">template</span> <<span class="keyword">class</span> T> <a name="l00198"></a><a class="code" href="a02027.html#97e70c103ecaa9459522b3853b15d5eb">00198</a> <span class="keywordtype">void</span> <a class="code" href="a02027.html#6c10a99a4cb312499644f58e3b48b7c2">vtkGarbageCollectorReport</a>(<a class="code" href="a00572.html" title="Detect and break reference loops.">vtkGarbageCollector</a>* collector, T*& ptr, <a name="l00199"></a>00199 <span class="keyword">const</span> <span class="keywordtype">char</span>* desc) <a name="l00201"></a>00201 { <a name="l00202"></a>00202 <a class="code" href="a02027.html#fcbd542f291676a9e1bd7063f4429186">vtkGarbageCollectorReportInternal</a>(collector, ptr, &ptr, desc); <a name="l00203"></a>00203 } <a name="l00204"></a>00204 <span class="comment">//ETX</span> <a name="l00205"></a>00205 <a name="l00206"></a>00206 <span class="preprocessor">#endif</span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Wed Jun 3 18:35:10 2009 for VTK by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> </body> </html>