Orfeo Toolbox  4.0
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 }
106 
107 
108 #define ITKEvent_EXPORT ITKCommon_EXPORT
109 
113 #define itkEventMacro(classname, super) \
114  \
115  class ITKEvent_EXPORT classname:public super \
116  { \
117 public: \
118  typedef classname Self; \
119  typedef super Superclass; \
120  classname() {} \
121  virtual ~classname() {} \
122  virtual const char *GetEventName() const { return #classname; } \
123  virtual bool CheckEvent(const::itk::EventObject * e) const \
124  { return ( dynamic_cast< const Self * >( e ) != NULL ); } \
125  virtual::itk::EventObject *MakeObject() const \
126  { return new Self; } \
127  classname(const Self &s):super(s){}; \
128 private: \
129  void operator=(const Self &); \
130  };
131 
153 
155 
156 #undef ITKEvent_EXPORT
157 #define ITKEvent_EXPORT ITK_ABI_EXPORT
158 
159 } // end namespace itk
160 
161 #endif

Generated at Sat Mar 8 2014 14:35:02 for Orfeo Toolbox with doxygen 1.8.3.1