ServiceEvent¶
-
std::ostream &
cppmicroservices::
operator<<
(std::ostream &os, const ServiceEvent::Type &type)¶ Writes a string representation of
type
to the streamos
.
-
std::ostream &
cppmicroservices::
operator<<
(std::ostream &os, const ServiceEvent &event)¶ Writes a string representation of
event
to the streamos
.
-
class
cppmicroservices::
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:
-
SERVICE_REGISTERED
= 0x00000001¶ This service has been registered.
This event is delivered after the service has been registered with the framework.
-
SERVICE_MODIFIED
= 0x00000002¶ The properties of a registered service have been modified.
This event is delivered after the service properties have been modified.
-
SERVICE_UNREGISTERING
= 0x00000004¶ 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.
-
SERVICE_MODIFIED_ENDMATCH
= 0x00000008¶ 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.
-
Public Functions
-
ServiceEvent
()¶ Creates an invalid instance.
-
operator bool
() const¶ Can be used to check if this ServiceEvent instance is valid, or if it has been constructed using the default constructor.
- Return
true
if this event object is valid,false
otherwise.
-
ServiceEvent
(Type type, const ServiceReferenceBase &reference)¶ Creates a new service event object.
- Parameters
type
: The event type.reference
: AServiceReference
object to the service that had a lifecycle change.
-
ServiceEvent
(const ServiceEvent &other)¶
-
ServiceEvent &
operator=
(const ServiceEvent &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.
- Return
- Reference to the service that had a lifecycle change.
- template <class S>
-
ServiceReference<S>
GetServiceReference
() const¶
-
Type
GetType
() const¶ Returns the type of event.
The event type values are:
- Return
- Type of service lifecycle change.
-
enum