| 325 | } |
| 326 | |
| 327 | void mitk::Annotation::RegisterAsMicroservice(us::ServiceProperties props) |
| 328 | { |
| 329 | if (m_ServiceRegistration) |
| 330 | { |
| 331 | try |
| 332 | { |
| 333 | if (m_ServiceRegistration.IsAvailable()) |
| 334 | m_ServiceRegistration.Unregister(); |
| 335 | } |
| 336 | catch (...) |
| 337 | { |
| 338 | // Best-effort cleanup of the stale handle; proceed with the fresh |
| 339 | // registration even if the previous one cannot be torn down cleanly. |
| 340 | } |
| 341 | } |
| 342 | us::ModuleContext *context = us::GetModuleContext(); |
| 343 | // Define ServiceProps |
| 344 | mitk::UIDGenerator uidGen = mitk::UIDGenerator("org.mitk.services.Annotation.id_"); |
| 345 | props[US_PROPKEY_ID] = uidGen.GetUID(); |
| 346 | m_ServiceRegistration = context->RegisterService(this, props); |
| 347 | } |
| 348 | |
| 349 | void mitk::Annotation::UnRegisterMicroservice() |
| 350 | { |
no test coverage detected