KWStyle - itkTreeContainerBase.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkTreeContainerBase.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:48 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 #ifndef __itkTreeContainerBase_h
18 #define __itkTreeContainerBase_h
19
20 #include "itkMacro.h"
21 #include <itkObject.h>
22 #include <iostream>
23 #include <itkObjectFactory.h>
24 #include <itkTreeNode.h>
25
26 namespace itk
27 {
28
29
30 template <class TValueType>
31 class TreeContainerBase : public Object
32 {
33  
34 public:
35
36   typedef Object Superclass;
37 TDA   typedef TreeContainerBase Self;
38 TDA   typedef SmartPointer<Self>  Pointer;
39 TDA   typedef SmartPointer<const Self>  ConstPointer;
40
41   typedef TValueType ValueType;
42
43   /** Run-time type information (and related methods). */
44   itkTypeMacro(TreeContainerBase, Object);
45
46   /** Set the root element. 
47    * A new node is created and the element is added to the node */
48   virtual bool SetRoot( TValueType element ) = 0;
49
50   /** Set the root has a node */
51   virtual bool SetRoot( TreeNode<TValueType>* node) = 0;
52
53   /** Return true if the tree contains the element */
54   virtual bool Contains( const TValueType element ) = 0;
55
56   /** Return the number of nodes in the tree */
57   virtual int Count() const = 0;
58
59   /** Return if the element is a leaf */
60   virtual bool IsLeaf( const TValueType element ) = 0;
61   
62   /** Return if the element is root */
63   virtual bool IsRoot( const TValueType element ) = 0;
64
65   /** Clear the tree */
66   virtual bool Clear() = 0;
67
68   /** Get the root as a node */
69   virtual const TreeNode<TValueType>* GetRoot() const = 0;
70   
71   /** Set if the tree is a subtree */
72   void SetSubtree(bool val) {m_SubTree = val;}
73
74 protected:
75
76   TreeContainerBase() {}; 
77   virtual ~TreeContainerBase() {}; 
78   bool  m_SubTree;
79
80 };
81
82
83 EML
84 // namespace itk
85
86 #endif
87
88 EOF

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:50PM
© Kitware Inc.