GDCM 3.0.24
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
19namespace gdcm
20{
21//-----------------------------------------------------------------------------
27{
28public :
30 virtual ~Event();
31 Event(const Event&);
32 void operator=(const Event&) = delete;
33
36 virtual Event* MakeObject() const = 0;
37
41 virtual void Print(std::ostream& os) const;
42
44 virtual const char * GetEventName() const = 0;
45
47 virtual bool CheckEvent(const Event*) const = 0;
48
49};
50
52inline std::ostream& operator<<(std::ostream& os, const Event &e)
53{
54 e.Print(os);
55 return os;
56}
57
58/*
59 * Macro for creating new Events
60 */
61#define gdcmEventMacro( classname , super ) \
62 \
63 class classname : public super { \
64 public: \
65 typedef classname Self; \
66 typedef super Superclass; \
67 classname() {} \
68 virtual ~classname() override = default; \
69 virtual const char * GetEventName() const override { return #classname; } \
70 virtual bool CheckEvent(const ::gdcm::Event* e) const override \
71 { return dynamic_cast<const Self*>(e) ? true : false; } \
72 virtual ::gdcm::Event* MakeObject() const override \
73 { return new Self; } \
74 classname(const Self&s) : super(s){} \
75 private: \
76 void operator=(const Self&); \
77 }
78
86//gdcmEventMacro( ProgressEvent , AnyEvent );
92//gdcmEventMacro( AnonymizeEvent , AnyEvent );
94
95
96} // end namespace gdcm
97//-----------------------------------------------------------------------------
98#endif //GDCMEVENT_H
Definition gdcmEvent.h:88
Definition gdcmEvent.h:83
Definition gdcmEvent.h:85
superclass for callback/observer methods
Definition gdcmEvent.h:27
virtual const char * GetEventName() const =0
void operator=(const Event &)=delete
Event(const Event &)
virtual void Print(std::ostream &os) const
virtual bool CheckEvent(const Event *) const =0
virtual ~Event()
virtual Event * MakeObject() const =0
Definition gdcmEvent.h:87
Definition gdcmEvent.h:90
Definition gdcmEvent.h:91
Definition gdcmEvent.h:89
Definition gdcmEvent.h:82
Definition gdcmEvent.h:84
Definition gdcmEvent.h:93
#define gdcmEventMacro(classname, super)
Definition gdcmEvent.h:61
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88