ITK  5.1.0
Insight Toolkit
itkTreeContainerBase.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 itkTreeContainerBase_h
19 #define itkTreeContainerBase_h
20 
21 #include "itkMacro.h"
22 #include <iostream>
23 #include "itkTreeNode.h"
24 
25 namespace itk
26 {
33 template <typename TValue>
34 class TreeContainerBase : public Object
35 {
36 public:
37  using Superclass = Object;
41 
42  using ValueType = TValue;
43 
45  itkTypeMacro(TreeContainerBase, Object);
46 
49  virtual bool
50  SetRoot(const TValue element) = 0;
51 
53  virtual bool
54  SetRoot(TreeNode<TValue> * node) = 0;
55 
57  virtual bool
58  Contains(const TValue element) = 0;
59 
61  virtual int
62  Count() const = 0;
63 
65  virtual bool
66  IsLeaf(const TValue element) = 0;
67 
69  virtual bool
70  IsRoot(const TValue element) = 0;
71 
73  virtual bool
74  Clear() = 0;
75 
77  virtual const TreeNode<TValue> *
78  GetRoot() const = 0;
79 
81  void
82  SetSubtree(bool val)
83  {
84  m_SubTree = val;
85  }
86 
87 protected:
89  ~TreeContainerBase() override = default;
90  bool m_SubTree{ false };
91 };
92 } // namespace itk
93 
94 #endif
itk::TreeNode
Represents a node in a tree.
Definition: itkTreeNode.h:43
itk::TreeContainerBase::Clear
virtual bool Clear()=0
itk::TreeContainerBase::IsRoot
virtual bool IsRoot(const TValue element)=0
itk::TreeContainerBase::IsLeaf
virtual bool IsLeaf(const TValue element)=0
itk::TreeContainerBase::SetSubtree
void SetSubtree(bool val)
Definition: itkTreeContainerBase.h:82
itk::TreeContainerBase::ValueType
TValue ValueType
Definition: itkTreeContainerBase.h:42
itk::SmartPointer< Self >
itk::TreeContainerBase::TreeContainerBase
TreeContainerBase()
Definition: itkTreeContainerBase.h:88
itk::TreeContainerBase::m_SubTree
bool m_SubTree
Definition: itkTreeContainerBase.h:90
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itkMacro.h
itk::TreeContainerBase
A base class for tree containers.
Definition: itkTreeContainerBase.h:34
itk::TreeContainerBase::Contains
virtual bool Contains(const TValue element)=0
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkArray.h:26
itk::TreeContainerBase::SetRoot
virtual bool SetRoot(const TValue element)=0
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:60
itk::TreeContainerBase::~TreeContainerBase
~TreeContainerBase() override=default
itkTreeNode.h
itk::TreeContainerBase::GetRoot
virtual const TreeNode< TValue > * GetRoot() const =0
itk::Object::Object
Object()
itk::TreeContainerBase::Count
virtual int Count() const =0