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
00065 EventObject(const EventObject&){};
00066
00068 virtual ~EventObject() {}
00069
00072 virtual EventObject* MakeObject() const=0;
00073
00077 virtual void Print(std::ostream& os) const;
00078
00080 virtual const char * GetEventName(void) const=0;
00081
00083 virtual bool CheckEvent(const EventObject*) const=0;
00084
00085 protected:
00090 virtual void PrintSelf(std::ostream& os, Indent indent) const;
00091 virtual void PrintHeader(std::ostream& os, Indent indent) const;
00092 virtual void PrintTrailer(std::ostream& os, Indent indent) const;
00093 private:
00094 typedef EventObject * EventFactoryFunction();
00095 void operator=(const EventObject&);
00096 };
00098
00099
00101 inline std::ostream& operator<<(std::ostream& os, EventObject &e)
00102 {
00103 (&e)->Print(os);
00104 return os;
00105 }
00107
00108
00109
00110
00111
00112
00113
00114 #define itkEventMacro( classname , super ) \
00115 \
00116 class classname : public super { \
00117 public: \
00118 typedef classname Self; \
00119 typedef super Superclass; \
00120 classname() {} \
00121 virtual ~classname() {} \
00122 virtual const char * GetEventName() const { return #classname; } \
00123 virtual bool CheckEvent(const ::itk::EventObject* e) const \
00124 { return dynamic_cast<const Self*>(e); } \
00125 virtual ::itk::EventObject* MakeObject() const \
00126 { return new Self; } \
00127 classname(const Self&s) :super(s){}; \
00128 private: \
00129 void operator=(const Self&); \
00130 }
00131
00132
00133
00137 itkEventMacro( NoEvent , EventObject );
00138 itkEventMacro( AnyEvent , EventObject );
00139 itkEventMacro( DeleteEvent , AnyEvent );
00140 itkEventMacro( StartEvent , AnyEvent );
00141 itkEventMacro( EndEvent , AnyEvent );
00142 itkEventMacro( ProgressEvent , AnyEvent );
00143 itkEventMacro( ExitEvent , AnyEvent );
00144 itkEventMacro( AbortEvent , AnyEvent );
00145 itkEventMacro( ModifiedEvent , AnyEvent );
00146 itkEventMacro( InitializeEvent , AnyEvent );
00147 itkEventMacro( IterationEvent , AnyEvent );
00148 itkEventMacro( PickEvent , AnyEvent );
00149 itkEventMacro( StartPickEvent , PickEvent );
00150 itkEventMacro( EndPickEvent , PickEvent );
00151 itkEventMacro( AbortCheckEvent , PickEvent );
00152 itkEventMacro( FunctionEvaluationIterationEvent, IterationEvent );
00153 itkEventMacro( GradientEvaluationIterationEvent, IterationEvent );
00154 itkEventMacro( FunctionAndGradientEvaluationIterationEvent, IterationEvent );
00156
00157 itkEventMacro( UserEvent , AnyEvent );
00158
00159
00160 }
00161
00162 #endif
00163
00164