Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
usServiceEvent.h
Go to the documentation of this file.
1 /*============================================================================
2 
3  Library: CppMicroServices
4 
5  Copyright (c) German Cancer Research Center (DKFZ)
6  All rights reserved.
7 
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  https://www.apache.org/licenses/LICENSE-2.0
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 ============================================================================*/
21 
22 #ifndef USSERVICEEVENT_H
23 #define USSERVICEEVENT_H
24 
25 #ifdef REGISTERED
26 #ifdef _WIN32
27 #error The REGISTERED preprocessor define clashes with the ServiceEvent::REGISTERED\
28  enum type. Try to reorder your includes, compile with WIN32_LEAN_AND_MEAN, or undef\
29  the REGISTERED macro before including this header.
30 #else
31 #error The REGISTERED preprocessor define clashes with the ServiceEvent::REGISTERED\
32  enum type. Try to reorder your includes or undef the REGISTERED macro before including\
33  this header.
34 #endif
35 #endif
36 
37 #include "usSharedData.h"
38 
39 #include "usServiceReference.h"
40 
42 
43 class ServiceEventData;
44 
56 {
57 
59 
60 public:
61 
62  enum Type {
63 
72  REGISTERED = 0x00000001,
73 
82  MODIFIED = 0x00000002,
83 
100  UNREGISTERING = 0x00000004,
101 
114  MODIFIED_ENDMATCH = 0x00000008
115 
116  };
117 
121  ServiceEvent();
122 
123  ~ServiceEvent();
124 
132  bool IsNull() const;
133 
141  ServiceEvent(Type type, const ServiceReferenceBase& reference);
142 
143  ServiceEvent(const ServiceEvent& other);
144 
145  ServiceEvent& operator=(const ServiceEvent& other);
146 
155  ServiceReferenceU GetServiceReference() const;
156 
157  template<class S>
159  {
160  return GetServiceReference();
161  }
162 
174  Type GetType() const;
175 
176 };
177 
182 US_Core_EXPORT std::ostream& operator<<(std::ostream& os, const ServiceEvent::Type& type);
183 US_Core_EXPORT std::ostream& operator<<(std::ostream& os, const ServiceEvent& event);
187 
188 #endif // USSERVICEEVENT_H
us::operator<<
US_Core_EXPORT std::ostream & operator<<(std::ostream &os, const ServiceEvent &event)
us::ServiceEvent::Type
Type
Definition: usServiceEvent.h:62
us::ServiceReference
Definition: usModule.h:40
us::ServiceEvent::GetServiceReference
ServiceReference< S > GetServiceReference(InterfaceType< S >) const
Definition: usServiceEvent.h:158
us::ServiceReferenceBase
Definition: usServiceReferenceBase.h:43
usServiceReference.h
US_BEGIN_NAMESPACE
#define US_BEGIN_NAMESPACE
Definition: usGlobalConfig.h:76
us::InterfaceType
Definition: usServiceInterface.h:120
us::ServiceEvent
Definition: usServiceEvent.h:55
US_END_NAMESPACE
#define US_END_NAMESPACE
Definition: usGlobalConfig.h:77
US_Core_EXPORT
#define US_Core_EXPORT
Definition: usCoreExport.h:21
usSharedData.h
us::SharedDataPointer< ServiceEventData >