Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
usServiceReferenceBase.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 USSERVICEREFERENCEBASE_H
14 #define USSERVICEREFERENCEBASE_H
15 
16 #include <usAny.h>
17 
19 
20 namespace us {
21 
22 class Module;
23 class ServiceRegistrationBasePrivate;
24 class ServiceReferenceBasePrivate;
25 
35 
36 private:
37 
38  typedef ServiceReferenceBasePrivate* ServiceReferenceBase::*bool_type;
39 
40 public:
41 
44 
51  operator bool_type() const;
52 
58 
61 
82  Any GetProperty(const std::string& key) const;
83 
99  void GetPropertyKeys(std::vector<std::string>& keys) const;
100 
115  Module* GetModule() const;
116 
129  void GetUsingModules(std::vector<Module*>& modules) const;
130 
141  std::string GetInterfaceId() const;
142 
155  bool IsConvertibleTo(const std::string& interfaceid) const;
156 
180  bool operator<(const ServiceReferenceBase& reference) const;
181 
183  bool operator==(const ServiceReferenceBase& reference) const;
184 
186  bool operator==(std::nullptr_t) const noexcept;
187 
190 
191 private:
192 
193  friend class ModulePrivate;
194  friend class ModuleContext;
195  friend class ModuleHooks;
196  friend class ServiceHooks;
197  friend class ServiceObjectsBase;
198  friend class ServiceObjectsBasePrivate;
200  friend class ServiceRegistrationBasePrivate;
201  friend class ServiceListeners;
202  friend class ServiceRegistry;
203  friend class LDAPFilter;
204 
205  template<class S> friend class ServiceReference;
206 
207  friend struct std::hash<ServiceReferenceBase>;
208 
209  std::size_t Hash() const;
210 
217 
218  ServiceReferenceBase(ServiceRegistrationBasePrivate* reg);
219 
220  void SetInterfaceId(const std::string& interfaceId);
221 
222  ServiceReferenceBasePrivate* d;
223 
224 };
225 
226 }
227 
229 
235 MITKCPPMICROSERVICES_EXPORT std::ostream& operator<<(std::ostream& os, const us::ServiceReferenceBase& serviceRef);
236 
237 namespace std {
238 template<> struct hash<us::ServiceReferenceBase> { std::size_t operator()(const us::ServiceReferenceBase& arg) const {
239  return arg.Hash();
240 } };
241 }
242 
243 #endif // USSERVICEREFERENCEBASE_H
#define MITKCPPMICROSERVICES_EXPORT
An Any class represents a general type and is capable of storing any type, supporting type-safe extra...
Definition: usAny.h:145
An RFC 1960-based Filter.
Definition: usLDAPFilter.h:45
Represents a CppMicroServices module.
Definition: usModule.h:70
Base class for ServiceObjects providing type-erased service object management.
void GetUsingModules(std::vector< Module * > &modules) const
Returns the modules that are using the service referenced by this ServiceReferenceBase object....
bool operator==(std::nullptr_t) const noexcept
Equality comparison with nullptr.
Module * GetModule() const
Returns the module that registered the service referenced by this ServiceReferenceBase object.
bool IsConvertibleTo(const std::string &interfaceid) const
Checks whether this ServiceReferenceBase object can be converted to another ServiceReferenceBase obje...
std::string GetInterfaceId() const
Returns the interface identifier this ServiceReferenceBase object is bound to.
ServiceReferenceBase & operator=(const ServiceReferenceBase &reference)
Copy assignment operator.
bool operator==(const ServiceReferenceBase &reference) const
Equality comparison operator.
~ServiceReferenceBase()
Destructor.
ServiceReferenceBase(const ServiceReferenceBase &ref)
Copy constructor.
bool operator<(const ServiceReferenceBase &reference) const
Compares this ServiceReferenceBase with the specified ServiceReferenceBase for order.
void GetPropertyKeys(std::vector< std::string > &keys) const
Returns a list of the keys in the ServiceProperties object of the service referenced by this ServiceR...
Any GetProperty(const std::string &key) const
Returns the property value to which the specified property key is mapped in the properties ServicePro...
ServiceReferenceBase & operator=(int null)
Releases any resources held or locked by this ServiceReferenceBase and renders it invalid.
US_MSVC_POP_WARNING MITKCPPMICROSERVICES_EXPORT std::ostream & operator<<(std::ostream &os, const us::ServiceReferenceBase &serviceRef)
Stream output operator for ServiceReferenceBase.
std::size_t operator()(const us::ServiceReferenceBase &arg) const
#define US_MSVC_POP_WARNING
#define US_MSVC_PUSH_DISABLE_WARNING(wn)