<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta name="robots" content="noindex"> <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>ITK: itkTreeContainer.h Source File</title> <link href="DoxygenStyle.css" rel="stylesheet" type="text/css"> </head><body bgcolor="#ffffff"> <!-- Section customized for INSIGHT : Tue Jul 17 01:02:45 2001 --> <center> <a href="index.html" class="qindex">Main Page</a> <a href="modules.html" class="qindex">Groups</a> <a href="namespaces.html" class="qindex">Namespace List</a> <a href="hierarchy.html" class="qindex">Class Hierarchy</a> <a href="classes.html" class="qindex">Alphabetical List</a> <a href="annotated.html" class="qindex">Compound List</a> <a href="files.html" class="qindex">File List</a> <a href="namespacemembers.html" class="qindex">Namespace Members</a> <a href="functions.html" class="qindex">Compound Members</a> <a href="globals.html" class="qindex">File Members</a> <a href="pages.html" class="qindex">Concepts</a></center> <!-- Generated by Doxygen 1.5.9 --> <div class="navpath"><a class="el" href="dir_02e23d841c198393a6e961e9a0678fff.html">Code</a> » <a class="el" href="dir_ea7fc529ede9a38b0438cf13831ae873.html">Common</a> </div> <div class="contents"> <h1>itkTreeContainer.h</h1><a href="itkTreeContainer_8h.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: Insight Segmentation & Registration Toolkit</span> <a name="l00004"></a>00004 <span class="comment"> Module: $RCSfile: itkTreeContainer.h,v $</span> <a name="l00005"></a>00005 <span class="comment"> Language: C++</span> <a name="l00006"></a>00006 <span class="comment"> Date: $Date: 2008-06-20 20:28:54 $</span> <a name="l00007"></a>00007 <span class="comment"> Version: $Revision: 1.4 $</span> <a name="l00008"></a>00008 <span class="comment"></span> <a name="l00009"></a>00009 <span class="comment"> Copyright (c) Insight Software Consortium. All rights reserved.</span> <a name="l00010"></a>00010 <span class="comment"> See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.</span> <a name="l00011"></a>00011 <span class="comment"></span> <a name="l00012"></a>00012 <span class="comment"> This software is distributed WITHOUT ANY WARRANTY; without even </span> <a name="l00013"></a>00013 <span class="comment"> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR </span> <a name="l00014"></a>00014 <span class="comment"> PURPOSE. See the above copyright notices for more information.</span> <a name="l00015"></a>00015 <span class="comment"></span> <a name="l00016"></a>00016 <span class="comment">=========================================================================*/</span> <a name="l00017"></a>00017 <span class="preprocessor">#ifndef __itkTreeContainer_h</span> <a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define __itkTreeContainer_h</span> <a name="l00019"></a>00019 <span class="preprocessor"></span> <a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="itkMacro_8h.html">itkMacro.h</a>"</span> <a name="l00021"></a>00021 <span class="preprocessor">#include <<a class="code" href="itkTreeContainerBase_8h.html">itkTreeContainerBase.h</a>></span> <a name="l00022"></a>00022 <span class="preprocessor">#include <<a class="code" href="itkPreOrderTreeIterator_8h.html">itkPreOrderTreeIterator.h</a>></span> <a name="l00023"></a>00023 <a name="l00024"></a>00024 <span class="keyword">namespace </span>itk <a name="l00025"></a>00025 { <a name="l00026"></a>00026 <a name="l00040"></a>00040 <span class="keyword">template</span> <<span class="keyword">class</span> TValueType> <a name="l00041"></a><a class="code" href="classitk_1_1TreeContainer.html">00041</a> <span class="keyword">class </span><a class="code" href="classitk_1_1TreeContainer.html" title="TreeContainer class.">TreeContainer</a> : <span class="keyword">public</span> <a class="code" href="classitk_1_1TreeContainerBase.html">TreeContainerBase</a><TValueType> <a name="l00042"></a>00042 { <a name="l00043"></a>00043 <a name="l00044"></a>00044 <span class="keyword">public</span>: <a name="l00045"></a>00045 <a name="l00047"></a><a class="code" href="classitk_1_1TreeContainer.html#1e42b2f2448246c667f6bf922e98a4f9">00047</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1TreeContainerBase.html">TreeContainerBase<TValueType></a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Superclass</a>; <a name="l00048"></a><a class="code" href="classitk_1_1TreeContainer.html#21befc7fa415f26e9ffa5ce5e66a2113">00048</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1TreeContainer.html" title="TreeContainer class.">TreeContainer<TValueType></a> <a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>; <a name="l00049"></a><a class="code" href="classitk_1_1TreeContainer.html#93e4347846522bfbd6d2596c1f04f8d2">00049</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">SmartPointer<Self></a> <a class="code" href="classitk_1_1SmartPointer.html">Pointer</a>; <a name="l00050"></a><a class="code" href="classitk_1_1TreeContainer.html#150aca1cbfabec0a6d5d0ee2305e3272">00050</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1SmartPointer.html">SmartPointer<const Self></a> <a class="code" href="classitk_1_1SmartPointer.html">ConstPointer</a>; <a name="l00051"></a><a class="code" href="classitk_1_1TreeContainer.html#e3afff5bd69553f6543596ae6ea23489">00051</a> <span class="keyword">typedef</span> TValueType <a class="code" href="classitk_1_1SpatialObject.html" title="Implementation of the composite pattern.">ValueType</a>; <a name="l00052"></a><a class="code" href="classitk_1_1TreeContainer.html#f4bc8f4fc747002e127ebd7bcfebc6c4">00052</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1TreeNode.html">TreeNode<ValueType></a> <a class="code" href="classitk_1_1TreeNode.html">TreeNodeType</a>; <a name="l00053"></a>00053 <a name="l00055"></a><a class="code" href="classitk_1_1TreeContainer.html#261b96890db84264396a7be78de4ccae">00055</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1TreeIteratorBase.html" title="TreeIteratorBase class.">TreeIteratorBase<Self></a> <a class="code" href="classitk_1_1TreeIteratorBase.html" title="TreeIteratorBase class.">IteratorType</a>; <a name="l00056"></a><a class="code" href="classitk_1_1TreeContainer.html#bf70544e32d30e0abf1c6be032c7f6e7">00056</a> <span class="keyword">typedef</span> <a class="code" href="classitk_1_1PreOrderTreeIterator.html">PreOrderTreeIterator<Self></a> <a class="code" href="classitk_1_1PreOrderTreeIterator.html">PreOrderIteratorType</a>; <a name="l00057"></a>00057 <a name="l00059"></a>00059 <a class="code" href="itkMacro_8h.html#0fdc15685afa271857c57e7cd482f30c">itkNewMacro</a>(<a class="code" href="classitk_1_1LightObject.html" title="Light weight base class for most itk classes.">Self</a>); <a name="l00060"></a>00060 <a name="l00062"></a>00062 <a class="code" href="itkMacro_8h.html#574c1f86661d409dd32c742307a0e96a">itkTypeMacro</a>(<a class="code" href="classitk_1_1TreeContainer.html" title="TreeContainer class.">TreeContainer</a>, <a class="code" href="classitk_1_1TreeContainerBase.html">TreeContainerBase</a>); <a name="l00063"></a>00063 <a name="l00065"></a>00065 <a class="code" href="classitk_1_1TreeContainer.html#ca3b099eb37dc79bf7605cdcb448269a">TreeContainer</a>( <span class="keywordtype">int</span> defaultChildrenCount ); <a name="l00066"></a>00066 <a name="l00068"></a>00068 <a class="code" href="classitk_1_1TreeContainer.html#ca3b099eb37dc79bf7605cdcb448269a">TreeContainer</a>( <a class="code" href="classitk_1_1TreeContainer.html" title="TreeContainer class.">TreeContainer<TValueType></a>& tree ); <a name="l00069"></a>00069 <a name="l00071"></a>00071 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classitk_1_1TreeContainer.html#f051e1be1f801c012598e9b8aff91795">SetRoot</a>( <span class="keyword">const</span> TValueType element); <a name="l00072"></a>00072 <a name="l00074"></a>00074 <span class="keywordtype">bool</span> <a class="code" href="classitk_1_1TreeContainer.html#f051e1be1f801c012598e9b8aff91795">SetRoot</a>( <a class="code" href="classitk_1_1TreeIteratorBase.html" title="TreeIteratorBase class.">IteratorType</a>& pos ); <a name="l00075"></a>00075 <a name="l00077"></a>00077 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classitk_1_1TreeContainer.html#f051e1be1f801c012598e9b8aff91795">SetRoot</a>( <a class="code" href="classitk_1_1TreeNode.html" title="TreeNode class.">TreeNode<TValueType></a>* node); <a name="l00078"></a>00078 <a name="l00080"></a>00080 <span class="keywordtype">bool</span> <a class="code" href="classitk_1_1TreeContainer.html#5aaf462bf96d304c709c319b06979dbc">Contains</a>( <span class="keyword">const</span> TValueType element ) ; <a name="l00081"></a>00081 <a name="l00083"></a>00083 <span class="keywordtype">int</span> <a class="code" href="classitk_1_1TreeContainer.html#226156c32e13bee38b86b2e79dd8008f">Count</a>() <span class="keyword">const</span>; <a name="l00084"></a>00084 <a name="l00086"></a>00086 <span class="keywordtype">bool</span> <a class="code" href="classitk_1_1TreeContainer.html#145824abcb0e0a0a4ac95a451fc36518">IsLeaf</a>( <span class="keyword">const</span> TValueType element ); <a name="l00087"></a>00087 <a name="l00089"></a>00089 <span class="keywordtype">bool</span> <a class="code" href="classitk_1_1TreeContainer.html#dd2931bce4ebcb9be335a44be1728ae4">IsRoot</a>( <span class="keyword">const</span> TValueType element ); <a name="l00090"></a>00090 <a name="l00092"></a>00092 <span class="keywordtype">bool</span> <a class="code" href="classitk_1_1TreeContainer.html#50702f7cead5f18e87a4359e346ac212">Clear</a>(); <a name="l00093"></a>00093 <a name="l00095"></a>00095 <span class="keywordtype">bool</span> <a class="code" href="classitk_1_1TreeContainer.html#efb99ea1c6d2e479a93ec0ace35a9509">operator==</a>( <a class="code" href="classitk_1_1TreeContainer.html" title="TreeContainer class.">TreeContainer<TValueType></a>& tree ); <a name="l00096"></a>00096 <a name="l00098"></a>00098 <span class="keywordtype">bool</span> <a class="code" href="classitk_1_1TreeContainer.html#d544cf2ffa156d73f4e6fdec64a1d00f">Swap</a>( <a class="code" href="classitk_1_1TreeIteratorBase.html" title="TreeIteratorBase class.">IteratorType</a>& v, <a class="code" href="classitk_1_1TreeIteratorBase.html" title="TreeIteratorBase class.">IteratorType</a>& w ); <a name="l00099"></a>00099 <a name="l00101"></a><a class="code" href="classitk_1_1TreeContainer.html#e8c6724c0a980384a6927f71ba7ce460">00101</a> <span class="keyword">const</span> <a class="code" href="classitk_1_1TreeNode.html">TreeNodeType</a>* <a class="code" href="classitk_1_1TreeContainer.html#e8c6724c0a980384a6927f71ba7ce460">GetRoot</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classitk_1_1TreeContainer.html#d5ae4989ea08ebb24e4ac3da14e52133">m_Root</a>.<a class="code" href="classitk_1_1SmartPointer.html#0734d2308d93e0ca10199b79531db5de">GetPointer</a>();} <a name="l00102"></a>00102 <a name="l00104"></a>00104 <span class="keywordtype">bool</span> <a class="code" href="classitk_1_1TreeContainer.html#0e39ff1999a78644d660a20d9c6cef47">Add</a>(<span class="keyword">const</span> TValueType child, <span class="keyword">const</span> TValueType parent); <a name="l00105"></a>00105 <a name="l00107"></a>00107 <span class="keyword">const</span> <a class="code" href="classitk_1_1TreeContainer.html#f4bc8f4fc747002e127ebd7bcfebc6c4">TreeNodeType</a>* <a class="code" href="classitk_1_1TreeContainer.html#6e8aca4147e5e91870ce58fc3055160e">GetNode</a>(TValueType val) <span class="keyword">const</span>; <a name="l00108"></a>00108 <a name="l00109"></a>00109 <span class="keyword">protected</span>: <a name="l00110"></a>00110 <a name="l00111"></a>00111 <a class="code" href="classitk_1_1TreeContainer.html#ca3b099eb37dc79bf7605cdcb448269a">TreeContainer</a>(); <a name="l00112"></a>00112 <span class="keyword">virtual</span> <a class="code" href="classitk_1_1TreeContainer.html#a672ce8741c7fc4e4d18d7b639cefbfb">~TreeContainer</a>(); <a name="l00113"></a>00113 <a name="l00114"></a><a class="code" href="classitk_1_1TreeContainer.html#d5ae4989ea08ebb24e4ac3da14e52133">00114</a> <span class="keyword">typename</span> <a class="code" href="classitk_1_1SmartPointer.html">TreeNodeType::Pointer</a> <a class="code" href="classitk_1_1TreeContainer.html#d5ae4989ea08ebb24e4ac3da14e52133">m_Root</a>; <a name="l00115"></a><a class="code" href="classitk_1_1TreeContainer.html#4838470cd3859e3d55131baf6bf61d5c">00115</a> <span class="keywordtype">int</span> <a class="code" href="classitk_1_1TreeContainer.html#4838470cd3859e3d55131baf6bf61d5c">m_DefaultChildrenCount</a>; <a name="l00116"></a>00116 <a name="l00117"></a>00117 <span class="keywordtype">void</span> <a class="code" href="classitk_1_1TreeContainer.html#ff027baa46a9cfd9cd2d65d761ab64e4">PrintSelf</a>(std::ostream& os, <a class="code" href="classitk_1_1Indent.html" title="Control indentation during Print() invocation.">Indent</a> indent) <span class="keyword">const</span>; <a name="l00118"></a>00118 <a name="l00119"></a>00119 }; <a name="l00120"></a>00120 <a name="l00121"></a>00121 } <span class="comment">// namespace itk</span> <a name="l00122"></a>00122 <a name="l00123"></a>00123 <span class="comment">// Define instantiation macro for this template.</span> <a name="l00124"></a><a class="code" href="itkTreeContainer_8h.html#d3cb6e5ffa138231c2a7a405a0137a8b">00124</a> <span class="preprocessor">#define ITK_TEMPLATE_TreeContainer(_, EXPORT, x, y) namespace itk { \</span> <a name="l00125"></a>00125 <span class="preprocessor"> _(1(class EXPORT TreeContainer< ITK_TEMPLATE_1 x >)) \</span> <a name="l00126"></a>00126 <span class="preprocessor"> namespace Templates { typedef TreeContainer< ITK_TEMPLATE_1 x > \</span> <a name="l00127"></a>00127 <span class="preprocessor"> TreeContainer##y; } \</span> <a name="l00128"></a>00128 <span class="preprocessor"> }</span> <a name="l00129"></a>00129 <span class="preprocessor"></span> <a name="l00130"></a>00130 <span class="preprocessor">#if ITK_TEMPLATE_EXPLICIT</span> <a name="l00131"></a>00131 <span class="preprocessor"></span><span class="preprocessor"># include "Templates/itkTreeContainer+-.h"</span> <a name="l00132"></a>00132 <span class="preprocessor">#endif</span> <a name="l00133"></a>00133 <span class="preprocessor"></span> <a name="l00134"></a>00134 <span class="preprocessor">#if ITK_TEMPLATE_TXX</span> <a name="l00135"></a>00135 <span class="preprocessor"></span><span class="preprocessor"># include "itkTreeContainer.txx"</span> <a name="l00136"></a>00136 <span class="preprocessor">#endif</span> <a name="l00137"></a>00137 <span class="preprocessor"></span> <a name="l00138"></a>00138 <span class="preprocessor">#endif</span> <a name="l00139"></a>00139 <span class="preprocessor"></span> </pre></div></div> <hr><address><small> Generated at Fri May 8 00:23:43 2009 for ITK by <a href="http://www.stack.nl/~dimitri/doxygen/index.html"> <img src="http://www.stack.nl/~dimitri/doxygen/doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53> </a> 1.5.9 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2000</small></address> </body> </html>