CppMicroServices

C++ Micro Services: ServiceListenerHook::ListenerInfo Struct Reference
ServiceListenerHook::ListenerInfo Struct Reference

Information about a Service Listener. More...

Public Member Functions

 ListenerInfo ()
 
 ListenerInfo (const ListenerInfo &other)
 
 ~ListenerInfo ()
 
ListenerInfooperator= (const ListenerInfo &other)
 
bool IsNull () const
 Can be used to check if this ListenerInfo instance is valid, or if it has been constructed using the default constructor. More...
 
ModuleContextGetModuleContext () const
 Return the context of the module which added the listener. More...
 
std::string GetFilter () const
 Return the filter string with which the listener was added. More...
 
bool IsRemoved () const
 Return the state of the listener for this addition and removal life cycle. More...
 
bool operator== (const ListenerInfo &other) const
 Compares this ListenerInfo to another ListenerInfo. More...
 

Detailed Description

Information about a Service Listener.

This class describes the module which added the Service Listener and the filter with which it was added.

Remarks
This class is not intended to be implemented by clients.

Constructor & Destructor Documentation

ServiceListenerHook::ListenerInfo::ListenerInfo ( )
ServiceListenerHook::ListenerInfo::ListenerInfo ( const ListenerInfo other)
ServiceListenerHook::ListenerInfo::~ListenerInfo ( )

Member Function Documentation

std::string ServiceListenerHook::ListenerInfo::GetFilter ( ) const

Return the filter string with which the listener was added.

Returns
The filter string with which the listener was added. This may be empty if the listener was added without a filter.
ModuleContext* ServiceListenerHook::ListenerInfo::GetModuleContext ( ) const

Return the context of the module which added the listener.

Returns
The context of the module which added the listener.
bool ServiceListenerHook::ListenerInfo::IsNull ( ) const

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

Returns
true if this listener object is valid, false otherwise.
bool ServiceListenerHook::ListenerInfo::IsRemoved ( ) const

Return the state of the listener for this addition and removal life cycle.

Initially this method will return false indicating the listener has been added but has not been removed. After the listener has been removed, this method must always returns true.

There is an extremely rare case in which removed notification to ServiceListenerHooks can be made before added notification if two threads are racing to add and remove the same service listener. Because ServiceListenerHooks are called synchronously during service listener addition and removal, the CppMicroServices library cannot guarantee in-order delivery of added and removed notification for a given service listener. This method can be used to detect this rare occurrence.

Returns
false if the listener has not been been removed, true otherwise.
ListenerInfo& ServiceListenerHook::ListenerInfo::operator= ( const ListenerInfo other)
bool ServiceListenerHook::ListenerInfo::operator== ( const ListenerInfo other) const

Compares this ListenerInfo to another ListenerInfo.

Two

s are equal if they refer to the same listener for a given addition and removal life cycle. If the same listener is added again, it will have a different ListenerInfo which is not equal to this ListenerInfo.

Parameters
otherThe object to compare against this ListenerInfo.
Returns
true if the other object is a ListenerInfo object and both objects refer to the same listener for a given addition and removal life cycle.