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: 2009-03-03 15:10:32 $
00007   Version:   $Revision: 1.4 $
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 __itkTreeChangeEvent_h
00018 #define __itkTreeChangeEvent_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 protected:
00082 
00083   const TreeIteratorBase<TTreeType>* m_ChangePosition;
00084 
00085 private:
00086   void operator=(const Self&); 
00087 
00088 };
00089 
00093 template <class TTreeType>
00094 class TreeNodeChangeEvent : public TreeChangeEvent<TTreeType>
00095 {  
00096 public:
00097   typedef TreeNodeChangeEvent Self; 
00098   typedef TreeChangeEvent<TTreeType> Superclass; 
00099 
00100   TreeNodeChangeEvent() {}
00101 
00102   TreeNodeChangeEvent( const TreeIteratorBase<TTreeType>& position ) : 
00103     TreeChangeEvent<TTreeType>(position) {} 
00104 
00105   virtual const char * GetEventName() const 
00106     { 
00107     return "TreeNodeChangeEvent"; 
00108     } 
00109 
00110   virtual bool CheckEvent(const ::itk::EventObject* e) const 
00111     { 
00112     return dynamic_cast<const Self*>(e); 
00113     } 
00114 
00115   virtual ::itk::EventObject* MakeObject() const 
00116     { 
00117     return new Self( *this->m_ChangePosition ); 
00118     } 
00119 
00120   TreeNodeChangeEvent(const Self&s) : TreeChangeEvent<TTreeType>(s) {}
00121 private:
00122   void operator=(const Self&);
00123 
00124 };
00125 
00130 template <class TTreeType>
00131 class TreeAddEvent : public TreeChangeEvent<TTreeType>
00132 {  
00133 public:
00134 
00136   typedef TreeAddEvent               Self; 
00137   typedef TreeChangeEvent<TTreeType> Superclass; 
00138 
00140   TreeAddEvent() {}
00141 
00143   TreeAddEvent( const TreeIteratorBase<TTreeType>& position ) : 
00144     TreeChangeEvent<TTreeType>(position) {} 
00145 
00147   virtual const char * GetEventName() const 
00148     { 
00149     return "TreeAddEvent"; 
00150     } 
00151 
00153   virtual bool CheckEvent(const ::itk::EventObject* e) const 
00154     { 
00155     return dynamic_cast<const Self*>(e); 
00156     } 
00157 
00159   virtual ::itk::EventObject* MakeObject() const 
00160     { 
00161     return new Self( *this->m_ChangePosition ); 
00162     }  
00163 
00164   TreeAddEvent(const Self&s) : TreeChangeEvent<TTreeType>(s) {}
00165 private:
00166   void operator=(const Self&);
00167   
00168 };
00169 
00170 
00175 template <class TTreeType>
00176 class TreeRemoveEvent : public TreeChangeEvent<TTreeType>
00177 {
00178 public:
00179  
00181   typedef TreeRemoveEvent Self; 
00182   typedef TreeChangeEvent<TTreeType> Superclass; 
00183 
00185   TreeRemoveEvent(){}
00186 
00188   TreeRemoveEvent( const TreeIteratorBase<TTreeType>& position ) : 
00189   TreeChangeEvent<TTreeType>(position) {} 
00190 
00192   virtual const char * GetEventName() const 
00193     { 
00194     return "TreeRemoveEvent"; 
00195     } 
00196 
00198   virtual bool CheckEvent(const ::itk::EventObject* e) const 
00199     { 
00200     return dynamic_cast<const Self*>(e); 
00201     } 
00202 
00204   virtual ::itk::EventObject* MakeObject() const 
00205     { 
00206     return new Self( *this->m_ChangePosition ); 
00207     } 
00208 
00209   TreeRemoveEvent(const Self&s) : TreeChangeEvent<TTreeType>(s) {}
00210 
00211 private:
00212     void operator=(const Self&);
00213 };
00214 
00218 template <class TTreeType>
00219 class TreePruneEvent : public TreeRemoveEvent<TTreeType>
00220 {
00221 public:
00222   typedef TreePruneEvent Self; 
00223   typedef TreeRemoveEvent<TTreeType> Superclass; 
00224 
00226   TreePruneEvent(){}
00227 
00229   TreePruneEvent( const TreeIteratorBase<TTreeType>& position ) : 
00230     TreeRemoveEvent<TTreeType>(position) {} 
00231 
00233   virtual const char * GetEventName() const 
00234     { 
00235     return "TreePruneEvent"; 
00236     }
00237 
00239   virtual bool CheckEvent(const ::itk::EventObject* e) const 
00240     { 
00241     return dynamic_cast<const Self*>(e); 
00242     }
00243 
00245   virtual ::itk::EventObject* MakeObject() const 
00246     {
00247     return new Self( *this->m_ChangePosition ); 
00248     }
00249 
00250   TreePruneEvent(const Self& s) : TreeRemoveEvent<TTreeType>(s) {}
00251 private:
00252   void operator=(const Self&);
00253 };
00254   
00255 } // namespace itk
00256 
00257 #endif
00258 

Generated at Fri Apr 16 19:50:13 2010 for ITK by doxygen 1.6.1 written by Dimitri van Heesch, © 1997-2000