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

Generated on Fri May 25 2012 13:12:40 for GDCM by doxygen 1.8.0
SourceForge.net Logo