ServiceEvent¶
-
std::ostream &operator<<(std::ostream &os, ServiceEvent::Type const &type)¶
Writes a string representation of
type
to the streamos
.
-
std::ostream &operator<<(std::ostream &os, ServiceEvent const &event)¶
Writes a string representation of
event
to the streamos
.
-
class ServiceEvent¶
- #include <cppmicroservices/ServiceEvent.h>
An event from the Micro Services framework describing a service lifecycle change.
ServiceEvent
objects are delivered to listeners connected via BundleContext::AddServiceListener() when a change occurs in this service’s lifecycle. A type code is used to identify the event type for future extendability.Public Types
-
enum Type¶
The service event type.
Values:
-
enumerator SERVICE_REGISTERED¶
This service has been registered.
This event is delivered after the service has been registered with the framework.
See also
-
enumerator SERVICE_MODIFIED¶
The properties of a registered service have been modified.
This event is delivered after the service properties have been modified.
See also
-
enumerator SERVICE_UNREGISTERING¶
This service is in the process of being unregistered.
This event is delivered before the service has completed unregistering.
If a bundle is using a service that is
SERVICE_UNREGISTERING
, the bundle should release its use of the service when it receives this event. If the bundle does not release its use of the service when it receives this event, the framework will automatically release the bundle’s use of the service while completing the service unregistration operation.See also
-
enumerator SERVICE_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
-
enumerator SERVICE_REGISTERED¶
Public Functions
-
ServiceEvent()¶
Creates an invalid instance.
-
explicit operator bool() 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.
-
ServiceEvent(Type type, ServiceReferenceBase const &reference)¶
Creates a new service event object.
- Parameters:
type – The event type.
reference – A
ServiceReference
object to the service that had a lifecycle change.
-
ServiceEvent(ServiceEvent const &other)¶
-
ServiceEvent &operator=(ServiceEvent const &other)¶
-
ServiceReferenceU GetServiceReference() const¶
Returns a reference to the service that had a change occur in its lifecycle.
This reference is the source of the event.
- Returns:
Reference to the service that had a lifecycle change.
-
template<class S>
inline ServiceReference<S> GetServiceReference() const¶
-
enum Type¶