File: gdcmEvent.h

package info (click to toggle)
gdcm 2.4.4-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 32,868 kB
  • sloc: cpp: 188,481; ansic: 124,526; xml: 41,799; sh: 7,162; python: 3,667; cs: 2,128; java: 1,344; lex: 1,290; tcl: 677; php: 128; makefile: 116
file content (100 lines) | stat: -rw-r--r-- 3,141 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*=========================================================================

  Program: GDCM (Grassroots DICOM). A DICOM library

  Copyright (c) 2006-2011 Mathieu Malaterre
  All rights reserved.
  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#ifndef GDCMEVENT_H
#define GDCMEVENT_H

#include "gdcmTypes.h"

namespace gdcm
{
//-----------------------------------------------------------------------------
/**
 * \brief superclass for callback/observer methods
 * \see Command Subject
 */
class GDCM_EXPORT Event
{
public :
  Event();
  Event(const Event&);
  virtual ~Event();

  /**  Create an Event of this type This method work as a Factory for
   *  creating events of each particular type. */
  virtual Event* MakeObject() const = 0;

  /** Print Event information.  This method can be overridden by
   * specific Event subtypes.  The default is to print out the type of
   * the event. */
  virtual void Print(std::ostream& os) const;

  /** Return the StringName associated with the event. */
  virtual const char * GetEventName(void) const = 0;

  /** Check if given event matches or derives from this event. */
  virtual bool CheckEvent(const Event*) const = 0;

protected:
private:
  void operator=(const Event&);  // Not implemented.
};

/// Generic inserter operator for Event and its subclasses.
inline std::ostream& operator<<(std::ostream& os, Event &e)
{
  e.Print(os);
  return os;
}

/*
 *  Macro for creating new Events
 */
#define gdcmEventMacro( classname , super ) \
 /** \brief classname */  \
 class  classname : public super { \
   public: \
     typedef classname Self; \
     typedef super Superclass; \
     classname() {} \
     virtual ~classname() {} \
     virtual const char * GetEventName() const { return #classname; } \
     virtual bool CheckEvent(const ::gdcm::Event* e) const \
       { return dynamic_cast<const Self*>(e) ? true : false; } \
     virtual ::gdcm::Event* MakeObject() const \
       { return new Self; } \
     classname(const Self&s) : super(s){}; \
   private: \
     void operator=(const Self&); \
 }

/**
 *      Define some common GDCM events
 */
gdcmEventMacro( NoEvent            , Event );
gdcmEventMacro( AnyEvent           , Event );
gdcmEventMacro( StartEvent         , AnyEvent );
gdcmEventMacro( EndEvent           , AnyEvent );
//gdcmEventMacro( ProgressEvent      , AnyEvent );
gdcmEventMacro( ExitEvent          , AnyEvent );
gdcmEventMacro( AbortEvent         , AnyEvent );
gdcmEventMacro( ModifiedEvent      , AnyEvent );
gdcmEventMacro( InitializeEvent    , AnyEvent );
gdcmEventMacro( IterationEvent     , AnyEvent );
//gdcmEventMacro( AnonymizeEvent     , AnyEvent );
gdcmEventMacro( UserEvent          , AnyEvent );


} // end namespace gdcm
//-----------------------------------------------------------------------------
#endif //GDCMEVENT_H