Medical Imaging Interaction Toolkit  2023.12.99-ed252ae7
Medical Imaging Interaction Toolkit
us::ServiceRegistrationBase Class Reference

#include <usServiceRegistrationBase.h>

Inheritance diagram for us::ServiceRegistrationBase:

Public Member Functions

 ServiceRegistrationBase (const ServiceRegistrationBase &reg)
 
 operator bool_type () const
 
ServiceRegistrationBaseoperator= (int null)
 
 ~ServiceRegistrationBase ()
 
ServiceReferenceBase GetReference (const std::string &interfaceId=std::string()) const
 
void SetProperties (const ServiceProperties &properties)
 
void Unregister ()
 
bool operator< (const ServiceRegistrationBase &o) const
 
bool operator== (const ServiceRegistrationBase &registration) const
 
ServiceRegistrationBaseoperator= (const ServiceRegistrationBase &registration)
 

Detailed Description

A registered service.

The framework returns a ServiceRegistrationBase object when a ModuleContext::RegisterService() method invocation is successful. The ServiceRegistrationBase object is for the private use of the registering module and should not be shared with other modules.

The ServiceRegistrationBase object may be used to update the properties of the service or to unregister the service.

Note
This class is provided as public API for low-level service management only. In almost all cases you should use the template ServiceRegistration instead.
See also
ModuleContext::RegisterService()
Remarks
This class is thread safe.

Definition at line 56 of file usServiceRegistrationBase.h.

Constructor & Destructor Documentation

◆ ServiceRegistrationBase()

us::ServiceRegistrationBase::ServiceRegistrationBase ( const ServiceRegistrationBase reg)

◆ ~ServiceRegistrationBase()

us::ServiceRegistrationBase::~ServiceRegistrationBase ( )

Member Function Documentation

◆ GetReference()

ServiceReferenceBase us::ServiceRegistrationBase::GetReference ( const std::string &  interfaceId = std::string()) const

Returns a ServiceReference object for a service being registered.

The ServiceReference object may be shared with other modules.

Exceptions
std::logic_errorIf this ServiceRegistrationBase object has already been unregistered or if it is invalid.
Returns
ServiceReference object.

◆ operator bool_type()

us::ServiceRegistrationBase::operator bool_type ( ) const

A boolean conversion operator converting this ServiceRegistrationBase object to true if it is valid and to false otherwise. A SeriveRegistration object is invalid if it was default-constructed or was invalidated by assigning 0 to it.

See also
operator=(int)
Returns
true if this ServiceRegistrationBase object is valid, false otherwise.

◆ operator<()

bool us::ServiceRegistrationBase::operator< ( const ServiceRegistrationBase o) const

Compare two ServiceRegistrationBase objects.

If both ServiceRegistrationBase objects are valid, the comparison is done using the underlying ServiceReference object. Otherwise, this ServiceRegistrationBase object is less than the other object if and only if this object is invalid and the other object is valid.

Parameters
oThe ServiceRegistrationBase object to compare with.
Returns
true if this ServiceRegistrationBase object is less than the other object.

◆ operator=() [1/2]

ServiceRegistrationBase& us::ServiceRegistrationBase::operator= ( const ServiceRegistrationBase registration)

◆ operator=() [2/2]

ServiceRegistrationBase& us::ServiceRegistrationBase::operator= ( int  null)

Releases any resources held or locked by this ServiceRegistrationBase and renders it invalid.

Returns
This ServiceRegistrationBase object.

◆ operator==()

bool us::ServiceRegistrationBase::operator== ( const ServiceRegistrationBase registration) const

◆ SetProperties()

void us::ServiceRegistrationBase::SetProperties ( const ServiceProperties properties)

Updates the properties associated with a service.

The ServiceConstants::OBJECTCLASS and ServiceConstants::SERVICE_ID keys cannot be modified by this method. These values are set by the framework when the service is registered in the environment.

The following steps are taken to modify service properties:

  1. The service's properties are replaced with the provided properties.
  2. A service event of type ServiceEvent::MODIFIED is fired.
Parameters
propertiesThe properties for this service. See ServiceProperties for a list of standard service property keys. Changes should not be made to this object after calling this method. To update the service's properties this method should be called again.
Exceptions
std::logic_errorIf this ServiceRegistrationBase object has already been unregistered or if it is invalid.
std::invalid_argumentIf properties contains case variants of the same key name.

◆ Unregister()

void us::ServiceRegistrationBase::Unregister ( )

Unregisters a service. Remove a ServiceRegistrationBase object from the framework service registry. All ServiceRegistrationBase objects associated with this ServiceRegistrationBase object can no longer be used to interact with the service once unregistration is complete.

The following steps are taken to unregister a service:

  1. The service is removed from the framework service registry so that it can no longer be obtained.
  2. A service event of type ServiceEvent::UNREGISTERING is fired so that modules using this service can release their use of the service. Once delivery of the service event is complete, the ServiceRegistrationBase objects for the service may no longer be used to get a service object for the service.
  3. For each module whose use count for this service is greater than zero:
    The module's use count for this service is set to zero.
    If the service was registered with a ServiceFactory object, the ServiceFactory::UngetService method is called to release the service object for the module.
Exceptions
std::logic_errorIf this ServiceRegistrationBase object has already been unregistered or if it is invalid.
See also
ModuleContext::UngetService
ServiceFactory::UngetService

The documentation for this class was generated from the following file: