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: 2008-06-20 20:28:48 $
00007   Version:   $Revision: 1.3 $
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 <itkEventObject.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   TreeChangeEvent(const Self&s) : itk::ModifiedEvent(s) {}; 
00080 
00081 private:
00082   void operator=(const Self&); 
00083 
00084 protected:
00085 
00086   const TreeIteratorBase<TTreeType>* m_ChangePosition;
00087 };
00088 
00090 template <class TTreeType>
00091 class TreeNodeChangeEvent : public TreeChangeEvent<TTreeType>
00092 {  
00093 public:
00094   typedef TreeNodeChangeEvent Self; 
00095   typedef TreeChangeEvent<TTreeType> Superclass; 
00096 
00097   TreeNodeChangeEvent() {}
00098 
00099   TreeNodeChangeEvent( const TreeIteratorBase<TTreeType>& position ) : 
00100     TreeChangeEvent<TTreeType>(position) {} 
00101 
00102   virtual const char * GetEventName() const 
00103     { 
00104     return "TreeNodeChangeEvent"; 
00105     } 
00106 
00107   virtual bool CheckEvent(const ::itk::EventObject* e) const 
00108     { 
00109     return dynamic_cast<const Self*>(e); 
00110     } 
00111 
00112   virtual ::itk::EventObject* MakeObject() const 
00113     { 
00114     return new Self( *this->m_ChangePosition ); 
00115     } 
00116 
00117   TreeNodeChangeEvent(const Self&s) : TreeChangeEvent<TTreeType>(s) {}
00118 private:
00119   void operator=(const Self&);
00120 
00121 };
00122 
00127 template <class TTreeType>
00128 class TreeAddEvent : public TreeChangeEvent<TTreeType>
00129 {  
00130 public:
00131 
00133   typedef TreeAddEvent Self; 
00134   typedef TreeChangeEvent<TTreeType> Superclass; 
00135 
00137   TreeAddEvent() {}
00138 
00140   TreeAddEvent( const TreeIteratorBase<TTreeType>& position ) : 
00141     TreeChangeEvent<TTreeType>(position) {} 
00142 
00144   virtual const char * GetEventName() const 
00145     { 
00146     return "TreeAddEvent"; 
00147     } 
00148 
00150   virtual bool CheckEvent(const ::itk::EventObject* e) const 
00151     { 
00152     return dynamic_cast<const Self*>(e); 
00153     } 
00154 
00156   virtual ::itk::EventObject* MakeObject() const 
00157     { 
00158     return new Self( *this->m_ChangePosition ); 
00159     }  
00160 
00161   TreeAddEvent(const Self&s) : TreeChangeEvent<TTreeType>(s) {}
00162 private:
00163   void operator=(const Self&);
00164   
00165 };
00166 
00167 
00172 template <class TTreeType>
00173 class TreeRemoveEvent : public TreeChangeEvent<TTreeType>
00174 {
00175 public:
00176  
00178   typedef TreeRemoveEvent Self; 
00179   typedef TreeChangeEvent<TTreeType> Superclass; 
00180 
00182   TreeRemoveEvent(){}
00183 
00185   TreeRemoveEvent( const TreeIteratorBase<TTreeType>& position ) : 
00186   TreeChangeEvent<TTreeType>(position) {} 
00187 
00189   virtual const char * GetEventName() const 
00190     { 
00191     return "TreeRemoveEvent"; 
00192     } 
00193 
00195   virtual bool CheckEvent(const ::itk::EventObject* e) const 
00196     { 
00197     return dynamic_cast<const Self*>(e); 
00198     } 
00199 
00201   virtual ::itk::EventObject* MakeObject() const 
00202     { 
00203     return new Self( *this->m_ChangePosition ); 
00204     } 
00205 
00206     TreeRemoveEvent(const Self&s) : TreeChangeEvent<TTreeType>(s) {}
00207 
00208 private:
00209     void operator=(const Self&);
00210 };
00211 
00213 template <class TTreeType>
00214 class TreePruneEvent : public TreeRemoveEvent<TTreeType>
00215 {
00216 public:
00217   typedef TreePruneEvent Self; 
00218   typedef TreeRemoveEvent<TTreeType> Superclass; 
00219 
00221   TreePruneEvent(){}
00222 
00224   TreePruneEvent( const TreeIteratorBase<TTreeType>& position ) : 
00225     TreeRemoveEvent<TTreeType>(position) {} 
00226 
00228   virtual const char * GetEventName() const 
00229   { 
00230     return "TreePruneEvent"; 
00231   } 
00232 
00234   virtual bool CheckEvent(const ::itk::EventObject* e) const 
00235   { 
00236     return dynamic_cast<const Self*>(e); 
00237   } 
00238 
00240   virtual ::itk::EventObject* MakeObject() const 
00241   { 
00242     return new Self( *this->m_ChangePosition ); 
00243   } 
00244 
00245   TreePruneEvent(const Self& s) : TreeRemoveEvent<TTreeType>(s) {}
00246 private:
00247   void operator=(const Self&);
00248 };
00249   
00250 } // namespace itk
00251 
00252 #endif
00253 

Generated at Tue Jul 29 22:59:42 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000