Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkTreeContainer.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkTreeContainer.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/01/30 20:56:09 $
00007   Version:   $Revision: 1.3 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __itkTreeContainer_h
00018 #define __itkTreeContainer_h
00019 
00020 #include "itkMacro.h"
00021 #include <itkTreeContainerBase.h>
00022 #include <itkPreOrderTreeIterator.h>
00023 
00024 namespace itk
00025 {
00026 
00040 template <class TValueType>
00041 class TreeContainer : public TreeContainerBase<TValueType>
00042 {
00043 
00044 public:
00045 
00047   typedef TreeContainerBase<TValueType> Superclass;
00048   typedef TreeContainer<TValueType> Self;
00049   typedef SmartPointer<Self>  Pointer;
00050   typedef SmartPointer<const Self>  ConstPointer;
00051   typedef TValueType ValueType;
00052   typedef TreeNode<ValueType> TreeNodeType;
00053 
00055   typedef TreeIteratorBase<Self> IteratorType;
00056   typedef PreOrderTreeIterator<Self> PreOrderIteratorType;
00057 
00059   itkNewMacro(Self);
00060 
00062   itkTypeMacro(TreeContainer, TreeContainerBase);
00063 
00065   TreeContainer( int defaultChildrenCount );
00066 
00068   TreeContainer( TreeContainer<TValueType>& tree );
00069 
00071   virtual bool SetRoot( TValueType element);
00072 
00074   bool SetRoot( IteratorType& pos );
00075 
00077   virtual bool SetRoot( TreeNode<TValueType>* node);
00078 
00080   bool Contains( const TValueType element ) ;
00081 
00083   int Count() const;
00084 
00086   bool IsLeaf( const TValueType element );
00087 
00089   bool IsRoot( const TValueType element );
00090 
00092   bool Clear();
00093 
00095   bool operator==( TreeContainer<TValueType>& tree );
00096 
00098   bool Swap( IteratorType& v, IteratorType& w );
00099 
00101   const TreeNodeType* GetRoot() const {return m_Root.GetPointer();}
00102 
00104   bool Add(const TValueType child, const TValueType parent);
00105 
00107   const TreeNodeType* GetNode(TValueType val) const;
00108 
00109 protected:
00110   
00111   TreeContainer(); 
00112   virtual ~TreeContainer();
00113 
00114   typename TreeNodeType::Pointer    m_Root;
00115   int   m_DefaultChildrenCount;
00116 
00117   void PrintSelf(std::ostream& os, Indent indent) const;
00118 
00119 };
00120 
00121 } // namespace itk
00122 
00123 // Define instantiation macro for this template.
00124 #define ITK_TEMPLATE_TreeContainer(_, EXPORT, x, y) namespace itk { \
00125   _(1(class EXPORT TreeContainer< ITK_TEMPLATE_1 x >)) \
00126   namespace Templates { typedef TreeContainer< ITK_TEMPLATE_1 x > \
00127                                                   TreeContainer##y; } \
00128   }
00129 
00130 #if ITK_TEMPLATE_EXPLICIT
00131 # include "Templates/itkTreeContainer+-.h"
00132 #endif
00133 
00134 #if ITK_TEMPLATE_TXX
00135 # include "itkTreeContainer.txx"
00136 #endif
00137 
00138 #endif
00139 

Generated at Sun Sep 23 14:27:12 2007 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000