# gdcmEvent.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program: GDCM (Grassroots DICOM). A DICOM library
    00004   Module:  $URL$
    00005
    00006   Copyright (c) 2006-2009 Mathieu Malaterre
    00007   All rights reserved.
    00008   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
    00009
    00010      This software is distributed WITHOUT ANY WARRANTY; without even
    00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00012      PURPOSE.  See the above copyright notice for more information.
    00013
    00014 =========================================================================*/
    00015 #ifndef __gdcmEvent_h
    00016 #define __gdcmEvent_h
    00017
    00018 #include "gdcmTypes.h"
    00019
    00020 namespace gdcm
    00021 {
    00022 //-----------------------------------------------------------------------------
    00028 class GDCM_EXPORT Event
    00029 {
    00030 public :
    00031   Event();
    00032   Event(const Event&);
    00033   virtual ~Event();
    00034
    00037   virtual Event* MakeObject() const = 0;
    00038
    00042   virtual void Print(std::ostream& os) const;
    00043
    00045   virtual const char * GetEventName(void) const = 0;
    00046
    00048   virtual bool CheckEvent(const Event*) const = 0;
    00049
    00050 protected:
    00051 private:
    00052   void operator=(const Event&);  // Not implemented.
    00053 };
    00054
    00056 inline std::ostream& operator<<(std::ostream& os, Event &e)
    00057 {
    00058   e.Print(os);
    00059   return os;
    00060 }
    00061
    00062 /*
    00063  *  Macro for creating new Events
    00064  */
    00065 #define gdcmEventMacro( classname , super ) \
    00066   \
    00067  class  classname : public super { \
    00068    public: \
    00069      typedef classname Self; \
    00070      typedef super Superclass; \
    00071      classname() {} \
    00072      virtual ~classname() {} \
    00073      virtual const char * GetEventName() const { return #classname; } \
    00074      virtual bool CheckEvent(const ::gdcm::Event* e) const \
    00075        { return dynamic_cast<const Self*>(e) ? true : false; } \
    00076      virtual ::gdcm::Event* MakeObject() const \
    00077        { return new Self; } \
    00078      classname(const Self&s) : super(s){}; \
    00079    private: \
    00080      void operator=(const Self&); \
    00081  }
    00082
    00086 gdcmEventMacro( NoEvent            , Event );
    00087 gdcmEventMacro( AnyEvent           , Event );
    00088 gdcmEventMacro( StartEvent         , AnyEvent );
    00089 gdcmEventMacro( EndEvent           , AnyEvent );
    00090 gdcmEventMacro( ProgressEvent      , AnyEvent );
    00091 gdcmEventMacro( ExitEvent          , AnyEvent );
    00092 gdcmEventMacro( AbortEvent         , AnyEvent );
    00093 gdcmEventMacro( ModifiedEvent      , AnyEvent );
    00094 gdcmEventMacro( InitializeEvent    , AnyEvent );
    00095 gdcmEventMacro( IterationEvent     , AnyEvent );
    00096 //gdcmEventMacro( AnonymizeEvent     , AnyEvent );
    00097 gdcmEventMacro( UserEvent          , AnyEvent );
    00098
    00099
    00100 } // end namespace gdcm
    00101 //-----------------------------------------------------------------------------
    00102 #endif //__gdcmEvent_h