Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkEventObject.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkEventObject.h,v $ 00005 Language: C++ 00006 Date: $Date: 2003/09/10 14:29:07 $ 00007 Version: $Revision: 1.14 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 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 private: 00093 typedef EventObject * EventFactoryFunction(); 00094 EventObject(const EventObject&); 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 * Macro for creating new Events 00111 */ 00112 #define itkEventMacro( classname , super ) \ 00113 class classname : public super { \ 00114 public: \ 00115 typedef classname Self; \ 00116 typedef super Superclass; \ 00117 classname() {} \ 00118 virtual ~classname() {} \ 00119 virtual const char * GetEventName() const { return #classname; } \ 00120 virtual bool CheckEvent(const ::itk::EventObject* e) const \ 00121 { return dynamic_cast<const Self*>(e); } \ 00122 virtual ::itk::EventObject* MakeObject() const \ 00123 { return new Self; } \ 00124 private: \ 00125 classname(const Self&); \ 00126 void operator=(const Self&); \ 00127 } 00128 00129 00130 00134 itkEventMacro( NoEvent , EventObject ); 00135 itkEventMacro( AnyEvent , EventObject ); 00136 itkEventMacro( DeleteEvent , AnyEvent ); 00137 itkEventMacro( StartEvent , AnyEvent ); 00138 itkEventMacro( EndEvent , AnyEvent ); 00139 itkEventMacro( ProgressEvent , AnyEvent ); 00140 itkEventMacro( ExitEvent , AnyEvent ); 00141 itkEventMacro( AbortEvent , AnyEvent ); 00142 itkEventMacro( ModifiedEvent , AnyEvent ); 00143 itkEventMacro( IterationEvent , AnyEvent ); 00144 itkEventMacro( PickEvent , AnyEvent ); 00145 itkEventMacro( StartPickEvent , PickEvent ); 00146 itkEventMacro( EndPickEvent , PickEvent ); 00147 itkEventMacro( AbortCheckEvent , PickEvent ); 00148 00149 itkEventMacro( UserEvent , AnyEvent ); 00150 00151 00152 } // end namespace itk 00153 00154 #endif 00155

Generated at Sun Apr 1 02:27:45 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000