00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __itkEventObject_h
00019 #define __itkEventObject_h
00020
00021 #include "itkIndent.h"
00022
00023
00024 namespace itk
00025 {
00026
00056 class ITK_EXPORT EventObject
00057 {
00058 public:
00061 EventObject() {}
00062
00064 virtual ~EventObject() {}
00065
00068 virtual EventObject* MakeObject() const=0;
00069
00073 virtual void Print(std::ostream& os) const;
00074
00076 virtual const char * GetEventName(void) const=0;
00077
00079 virtual bool CheckEvent(const EventObject*) const=0;
00080
00081 protected:
00086 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00087 virtual void PrintHeader(std::ostream& os, Indent indent) const;
00088 virtual void PrintTrailer(std::ostream& os, Indent indent) const;
00089
00090 private:
00091 typedef EventObject * EventFactoryFunction();
00092 EventObject(const EventObject&);
00093 void operator=(const EventObject&);
00094 };
00095
00096
00098 inline std::ostream& operator<<(std::ostream& os, EventObject &e)
00099 {
00100 (&e)->Print(os);
00101 return os;
00102 }
00103
00104
00105
00106
00107
00108
00109
00110 #define itkEventMacro( classname , super ) \
00111 class classname : public super { \
00112 public: \
00113 typedef classname Self; \
00114 typedef super Superclass; \
00115 classname() {} \
00116 virtual ~classname() {} \
00117 virtual const char * GetEventName() const { return #classname; } \
00118 virtual bool CheckEvent(const ::itk::EventObject* e) const \
00119 { return dynamic_cast<const Self*>(e); } \
00120 virtual ::itk::EventObject* MakeObject() const \
00121 { return new Self; } \
00122 private: \
00123 classname(const Self&); \
00124 void operator=(const Self&); \
00125 }
00126
00127
00128
00132 itkEventMacro( NoEvent , EventObject );
00133 itkEventMacro( AnyEvent , EventObject );
00134 itkEventMacro( DeleteEvent , AnyEvent );
00135 itkEventMacro( StartEvent , AnyEvent );
00136 itkEventMacro( EndEvent , AnyEvent );
00137 itkEventMacro( ProgressEvent , AnyEvent );
00138 itkEventMacro( ExitEvent , AnyEvent );
00139 itkEventMacro( ModifiedEvent , AnyEvent );
00140 itkEventMacro( IterationEvent , AnyEvent );
00141 itkEventMacro( PickEvent , AnyEvent );
00142 itkEventMacro( StartPickEvent , PickEvent );
00143 itkEventMacro( EndPickEvent , PickEvent );
00144 itkEventMacro( AbortCheckEvent , PickEvent );
00145
00146 itkEventMacro( UserEvent , AnyEvent );
00147
00148
00149 }
00150
00151 #endif
00152