Medical Imaging Interaction Toolkit  2016.11.0
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,
6  Division of Medical and Biological Informatics
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  http://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 befor 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 befor including\
33  this header.
34 #endif
35 #endif
36 
37 #include "usSharedData.h"
38 
39 #include "usServiceReference.h"
40 
41 #ifdef _MSC_VER
42 #pragma warning(push)
43 #pragma warning(disable:4251)
44 #endif
45 
46 US_BEGIN_NAMESPACE
47 
48 class ServiceEventData;
49 
60 class US_Core_EXPORT ServiceEvent
61 {
62 
64 
65 public:
66 
67  enum Type {
68 
77  REGISTERED = 0x00000001,
78 
87  MODIFIED = 0x00000002,
88 
105  UNREGISTERING = 0x00000004,
106 
119  MODIFIED_ENDMATCH = 0x00000008
120 
121  };
122 
126  ServiceEvent();
127 
128  ~ServiceEvent();
129 
137  bool IsNull() const;
138 
146  ServiceEvent(Type type, const ServiceReferenceBase& reference);
147 
148  ServiceEvent(const ServiceEvent& other);
149 
150  ServiceEvent& operator=(const ServiceEvent& other);
151 
160  ServiceReferenceU GetServiceReference() const;
161 
162  template<class S>
164  {
165  return GetServiceReference();
166  }
167 
179  Type GetType() const;
180 
181 };
182 
187 US_Core_EXPORT std::ostream& operator<<(std::ostream& os, const ServiceEvent::Type& type);
188 US_Core_EXPORT std::ostream& operator<<(std::ostream& os, const ServiceEvent& event);
191 US_END_NAMESPACE
192 
193 #ifdef _MSC_VER
194 #pragma warning(pop)
195 #endif
196 
197 #endif // USSERVICEEVENT_H
US_Core_EXPORT std::ostream & operator<<(std::ostream &os, const ServiceEvent &event)
ServiceReference< S > GetServiceReference(InterfaceType< S >) const