Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
us::ServiceEvent Class Reference

#include <usServiceEvent.h>

Public Types

enum  Type { REGISTERED , MODIFIED , UNREGISTERING , MODIFIED_ENDMATCH }
 

Public Member Functions

 ServiceEvent ()
 Creates an invalid instance. More...
 
 ~ServiceEvent ()
 Destructor. More...
 
bool IsNull () const
 Can be used to check if this ServiceEvent instance is valid, or if it has been constructed using the default constructor. More...
 
 ServiceEvent (Type type, const ServiceReferenceBase &reference)
 Creates a new service event object. More...
 
 ServiceEvent (const ServiceEvent &other)
 Copy constructor. More...
 
ServiceEvent & operator= (const ServiceEvent &other)
 Copy assignment operator. More...
 
ServiceReferenceU GetServiceReference () const
 Returns a reference to the service that had a change occur in its lifecycle. More...
 
template<class S >
ServiceReference< S > GetServiceReference (InterfaceType< S >) const
 Returns a typed reference to the service that had a change occur in its lifecycle. More...
 
Type GetType () const
 Returns the type of event. More...
 

Detailed Description

An event from the Micro Services framework describing a service lifecycle change.

ServiceEvent objects are delivered to listeners connected via ModuleContext::AddServiceListener() when a change occurs in this service's lifecycle. A type code is used to identify the event type for future extendability.

Definition at line 46 of file usServiceEvent.h.

Member Enumeration Documentation

◆ Type

Enumerator
REGISTERED 

This service has been registered.

This event is delivered after the service has been registered with the framework.

See also
ModuleContext::RegisterService()
MODIFIED 

The properties of a registered service have been modified.

This event is delivered after the service properties have been modified.

See also
ServiceRegistration::SetProperties
UNREGISTERING 

This service is in the process of being unregistered.

This event is delivered before the service has completed unregistering.

If a module is using a service that is UNREGISTERING, the module should release its use of the service when it receives this event. If the module does not release its use of the service when it receives this event, the framework will automatically release the module's use of the service while completing the service unregistration operation.

See also
ServiceRegistration::Unregister
ModuleContext::UngetService
MODIFIED_ENDMATCH 

The properties of a registered service have been modified and the new properties no longer match the listener's filter.

This event is delivered after the service properties have been modified. This event is only delivered to listeners which were added with a non-empty filter where the filter matched the service properties prior to the modification but the filter does not match the modified service properties.

See also
ServiceRegistration::SetProperties

Definition at line 53 of file usServiceEvent.h.

Constructor & Destructor Documentation

◆ ServiceEvent() [1/3]

us::ServiceEvent::ServiceEvent ( )

Creates an invalid instance.

◆ ~ServiceEvent()

us::ServiceEvent::~ServiceEvent ( )

Destructor.

◆ ServiceEvent() [2/3]

us::ServiceEvent::ServiceEvent ( Type  type,
const ServiceReferenceBase &  reference 
)

Creates a new service event object.

Parameters
[in]typeThe event type.
[in]referenceA ServiceReference object to the service that had a lifecycle change.

◆ ServiceEvent() [3/3]

us::ServiceEvent::ServiceEvent ( const ServiceEvent &  other)

Copy constructor.

Member Function Documentation

◆ GetServiceReference() [1/2]

ServiceReferenceU us::ServiceEvent::GetServiceReference ( ) const

Returns a reference to the service that had a change occur in its lifecycle.

This reference is the source of the event. If this is a null event (default-constructed), returns an invalid ServiceReference.

Returns
Reference to the service that had a lifecycle change.

◆ GetServiceReference() [2/2]

template<class S >
ServiceReference<S> us::ServiceEvent::GetServiceReference ( InterfaceType< S >  ) const
inline

Returns a typed reference to the service that had a change occur in its lifecycle.

Template Parameters
SThe service interface type.
Returns
Typed reference to the service that had a lifecycle change.

Definition at line 160 of file usServiceEvent.h.

◆ GetType()

Type us::ServiceEvent::GetType ( ) const

Returns the type of event.

Exceptions
std::logic_errorIf this ServiceEvent is null (default-constructed).

The event type values are:

Returns
Type of service lifecycle change.

◆ IsNull()

bool us::ServiceEvent::IsNull ( ) const

Can be used to check if this ServiceEvent instance is valid, or if it has been constructed using the default constructor.

Returns
true if this event object is valid, false otherwise.

◆ operator=()

ServiceEvent& us::ServiceEvent::operator= ( const ServiceEvent &  other)

Copy assignment operator.


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