Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
usServiceRegistrationBase.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 USSERVICEREGISTRATIONBASE_H
23 #define USSERVICEREGISTRATIONBASE_H
24 
25 #include "usServiceProperties.h"
26 #include "usServiceReference.h"
27 
28 US_MSVC_PUSH_DISABLE_WARNING(4396)
29 
30 US_BEGIN_NAMESPACE
31 
32 class ModulePrivate;
33 class ServiceRegistrationBasePrivate;
34 class ServicePropertiesImpl;
35 
56 class US_Core_EXPORT ServiceRegistrationBase
57 {
58 
59 private:
60 
61  typedef ServiceRegistrationBasePrivate* ServiceRegistrationBase::*bool_type;
62 
63 public:
64 
65  ServiceRegistrationBase(const ServiceRegistrationBase& reg);
66 
78  operator bool_type() const;
79 
86  ServiceRegistrationBase& operator=(int null);
87 
88  ~ServiceRegistrationBase();
89 
102  ServiceReferenceBase GetReference(const std::string& interfaceId = std::string()) const;
103 
129  void SetProperties(const ServiceProperties& properties);
130 
162  void Unregister();
163 
175  bool operator<(const ServiceRegistrationBase& o) const;
176 
177  bool operator==(const ServiceRegistrationBase& registration) const;
178 
179  ServiceRegistrationBase& operator=(const ServiceRegistrationBase& registration);
180 
181 
182 private:
183 
184  friend class ServiceRegistry;
185  friend class ServiceReferenceBasePrivate;
186 
187  template<class I1, class I2, class I3> friend class ServiceRegistration;
188 
189  US_HASH_FUNCTION_FRIEND(ServiceRegistrationBase);
190 
196  ServiceRegistrationBase();
197 
198  ServiceRegistrationBase(ServiceRegistrationBasePrivate* registrationPrivate);
199 
200  ServiceRegistrationBase(ModulePrivate* module, const InterfaceMap& service,
201  const ServicePropertiesImpl& props);
202 
203  ServiceRegistrationBasePrivate* d;
204 
205 };
206 
207 US_END_NAMESPACE
208 
209 US_MSVC_POP_WARNING
210 
211 US_HASH_FUNCTION_NAMESPACE_BEGIN
212 US_HASH_FUNCTION_BEGIN(US_PREPEND_NAMESPACE(ServiceRegistrationBase))
213  return US_HASH_FUNCTION(US_PREPEND_NAMESPACE(ServiceRegistrationBasePrivate)*, arg.d);
214 US_HASH_FUNCTION_END
215 US_HASH_FUNCTION_NAMESPACE_END
216 
217 
218 inline std::ostream& operator<<(std::ostream& os, const US_PREPEND_NAMESPACE(ServiceRegistrationBase)& /*reg*/)
219 {
220  return os << "US_PREPEND_NAMESPACE(ServiceRegistrationBase) object";
221 }
222 
223 #endif // USSERVICEREGISTRATIONBASE_H
std::map< std::string, void * > InterfaceMap
STL namespace.
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
US_UNORDERED_MAP_TYPE< std::string, Any > ServiceProperties
US_MSVC_POP_WARNING US_HASH_FUNCTION_NAMESPACE_BEGIN return US_HASH_FUNCTION(us::ServiceRegistrationBasePrivate *, arg.d)