Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
usServiceRegistrationBase.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 USSERVICEREGISTRATIONBASE_H
14 #define USSERVICEREGISTRATIONBASE_H
15 
16 #include <usServiceProperties.h>
17 #include <usServiceReference.h>
18 
20 
21 namespace us {
22 
23 class ModulePrivate;
24 class ServiceRegistrationBasePrivate;
25 class ServicePropertiesImpl;
26 
48 {
49 
50 private:
51 
52  typedef ServiceRegistrationBasePrivate* ServiceRegistrationBase::*bool_type;
53 
54 public:
55 
58 
70  operator bool_type() const;
71 
79 
82 
95  ServiceReferenceBase GetReference(const std::string& interfaceId = std::string()) const;
96 
122  void SetProperties(const ServiceProperties& properties);
123 
155  void Unregister();
156 
158  bool IsAvailable() const;
159 
171  bool operator<(const ServiceRegistrationBase& o) const;
172 
174  bool operator==(const ServiceRegistrationBase& registration) const;
175 
177  bool operator==(std::nullptr_t) const noexcept;
178 
181 
182 
183 private:
184 
185  friend class ServiceRegistry;
186  friend class ServiceReferenceBasePrivate;
187 
188  template<class I1, class I2, class I3> friend class ServiceRegistration;
189 
190  friend struct std::hash<ServiceRegistrationBase>;
191 
198 
199  ServiceRegistrationBase(ServiceRegistrationBasePrivate* registrationPrivate);
200 
201  ServiceRegistrationBase(ModulePrivate* module, const InterfaceMap& service,
202  const ServicePropertiesImpl& props);
203 
204  ServiceRegistrationBasePrivate* d;
205 
206 };
207 
208 }
209 
211 
212 namespace std {
213 template<> struct hash<us::ServiceRegistrationBase> { std::size_t operator()(const us::ServiceRegistrationBase& arg) const {
214  return std::hash<us::ServiceRegistrationBasePrivate*>()(arg.d);
215 } };
216 }
217 
218 
219 inline std::ostream& operator<<(std::ostream& os, const us::ServiceRegistrationBase& /*reg*/)
220 {
221  return os << "us::ServiceRegistrationBase object";
222 }
223 
224 #endif // USSERVICEREGISTRATIONBASE_H
#define MITKCPPMICROSERVICES_EXPORT
ServiceRegistrationBase & operator=(const ServiceRegistrationBase &registration)
Copy assignment operator.
bool operator==(std::nullptr_t) const noexcept
Equality comparison with nullptr.
void SetProperties(const ServiceProperties &properties)
Updates the properties associated with a service.
bool IsAvailable() const
Returns whether the service is still registered.
ServiceReferenceBase GetReference(const std::string &interfaceId=std::string()) const
Returns a ServiceReference object for a service being registered.
void Unregister()
Unregisters a service. Remove a ServiceRegistrationBase object from the framework service registry....
ServiceRegistrationBase(const ServiceRegistrationBase &reg)
Copy constructor.
bool operator<(const ServiceRegistrationBase &o) const
Compare two ServiceRegistrationBase objects.
~ServiceRegistrationBase()
Destructor.
ServiceRegistrationBase & operator=(int null)
Releases any resources held or locked by this ServiceRegistrationBase and renders it invalid.
bool operator==(const ServiceRegistrationBase &registration) const
Equality comparison operator.
std::map< std::string, void * > InterfaceMap
A map containing interfaces ids and their corresponding service object pointers.
std::unordered_map< std::string, Any > ServiceProperties
std::size_t operator()(const us::ServiceRegistrationBase &arg) const
#define US_MSVC_POP_WARNING
#define US_MSVC_PUSH_DISABLE_WARNING(wn)
std::ostream & operator<<(std::ostream &os, const us::ServiceRegistrationBase &)