ITK  4.4.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 
65 protected:
66 
68 
69 private:
70  void operator=(const Self &);
71 };
72 
78 template< class TTreeType >
79 class TreeNodeChangeEvent:public TreeChangeEvent< TTreeType >
80 {
81 public:
84 
86 
88  TreeChangeEvent< TTreeType >(position) {}
89 
90  virtual const char * GetEventName() const { return "TreeNodeChangeEvent"; }
91 
92  virtual bool CheckEvent(const::itk::EventObject *e) const { return dynamic_cast< const Self * >( e ); }
93 
94  virtual::itk::EventObject * MakeObject() const { return new Self(*this->m_ChangePosition); }
95 
96  TreeNodeChangeEvent(const Self & s):TreeChangeEvent< TTreeType >(s) {}
97 
98 private:
99  void operator=(const Self &);
100 };
101 
106 template< class TTreeType >
107 class TreeAddEvent:public TreeChangeEvent< TTreeType >
108 {
109 public:
110 
114 
117 
120  TreeChangeEvent< TTreeType >(position) {}
121 
123  virtual const char * GetEventName() const { return "TreeAddEvent"; }
124 
126  virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != NULL); }
127 
129  virtual::itk::EventObject * MakeObject() const { return new Self(*this->m_ChangePosition); }
130 
131  TreeAddEvent(const Self & s):TreeChangeEvent< TTreeType >(s) {}
132 
133 private:
134  void operator=(const Self &);
135 };
136 
141 template< class TTreeType >
142 class TreeRemoveEvent:public TreeChangeEvent< TTreeType >
143 {
144 public:
145 
149 
152 
155  TreeChangeEvent< TTreeType >(position) {}
156 
158  virtual const char * GetEventName() const { return "TreeRemoveEvent"; }
159 
161  virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != NULL); }
162 
164  virtual::itk::EventObject * MakeObject() const { return new Self(*this->m_ChangePosition); }
165 
166  TreeRemoveEvent(const Self & s):TreeChangeEvent< TTreeType >(s) {}
167 
168 private:
169  void operator=(const Self &);
170 };
171 
177 template< class TTreeType >
178 class TreePruneEvent:public TreeRemoveEvent< TTreeType >
179 {
180 public:
183 
185 
187  TreeRemoveEvent< TTreeType >(position) {}
188 
189  virtual const char * GetEventName() const { return "TreePruneEvent"; }
190 
191  virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != NULL); }
192 
193  virtual::itk::EventObject * MakeObject() const { return new Self(*this->m_ChangePosition); }
194 
195  TreePruneEvent(const Self & s):TreeRemoveEvent< TTreeType >(s) {}
196 
197 private:
198  void operator=(const Self &);
199 };
200 } // namespace itk
201 
202 #endif
203