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: 2002/04/23 22:23:16 $
00007   Version:   $Revision: 1.10 $
00008 
00009   Copyright (c) 2002 Insight 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 
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  *  Macro for creating new Events
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 } // end namespace itk
00150 
00151 #endif
00152 

Generated at Wed Mar 12 01:12:53 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000