ITK  5.0.0
Insight Segmentation and Registration 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 >
35 {
36 public:
37 
38  using Superclass = Object;
42 
43  using ValueType = TValue;
44 
46  itkTypeMacro(TreeContainerBase, Object);
47 
50  virtual bool SetRoot(const TValue element) = 0;
51 
53  virtual bool SetRoot(TreeNode< TValue > *node) = 0;
54 
56  virtual bool Contains(const TValue element) = 0;
57 
59  virtual int Count() const = 0;
60 
62  virtual bool IsLeaf(const TValue element) = 0;
63 
65  virtual bool IsRoot(const TValue element) = 0;
66 
68  virtual bool Clear() = 0;
69 
71  virtual const TreeNode< TValue > * GetRoot() const = 0;
72 
74  void SetSubtree(bool val) { m_SubTree = val; }
75 
76 protected:
77 
79  ~TreeContainerBase() override = default;
80  bool m_SubTree{false};
81 };
82 } // namespace itk
83 
84 #endif
virtual bool Contains(const TValue element)=0
Light weight base class for most itk classes.
Represents a node in a tree.
Definition: itkTreeNode.h:43
virtual const TreeNode< TValue > * GetRoot() const =0
virtual int Count() const =0
virtual bool SetRoot(const TValue element)=0
virtual bool IsLeaf(const TValue element)=0
virtual bool IsRoot(const TValue element)=0
~TreeContainerBase() override=default
virtual bool Clear()=0
A base class for tree containers.
Base class for most ITK classes.
Definition: itkObject.h:60