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
00058 class ITKCommon_EXPORT EventObject
00059 {
00060 public:
00063 EventObject() {}
00064
00066 virtual ~EventObject() {}
00067
00070 virtual EventObject* MakeObject() const=0;
00071
00075 virtual void Print(std::ostream& os) const;
00076
00078 virtual const char * GetEventName(void) const=0;
00079
00081 virtual bool CheckEvent(const EventObject*) const=0;
00082
00083 protected:
00088 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00089 virtual void PrintHeader(std::ostream& os, Indent indent) const;
00090 virtual void PrintTrailer(std::ostream& os, Indent indent) const;
00091
00092 EventObject(const EventObject&){};
00093 private:
00094 typedef EventObject * EventFactoryFunction();
00095 void operator=(const EventObject&);
00096 };
00097
00098
00100 inline std::ostream& operator<<(std::ostream& os, EventObject &e)
00101 {
00102 (&e)->Print(os);
00103 return os;
00104 }
00105
00106
00107
00108
00109
00110
00111
00112 #define itkEventMacro( classname , super ) \
00113 \
00114 class classname : public super { \
00115 public: \
00116 typedef classname Self; \
00117 typedef super Superclass; \
00118 classname() {} \
00119 virtual ~classname() {} \
00120 virtual const char * GetEventName() const { return #classname; } \
00121 virtual bool CheckEvent(const ::itk::EventObject* e) const \
00122 { return dynamic_cast<const Self*>(e); } \
00123 virtual ::itk::EventObject* MakeObject() const \
00124 { return new Self; } \
00125 classname(const Self&s) :super(s){}; \
00126 private: \
00127 void operator=(const Self&); \
00128 }
00129
00130
00131
00135 itkEventMacro( NoEvent , EventObject );
00136 itkEventMacro( AnyEvent , EventObject );
00137 itkEventMacro( DeleteEvent , AnyEvent );
00138 itkEventMacro( StartEvent , AnyEvent );
00139 itkEventMacro( EndEvent , AnyEvent );
00140 itkEventMacro( ProgressEvent , AnyEvent );
00141 itkEventMacro( ExitEvent , AnyEvent );
00142 itkEventMacro( AbortEvent , AnyEvent );
00143 itkEventMacro( ModifiedEvent , AnyEvent );
00144 itkEventMacro( InitializeEvent , AnyEvent );
00145 itkEventMacro( IterationEvent , AnyEvent );
00146 itkEventMacro( PickEvent , AnyEvent );
00147 itkEventMacro( StartPickEvent , PickEvent );
00148 itkEventMacro( EndPickEvent , PickEvent );
00149 itkEventMacro( AbortCheckEvent , PickEvent );
00150 itkEventMacro( FunctionEvaluationIterationEvent, IterationEvent );
00151 itkEventMacro( GradientEvaluationIterationEvent, IterationEvent );
00152 itkEventMacro( FunctionAndGradientEvaluationIterationEvent, IterationEvent );
00153
00154 itkEventMacro( UserEvent , AnyEvent );
00155
00156
00157 }
00158
00159 #endif
00160