Orfeo Toolbox  3.16
itkEventObject.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkEventObject.h,v $
5  Language: C++
6  Date: $Date: 2009-05-25 08:34:20 $
7  Version: $Revision: 1.26 $
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 
18 #ifndef __itkEventObject_h
19 #define __itkEventObject_h
20 
21 #include "itkIndent.h"
22 
23 
24 namespace itk
25 {
26 
59 {
60 public:
64 
66 
68  virtual ~EventObject() {}
69 
72  virtual EventObject* MakeObject() const=0;
73 
77  virtual void Print(std::ostream& os) const;
78 
80  virtual const char * GetEventName(void) const=0;
81 
83  virtual bool CheckEvent(const EventObject*) const=0;
84 
85 protected:
90  virtual void PrintSelf(std::ostream& os, Indent indent) const;
91  virtual void PrintHeader(std::ostream& os, Indent indent) const;
92  virtual void PrintTrailer(std::ostream& os, Indent indent) const;
93 private:
95  void operator=(const EventObject&);
96 };
97 
98 
100 inline std::ostream& operator<<(std::ostream& os, EventObject &e)
101 {
102  (&e)->Print(os);
103  return os;
104 }
105 
106 
110 #define itkEventMacro( classname , super ) \
111  \
112  class classname : public super { \
113  public: \
114  typedef classname Self; \
115  typedef super Superclass; \
116  classname() {} \
117  virtual ~classname() {} \
118  virtual const char * GetEventName() const { return #classname; } \
119  virtual bool CheckEvent(const ::itk::EventObject* e) const \
120  { return dynamic_cast<const Self*>(e); } \
121  virtual ::itk::EventObject* MakeObject() const \
122  { return new Self; } \
123  classname(const Self&s) :super(s){}; \
124  private: \
125  void operator=(const Self&); \
126  };
127 
128 
136 itkEventMacro( EndEvent , AnyEvent )
150 
152 
153 
154 } // end namespace itk
155 
156 #endif

Generated at Sat Feb 2 2013 23:36:04 for Orfeo Toolbox with doxygen 1.8.1.1