Listeners

typedef std::function<void(const ServiceEvent&)> cppmicroservices::ServiceListener

A ServiceEvent listener.

A ServiceListener can be any callable object and is registered with the Framework using the BundleContext#AddServiceListener(const ServiceListener&, const std::string&) method. ServiceListener instances are called with a ServiceEvent object when a service has been registered, unregistered, or modified.

See
ServiceEvent

typedef std::function<void(const BundleEvent&)> cppmicroservices::BundleListener

A BundleEvent listener.

When a BundleEvent is fired, it is asynchronously (if threading support is enabled) delivered to a BundleListener. The Framework delivers BundleEvent objects to a BundleListener in order and does not concurrently call a BundleListener.

A BundleListener can be any callable object and is registered with the Framework using the BundleContext#AddBundleListener(const BundleListener&) method. BundleListener instances are called with a BundleEvent object when a bundle has been installed, resolved, started, stopped, updated, unresolved, or uninstalled.

See
BundleEvent

typedef std::function<void(const FrameworkEvent&)> cppmicroservices::FrameworkListener

A FrameworkEvent listener.

When a BundleEvent is fired, it is asynchronously (if threading support is enabled) delivered to a FrameworkListener. The Framework delivers FrameworkEvent objects to a FrameworkListener in order and does not concurrently call a FrameworkListener.

A FrameworkListener can be any callable object and is registered with the Framework using the BundleContext#AddFrameworkListener(const FrameworkListener&) method. FrameworkListener instances are called with a FrameworkEvent object when a framework life-cycle event or notification message occured.

See
FrameworkEvent

template <class R>
ServiceListener cppmicroservices::ServiceListenerMemberFunctor(R * receiver, void(R::*)(const ServiceEvent &) callback)

A convenience function that binds the member function callback of an object of type R and returns a ServiceListener object.

This object can then be passed into AddServiceListener().

Deprecated since version 3.1.0: This function exists only to maintain backwards compatibility and will be removed in the next major release. Use std::bind instead.

Return
a ServiceListener object.
Template Parameters
  • R: The type containing the member function.
Parameters
  • receiver: The object of type R.
  • callback: The member function pointer.

template <class R>
BundleListener cppmicroservices::BundleListenerMemberFunctor(R * receiver, void(R::*)(const BundleEvent &) callback)

A convenience function that binds the member function callback of an object of type R and returns a BundleListener object.

This object can then be passed into AddBundleListener().

Deprecated since version 3.1.0: This function exists only to maintain backwards compatibility and will be removed in the next major release. Use std::bind instead.

Return
a BundleListener object.
Template Parameters
  • R: The type containing the member function.
Parameters
  • receiver: The object of type R.
  • callback: The member function pointer.

template <class R>
FrameworkListener cppmicroservices::BindFrameworkListenerToFunctor(R * receiver, void(R::*)(const FrameworkEvent &) callback)

A convenience function that binds the member function callback of an object of type R and returns a FrameworkListener object.

This object can then be passed into AddFrameworkListener().

Deprecated since version 3.1.0: This function exists only to maintain backwards compatibility and will be removed in the next major release. Use std::bind instead.

Return
a FrameworkListener object.
Template Parameters
  • R: The type containing the member function.
Parameters
  • receiver: The object of type R.
  • callback: The member function pointer.