ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkEventObject.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 __itkEventObject_h
19 #define __itkEventObject_h
20 
21 #include "itkIndent.h"
22 
23 namespace itk
24 {
57 class ITKCommon_EXPORT EventObject
58 {
59 public:
63 
65 
67  virtual ~EventObject() {}
68 
71  virtual EventObject * MakeObject() const = 0;
72 
76  virtual void Print(std::ostream & os) const;
77 
79  virtual const char * GetEventName(void) const = 0;
80 
82  virtual bool CheckEvent(const EventObject *) const = 0;
83 
84 protected:
89  virtual void PrintSelf(std::ostream & os, Indent indent) const;
90 
91  virtual void PrintHeader(std::ostream & os, Indent indent) const;
92 
93  virtual void PrintTrailer(std::ostream & os, Indent indent) const;
94 
95 private:
97  void operator=(const EventObject &);
98 };
99 
101 inline std::ostream & operator<<(std::ostream & os, EventObject & e)
102 {
103  ( &e )->Print(os);
104  return os;
105 }
107 
108 
109 #define ITKEvent_EXPORT ITKCommon_EXPORT
110 
114 #define itkEventMacro(classname, super) \
115 
116  \
120 #define itkEventMacro(classname, super) \
121  class ITKEvent_EXPORT classname:public super \
122  { \
123 public: \
124  typedef classname Self; \
125  typedef super Superclass; \
126  classname() {} \
127  virtual ~classname() {} \
128  virtual const char *GetEventName() const { return #classname; } \
129  virtual bool CheckEvent(const::itk::EventObject * e) const \
130  { return ( dynamic_cast< const Self * >( e ) != NULL ); } \
131  virtual::itk::EventObject *MakeObject() const \
132  { return new Self; } \
133  classname(const Self &s):super(s){}; \
134 private: \
135  void operator=(const Self &); \
136  };
137 
138 
161 
163 
164 #undef ITKEvent_EXPORT
165 #define ITKEvent_EXPORT ITK_ABI_EXPORT
166 
167 } // end namespace itk
168 
169 #endif
#define itkEventMacro(classname, super)
std::ostream & operator<<(std::ostream &os, const Array< TValue > &arr)
Definition: itkArray.h:184
virtual ~EventObject()
static const double e
The base of the natural logarithm or Euler&#39;s number
Definition: itkMath.h:45
EventObject * EventFactoryFunction()
Abstraction of the Events used to communicating among filters and with GUIs.
EventObject(const EventObject &)
Control indentation during Print() invocation.
Definition: itkIndent.h:49