Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkTreeChangeEvent.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkTreeChangeEvent.h,v $
00005   Language:  C++
00006   Date:      $Date: 2004/12/21 22:47:32 $
00007   Version:   $Revision: 1.2 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 #ifndef __TreeChangeEvent_h
00018 #define __TreeChangeEvent_h
00019 
00020 #include "itkMacro.h"
00021 #include <itkObject.h>
00022 #include <itkTreeIteratorBase.h>
00023 
00024 namespace itk
00025 {
00026 
00031 template <class TTreeType>
00032 class TreeChangeEvent : public ModifiedEvent
00033 { 
00034 public: 
00035 
00037   typedef TreeChangeEvent Self; 
00038   typedef ModifiedEvent Superclass; 
00039 
00041   TreeChangeEvent()
00042     {
00043     m_ChangePosition = NULL;
00044     }
00045 
00047   TreeChangeEvent(const TreeIteratorBase<TTreeType>& position)
00048     {
00049     m_ChangePosition = &position;
00050     } 
00051 
00053   virtual ~TreeChangeEvent() {} 
00054 
00056   virtual const char * GetEventName() const 
00057     { 
00058     return "TreeChangeEvent"; 
00059     } 
00060 
00062   virtual bool CheckEvent(const ::itk::EventObject* e) const 
00063     { 
00064     return dynamic_cast<const Self*>(e); 
00065     } 
00066 
00068   virtual ::itk::EventObject* MakeObject() const 
00069     { 
00070     return new Self( *m_ChangePosition ); 
00071     } 
00072 
00074   const TreeIteratorBase<TTreeType>& GetChangePosition() const 
00075     { 
00076     return *m_ChangePosition; 
00077     }
00078 
00079 private: 
00080 
00081 //   TreeChangeEvent(const Self&); 
00082   void operator=(const Self&); 
00083 
00084 protected:
00085 
00086   const TreeIteratorBase<TTreeType>* m_ChangePosition;
00087 };
00088 
00089 
00094 template <class TTreeType>
00095 class TreeAddEvent : public TreeChangeEvent<TTreeType>
00096 {  
00097 public:
00098 
00100   typedef TreeAddEvent Self; 
00101   typedef TreeChangeEvent<TTreeType> Superclass; 
00102 
00104   TreeAddEvent() {}
00105 
00107   TreeAddEvent( const TreeIteratorBase<TTreeType>& position ) : 
00108     TreeChangeEvent<TTreeType>(position) {} 
00109 
00111   virtual const char * GetEventName() const 
00112     { 
00113     return "TreeAddEvent"; 
00114     } 
00115 
00117   virtual bool CheckEvent(const ::itk::EventObject* e) const 
00118     { 
00119     return dynamic_cast<const Self*>(e); 
00120     } 
00121 
00123   virtual ::itk::EventObject* MakeObject() const 
00124     { 
00125     return new Self( *this->m_ChangePosition ); 
00126     }  
00127 };
00128 
00129 
00134 template <class TTreeType>
00135 class TreeRemoveEvent : public TreeChangeEvent<TTreeType>
00136 {
00137 public:
00138  
00140   typedef TreeRemoveEvent Self; 
00141   typedef TreeChangeEvent<TTreeType> Superclass; 
00142 
00144   TreeRemoveEvent(){}
00145 
00147   TreeRemoveEvent( const TreeIteratorBase<TTreeType>& position ) : 
00148   TreeChangeEvent<TTreeType>(position) {} 
00149 
00151   virtual const char * GetEventName() const 
00152     { 
00153     return "TreeRemoveEvent"; 
00154     } 
00155 
00157   virtual bool CheckEvent(const ::itk::EventObject* e) const 
00158     { 
00159     return dynamic_cast<const Self*>(e); 
00160     } 
00161 
00163   virtual ::itk::EventObject* MakeObject() const 
00164     { 
00165     return new Self( *this->m_ChangePosition ); 
00166     } 
00167   };
00168   
00169 } // namespace itk
00170 
00171 #endif

Generated at Thu May 25 00:09:37 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000