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: 2009-05-25 08:34:20 $
00007   Version:   $Revision: 1.26 $
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 
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 
00112 #define itkEventMacro( classname , super ) \
00113 
00114   \
00118 #define itkEventMacro( classname , super ) \
00119  class  classname : public super { \
00120    public: \
00121      typedef classname    Self; \
00122      typedef super        Superclass; \
00123      classname() {} \
00124      virtual ~classname() {} \
00125      virtual const char * GetEventName() const { return #classname; } \
00126      virtual bool CheckEvent(const ::itk::EventObject* e) const \
00127        { return dynamic_cast<const Self*>(e); } \
00128      virtual ::itk::EventObject* MakeObject() const \
00129        { return new Self; } \
00130      classname(const Self&s) :super(s){}; \
00131    private: \
00132      void operator=(const Self&); \
00133  };
00134 
00135 
00136 
00140 itkEventMacro( NoEvent            , EventObject )
00141 itkEventMacro( AnyEvent           , EventObject )
00142 itkEventMacro( DeleteEvent        , AnyEvent )
00143 itkEventMacro( StartEvent         , AnyEvent )
00144 itkEventMacro( EndEvent           , AnyEvent )
00145 itkEventMacro( ProgressEvent      , AnyEvent )
00146 itkEventMacro( ExitEvent          , AnyEvent )
00147 itkEventMacro( AbortEvent         , AnyEvent )
00148 itkEventMacro( ModifiedEvent      , AnyEvent )
00149 itkEventMacro( InitializeEvent     , AnyEvent )
00150 itkEventMacro( IterationEvent     , AnyEvent )
00151 itkEventMacro( PickEvent          , AnyEvent )
00152 itkEventMacro( StartPickEvent     , PickEvent   )
00153 itkEventMacro( EndPickEvent       , PickEvent   )
00154 itkEventMacro( AbortCheckEvent    , PickEvent   )
00155 itkEventMacro( FunctionEvaluationIterationEvent, IterationEvent )
00156 itkEventMacro( GradientEvaluationIterationEvent, IterationEvent )
00157 itkEventMacro( FunctionAndGradientEvaluationIterationEvent, IterationEvent )
00158 
00159 itkEventMacro( UserEvent          , AnyEvent )
00160 
00161    
00162 } // end namespace itk
00163 
00164 #endif
00165 

Generated at Mon Jul 12 2010 18:16:39 for ITK by doxygen 1.7.1 written by Dimitri van Heesch, © 1997-2000