ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkTreeContainerBase.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkTreeContainerBase_h
00019 #define __itkTreeContainerBase_h
00020 
00021 #include "itkMacro.h"
00022 #include <iostream>
00023 #include "itkTreeNode.h"
00024 
00025 namespace itk
00026 {
00033 template< class TValueType >
00034 class TreeContainerBase:public Object
00035 {
00036 public:
00037 
00038   typedef Object                     Superclass;
00039   typedef TreeContainerBase          Self;
00040   typedef SmartPointer< Self >       Pointer;
00041   typedef SmartPointer< const Self > ConstPointer;
00042 
00043   typedef TValueType ValueType;
00044 
00046   itkTypeMacro(TreeContainerBase, Object);
00047 
00050   virtual bool SetRoot(const TValueType element) = 0;
00051 
00053   virtual bool SetRoot(TreeNode< TValueType > *node) = 0;
00054 
00056   virtual bool Contains(const TValueType element) = 0;
00057 
00059   virtual int Count() const = 0;
00060 
00062   virtual bool IsLeaf(const TValueType element) = 0;
00063 
00065   virtual bool IsRoot(const TValueType element) = 0;
00066 
00068   virtual bool Clear() = 0;
00069 
00071   virtual const TreeNode< TValueType > * GetRoot() const = 0;
00072 
00074   void SetSubtree(bool val) { m_SubTree = val; }
00075 protected:
00076 
00077   TreeContainerBase() : m_SubTree(false) {}
00078   virtual ~TreeContainerBase() {}
00079   bool m_SubTree;
00080 };
00081 } // namespace itk
00082 
00083 #endif
00084