Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
usServiceReferenceBase.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 USSERVICEREFERENCEBASE_H
23 #define USSERVICEREFERENCEBASE_H
24 
25 #include <usAny.h>
26 
27 US_MSVC_PUSH_DISABLE_WARNING(4396)
28 
29 US_BEGIN_NAMESPACE
30 
31 class Module;
32 class ServiceRegistrationBasePrivate;
33 class ServiceReferenceBasePrivate;
34 
43 class US_Core_EXPORT ServiceReferenceBase {
44 
45 private:
46 
47  typedef ServiceReferenceBasePrivate* ServiceReferenceBase::*bool_type;
48 
49 public:
50 
51  ServiceReferenceBase(const ServiceReferenceBase& ref);
52 
59  operator bool_type() const;
60 
65  ServiceReferenceBase& operator=(int null);
66 
67  ~ServiceReferenceBase();
68 
86  Any GetProperty(const std::string& key) const;
87 
100  void GetPropertyKeys(std::vector<std::string>& keys) const;
101 
116  Module* GetModule() const;
117 
127  void GetUsingModules(std::vector<Module*>& modules) const;
128 
139  std::string GetInterfaceId() const;
140 
153  bool IsConvertibleTo(const std::string& interfaceid) const;
154 
178  bool operator<(const ServiceReferenceBase& reference) const;
179 
180  bool operator==(const ServiceReferenceBase& reference) const;
181 
182  ServiceReferenceBase& operator=(const ServiceReferenceBase& reference);
183 
184 private:
185 
186  friend class ModulePrivate;
187  friend class ModuleContext;
188  friend class ModuleHooks;
189  friend class ServiceHooks;
190  friend class ServiceObjectsBase;
191  friend class ServiceObjectsBasePrivate;
193  friend class ServiceRegistrationBasePrivate;
194  friend class ServiceListeners;
195  friend class ServiceRegistry;
196  friend class LDAPFilter;
197 
198  template<class S> friend class ServiceReference;
199 
200  US_HASH_FUNCTION_FRIEND(ServiceReferenceBase);
201 
202  std::size_t Hash() const;
203 
209  ServiceReferenceBase();
210 
211  ServiceReferenceBase(ServiceRegistrationBasePrivate* reg);
212 
213  void SetInterfaceId(const std::string& interfaceId);
214 
215  ServiceReferenceBasePrivate* d;
216 
217 };
218 
219 US_END_NAMESPACE
220 
221 US_MSVC_POP_WARNING
222 
226 US_Core_EXPORT std::ostream& operator<<(std::ostream& os, const US_PREPEND_NAMESPACE(ServiceReferenceBase)& serviceRef);
227 
228 US_HASH_FUNCTION_NAMESPACE_BEGIN
229 US_HASH_FUNCTION_BEGIN(US_PREPEND_NAMESPACE(ServiceReferenceBase))
230  return arg.Hash();
231 US_HASH_FUNCTION_END
232 US_HASH_FUNCTION_NAMESPACE_END
233 
234 #endif // USSERVICEREFERENCEBASE_H
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
US_MSVC_POP_WARNING US_Core_EXPORT std::ostream & operator<<(std::ostream &os, const us::ServiceReferenceBase &serviceRef)
Definition: usAny.h:163
US_HASH_FUNCTION_NAMESPACE_BEGIN return arg Hash()