# 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-2010 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 //-----------------------------------------------------------------------------
    00027 class GDCM_EXPORT Event
    00028 {
    00029 public :
    00030   Event();
    00031   Event(const Event&);
    00032   virtual ~Event();
    00033
    00036   virtual Event* MakeObject() const = 0;
    00037
    00041   virtual void Print(std::ostream& os) const;
    00042
    00044   virtual const char * GetEventName(void) const = 0;
    00045
    00047   virtual bool CheckEvent(const Event*) const = 0;
    00048
    00049 protected:
    00050 private:
    00051   void operator=(const Event&);  // Not implemented.
    00052 };
    00053
    00055 inline std::ostream& operator<<(std::ostream& os, Event &e)
    00056 {
    00057   e.Print(os);
    00058   return os;
    00059 }
    00060
    00061 /*
    00062  *  Macro for creating new Events
    00063  */
    00064 #define gdcmEventMacro( classname , super ) \
    00065   \
    00066  class  classname : public super { \
    00067    public: \
    00068      typedef classname Self; \
    00069      typedef super Superclass; \
    00070      classname() {} \
    00071      virtual ~classname() {} \
    00072      virtual const char * GetEventName() const { return #classname; } \
    00073      virtual bool CheckEvent(const ::gdcm::Event* e) const \
    00074        { return dynamic_cast<const Self*>(e) ? true : false; } \
    00075      virtual ::gdcm::Event* MakeObject() const \
    00076        { return new Self; } \
    00077      classname(const Self&s) : super(s){}; \
    00078    private: \
    00079      void operator=(const Self&); \
    00080  }
    00081
    00085 gdcmEventMacro( NoEvent            , Event );
    00086 gdcmEventMacro( AnyEvent           , Event );
    00087 gdcmEventMacro( StartEvent         , AnyEvent );
    00088 gdcmEventMacro( EndEvent           , AnyEvent );
    00089 //gdcmEventMacro( ProgressEvent      , AnyEvent );
    00090 gdcmEventMacro( ExitEvent          , AnyEvent );
    00091 gdcmEventMacro( AbortEvent         , AnyEvent );
    00092 gdcmEventMacro( ModifiedEvent      , AnyEvent );
    00093 gdcmEventMacro( InitializeEvent    , AnyEvent );
    00094 gdcmEventMacro( IterationEvent     , AnyEvent );
    00095 //gdcmEventMacro( AnonymizeEvent     , AnyEvent );
    00096 gdcmEventMacro( UserEvent          , AnyEvent );
    00097
    00098
    00099 } // end namespace gdcm
    00100 //-----------------------------------------------------------------------------
    00101 #endif //GDCMEVENT_H