ITK  4.2.0
Insight Segmentation and Registration Toolkit
itkTreeChangeEvent.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkTreeChangeEvent_h
19 #define __itkTreeChangeEvent_h
20 
21 #include "itkMacro.h"
22 #include "itkEventObject.h"
23 #include "itkTreeIteratorBase.h"
24 
25 namespace itk
26 {
32 template< class TTreeType >
34 {
35 public:
36 
40 
43 
46 
48  virtual ~TreeChangeEvent() {}
49 
51  virtual const char * GetEventName() const { return "TreeChangeEvent"; }
52 
54  virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != NULL); }
55 
57  virtual::itk::EventObject * MakeObject() const { return new Self(*m_ChangePosition); }
58 
61 
62  // cppcheck-suppress uninitVar
63  TreeChangeEvent(const Self & s):itk::ModifiedEvent(s) {}
64 protected:
65 
67 private:
68  void operator=(const Self &);
69 };
70 
76 template< class TTreeType >
77 class TreeNodeChangeEvent:public TreeChangeEvent< TTreeType >
78 {
79 public:
82 
84 
86  TreeChangeEvent< TTreeType >(position) {}
87 
88  virtual const char * GetEventName() const { return "TreeNodeChangeEvent"; }
89 
90  virtual bool CheckEvent(const::itk::EventObject *e) const { return dynamic_cast< const Self * >( e ); }
91 
92  virtual::itk::EventObject * MakeObject() const { return new Self(*this->m_ChangePosition); }
93 
94  TreeNodeChangeEvent(const Self & s):TreeChangeEvent< TTreeType >(s) {}
95 private:
96  void operator=(const Self &);
97 };
98 
103 template< class TTreeType >
104 class TreeAddEvent:public TreeChangeEvent< TTreeType >
105 {
106 public:
107 
111 
114 
117  TreeChangeEvent< TTreeType >(position) {}
118 
120  virtual const char * GetEventName() const { return "TreeAddEvent"; }
121 
123  virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != NULL); }
124 
126  virtual::itk::EventObject * MakeObject() const { return new Self(*this->m_ChangePosition); }
127 
128  TreeAddEvent(const Self & s):TreeChangeEvent< TTreeType >(s) {}
129 private:
130  void operator=(const Self &);
131 };
132 
137 template< class TTreeType >
138 class TreeRemoveEvent:public TreeChangeEvent< TTreeType >
139 {
140 public:
141 
145 
148 
151  TreeChangeEvent< TTreeType >(position) {}
152 
154  virtual const char * GetEventName() const { return "TreeRemoveEvent"; }
155 
157  virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != NULL); }
158 
160  virtual::itk::EventObject * MakeObject() const { return new Self(*this->m_ChangePosition); }
161 
162  TreeRemoveEvent(const Self & s):TreeChangeEvent< TTreeType >(s) {}
163 private:
164  void operator=(const Self &);
165 };
166 
172 template< class TTreeType >
173 class TreePruneEvent:public TreeRemoveEvent< TTreeType >
174 {
175 public:
178 
180 
182  TreeRemoveEvent< TTreeType >(position) {}
183 
184  virtual const char * GetEventName() const { return "TreePruneEvent"; }
185 
186  virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != NULL); }
187 
188  virtual::itk::EventObject * MakeObject() const { return new Self(*this->m_ChangePosition); }
189 
190  TreePruneEvent(const Self & s):TreeRemoveEvent< TTreeType >(s) {}
191 private:
192  void operator=(const Self &);
193 };
194 } // namespace itk
195 
196 #endif
197