CppMicroServices

C++ Micro Services: ServiceEvent Class Reference
ServiceEvent Class Reference

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

Public Types

enum  Type { REGISTERED, MODIFIED, UNREGISTERING, MODIFIED_ENDMATCH }
 

Public Member Functions

 ServiceEvent ()
 Creates an invalid instance. More...
 
 ~ServiceEvent ()
 
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)
 
ServiceEventoperator= (const ServiceEvent &other)
 
ServiceReferenceU GetServiceReference () const
 Returns a reference to the service that had a change occur in its lifecycle. More...
 
template<class S >
ServiceReference< S > GetServiceReference () const
 
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.

Constructor & Destructor Documentation

ServiceEvent::ServiceEvent ( )

Creates an invalid instance.

ServiceEvent::~ServiceEvent ( )
ServiceEvent::ServiceEvent ( Type  type,
const ServiceReferenceBase reference 
)

Creates a new service event object.

Parameters
typeThe event type.
referenceA ServiceReference object to the service that had a lifecycle change.
ServiceEvent::ServiceEvent ( const ServiceEvent other)

Member Function Documentation

ServiceReferenceU 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.

Returns
Reference to the service that had a lifecycle change.
template<class S >
ServiceReference<S> ServiceEvent::GetServiceReference ( ) const
inline
Type ServiceEvent::GetType ( ) const

Returns the type of event.

The event type values are:

Returns
Type of service lifecycle change.
bool 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.
ServiceEvent& ServiceEvent::operator= ( const ServiceEvent other)