ITK  4.9.0
Insight Segmentation and Registration Toolkit
itkTreeContainer.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef itkTreeContainer_h
19 #define itkTreeContainer_h
20 
21 #include "itkTreeContainerBase.h"
23 
24 namespace itk
25 {
37 template< typename TValue >
38 class TreeContainer:public TreeContainerBase< TValue >
39 {
40 public:
41 
47  typedef TValue ValueType;
49 
53 
55  itkNewMacro(Self);
56 
58  itkTypeMacro(TreeContainer, TreeContainerBase);
59 
61  TreeContainer(int defaultChildrenCount);
62 
65 
67  virtual bool SetRoot(const TValue element) ITK_OVERRIDE;
68 
70  bool SetRoot(IteratorType & pos);
71 
73  virtual bool SetRoot(TreeNode< TValue > *node) ITK_OVERRIDE;
74 
76  bool Contains(const TValue element) ITK_OVERRIDE;
77 
79  int Count() const ITK_OVERRIDE;
80 
82  bool IsLeaf(const TValue element) ITK_OVERRIDE;
83 
85  bool IsRoot(const TValue element) ITK_OVERRIDE;
86 
88  bool Clear() ITK_OVERRIDE;
89 
91  bool operator==(TreeContainer< TValue > & tree);
92 
94  bool Swap(IteratorType & v, IteratorType & w);
95 
97  const TreeNodeType * GetRoot() const ITK_OVERRIDE { return m_Root.GetPointer(); }
98 
100  bool Add(const TValue child, const TValue parent);
101 
103  const TreeNodeType * GetNode(TValue val) const;
104 
105 protected:
106 
107  TreeContainer();
108  virtual ~TreeContainer();
109 
111 
113 
114  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
115 };
116 } // namespace itk
117 
118 #ifndef ITK_MANUAL_INSTANTIATION
119 #include "itkTreeContainer.hxx"
120 #endif
121 
122 #endif
bool IsRoot(const TValue element) override
Light weight base class for most itk classes.
Represents a node in a tree.
Definition: itkTreeNode.h:43
TreeIteratorBase< Self > IteratorType
virtual ~TreeContainer()
TreeContainer< TValue > Self
bool Add(const TValue child, const TValue parent)
TreeNode< ValueType > TreeNodeType
PreOrderTreeIterator< Self > PreOrderIteratorType
ObjectType * GetPointer() const
bool IsLeaf(const TValue element) override
bool Swap(IteratorType &v, IteratorType &w)
virtual bool SetRoot(const TValue element) override
void PrintSelf(std::ostream &os, Indent indent) const override
SmartPointer< const Self > ConstPointer
TreeContainerBase< TValue > Superclass
int Count() const override
bool Contains(const TValue element) override
A tree container.
const TreeNodeType * GetNode(TValue val) const
This class provides the base implementation for tree iterators.
A base class for tree containers.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
const TreeNodeType * GetRoot() const override
TreeNodeType::Pointer m_Root
SmartPointer< Self > Pointer
bool Clear() override