GDCM  2.2.0
gdcmEvent.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: GDCM (Grassroots DICOM). A DICOM library
4 
5  Copyright (c) 2006-2011 Mathieu Malaterre
6  All rights reserved.
7  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without even
10  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11  PURPOSE. See the above copyright notice for more information.
12 
13 =========================================================================*/
14 #ifndef GDCMEVENT_H
15 #define GDCMEVENT_H
16 
17 #include "gdcmTypes.h"
18 
19 namespace gdcm
20 {
21 //-----------------------------------------------------------------------------
27 {
28 public :
29  Event();
30  Event(const Event&);
31  virtual ~Event();
32 
35  virtual Event* MakeObject() const = 0;
36 
40  virtual void Print(std::ostream& os) const;
41 
43  virtual const char * GetEventName(void) const = 0;
44 
46  virtual bool CheckEvent(const Event*) const = 0;
47 
48 protected:
49 private:
50  void operator=(const Event&); // Not implemented.
51 };
52 
54 inline std::ostream& operator<<(std::ostream& os, Event &e)
55 {
56  e.Print(os);
57  return os;
58 }
59 
60 /*
61  * Macro for creating new Events
62  */
63 #define gdcmEventMacro( classname , super ) \
64  \
65  class classname : public super { \
66  public: \
67  typedef classname Self; \
68  typedef super Superclass; \
69  classname() {} \
70  virtual ~classname() {} \
71  virtual const char * GetEventName() const { return #classname; } \
72  virtual bool CheckEvent(const ::gdcm::Event* e) const \
73  { return dynamic_cast<const Self*>(e) ? true : false; } \
74  virtual ::gdcm::Event* MakeObject() const \
75  { return new Self; } \
76  classname(const Self&s) : super(s){}; \
77  private: \
78  void operator=(const Self&); \
79  }
80 
88 //gdcmEventMacro( ProgressEvent , AnyEvent );
94 //gdcmEventMacro( AnonymizeEvent , AnyEvent );
96 
97 
98 } // end namespace gdcm
99 //-----------------------------------------------------------------------------
100 #endif //GDCMEVENT_H

Generated on Wed Jun 13 2012 20:40:37 for GDCM by doxygen 1.8.1
SourceForge.net Logo