KWStyle - itkTreeChangeEvent.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkTreeChangeEvent.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:48 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) Insight Software Consortium. All rights reserved.
10   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notices for more information.
15
16 =========================================================================*/
17 DEF #ifndef __TreeChangeEvent_h
18 DEF #define __TreeChangeEvent_h
19
20 #include "itkMacro.h"
21 #include <itkObject.h>
22 #include <itkTreeIteratorBase.h>
23
24 namespace itk
25 {
26
27 /** \class TreeChangeEvent
28 LEN  *  \brief This class derives from ModifiedEvent and check if the position of a node
29  *  in the tree has been changed
30  */
31 template <class TTreeType>
32 class TreeChangeEvent : public ModifiedEvent
33
34 public: 
35
36   /** Typedefs */
37   typedef TreeChangeEvent Self; 
38 TDA   typedef ModifiedEvent Superclass; 
39
40   /** Constructor */
41   TreeChangeEvent()
42     {
43     m_ChangePosition = NULL;
44     }
45
46   /** Copy constructor */
47   TreeChangeEvent(const TreeIteratorBase<TTreeType>& position)
48     {
49     m_ChangePosition = &position;
50     } 
51
52   /** Destructor */
53   virtual ~TreeChangeEvent() {} 
54
55   /** Get the event name */
56   virtual const char * GetEventName() const 
57     { 
58     return "TreeChangeEvent"; 
59     } 
60
61   /** Check the event */
62   virtual bool CheckEvent(const ::itk::EventObject* e) const 
63     { 
64     return dynamic_cast<const Self*>(e); 
65     } 
66
67   /** Make the event object */
68   virtual ::itk::EventObject* MakeObject() const 
69     { 
70     return new Self( *m_ChangePosition ); 
71     } 
72
73   /** Get the change position */
74   const TreeIteratorBase<TTreeType>& GetChangePosition() const 
75     { 
76     return *m_ChangePosition; 
77     }
78
79 private: 
80
81 IND //   TreeChangeEvent(const Self&); 
82   void operator=(const Self&); 
83
84 protected:
85
86   const TreeIteratorBase<TTreeType>* m_ChangePosition;
87 };
88
89
90 /** \class TreeAddEvent
91  *  \brief This class derives from TreeChangeEvent and check if a node has been
92  *  added to the tree
93  */
94 template <class TTreeType>
95 class TreeAddEvent : public TreeChangeEvent<TTreeType>
96 {  
97 public:
98
99   /** Typedefs */
100   typedef TreeAddEvent Self; 
101 TDA   typedef TreeChangeEvent<TTreeType> Superclass; 
102
103   /** Constructor */
104   TreeAddEvent() {}
105
106   /** Copy constructor */
107   TreeAddEvent( const TreeIteratorBase<TTreeType>& position ) : 
108 IND ****TreeChangeEvent<TTreeType>(position) {} 
109
110   /** Get the name of the event */
111   virtual const char * GetEventName() const 
112     { 
113     return "TreeAddEvent"; 
114     } 
115
116   /** Check event function */
117   virtual bool CheckEvent(const ::itk::EventObject* e) const 
118     { 
119     return dynamic_cast<const Self*>(e); 
120     } 
121
122   /** Make the event object */     
123   virtual ::itk::EventObject* MakeObject() const 
124     { 
125     return new Self( *this->m_ChangePosition ); 
126     }  
127 };
128
129
130 /** \class TreeRemoveEvent
131  *  \brief This class derives from TreeChangeEvent and check if a node has been
132  *  removed from the tree
133  */
134 template <class TTreeType>
135 class TreeRemoveEvent : public TreeChangeEvent<TTreeType>
136 {
137 public:
138  
139   /** Typedefs */
140   typedef TreeRemoveEvent Self; 
141 TDA   typedef TreeChangeEvent<TTreeType> Superclass; 
142
143   /** Constructor */
144   TreeRemoveEvent(){}
145
146   /** Copy constructor */
147   TreeRemoveEvent( const TreeIteratorBase<TTreeType>& position ) : 
148   TreeChangeEvent<TTreeType>(position) {} 
149
150   /** Get the event name */
151   virtual const char * GetEventName() const 
152     { 
153     return "TreeRemoveEvent"; 
154     } 
155
156   /** Check the event */
157   virtual bool CheckEvent(const ::itk::EventObject* e) const 
158     { 
159     return dynamic_cast<const Self*>(e); 
160     } 
161
162   /** Make the event object */     
163   virtual ::itk::EventObject* MakeObject() const 
164     { 
165     return new Self( *this->m_ChangePosition ); 
166     } 
167 IND **};
168   
169 // namespace itk
170
171 #endif
172

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:50PM
© Kitware Inc.