Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
usServiceEvent.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef USSERVICEEVENT_H
14 #define USSERVICEEVENT_H
15 
16 #ifdef REGISTERED
17 #ifdef _WIN32
18 #error The REGISTERED preprocessor define clashes with the ServiceEvent::REGISTERED\
19  enum type. Try to reorder your includes, compile with WIN32_LEAN_AND_MEAN, or undef\
20  the REGISTERED macro before including this header.
21 #else
22 #error The REGISTERED preprocessor define clashes with the ServiceEvent::REGISTERED\
23  enum type. Try to reorder your includes or undef the REGISTERED macro before including\
24  this header.
25 #endif
26 #endif
27 
28 #include <usSharedData.h>
29 
30 #include <usServiceReference.h>
31 
32 namespace us {
33 
34 class ServiceEventData;
35 
47 {
48 
50 
51 public:
52 
53  enum Type {
54 
63  REGISTERED = 0x00000001,
64 
73  MODIFIED = 0x00000002,
74 
91  UNREGISTERING = 0x00000004,
92 
105  MODIFIED_ENDMATCH = 0x00000008
106 
107  };
108 
113 
116 
124  bool IsNull() const;
125 
133  ServiceEvent(Type type, const ServiceReferenceBase& reference);
134 
136  ServiceEvent(const ServiceEvent& other);
137 
140 
152 
159  template<class S>
161  {
162  return GetServiceReference();
163  }
164 
180  Type GetType() const;
181 
182 };
183 
190 MITKCPPMICROSERVICES_EXPORT std::ostream& operator<<(std::ostream& os, const ServiceEvent::Type& type);
191 
193 MITKCPPMICROSERVICES_EXPORT std::ostream& operator<<(std::ostream& os, const ServiceEvent& event);
196 }
197 
198 #endif // USSERVICEEVENT_H
#define MITKCPPMICROSERVICES_EXPORT
bool IsNull() const
Can be used to check if this ServiceEvent instance is valid, or if it has been constructed using the ...
ServiceEvent(Type type, const ServiceReferenceBase &reference)
Creates a new service event object.
~ServiceEvent()
Destructor.
Type GetType() const
Returns the type of event.
ServiceReferenceU GetServiceReference() const
Returns a reference to the service that had a change occur in its lifecycle.
ServiceReference< S > GetServiceReference(InterfaceType< S >) const
Returns a typed reference to the service that had a change occur in its lifecycle.
ServiceEvent & operator=(const ServiceEvent &other)
Copy assignment operator.
ServiceEvent(const ServiceEvent &other)
Copy constructor.
ServiceEvent()
Creates an invalid instance.
MITKCPPMICROSERVICES_EXPORT std::ostream & operator<<(std::ostream &os, ModuleEvent::Type eventType)
Stream output operator for ModuleEvent::Type.
A helper type used in several methods to get proper method overload resolutions.