FrameworkEvent

std::ostream &cppmicroservices::operator<<(std::ostream &os, FrameworkEvent::Type eventType)

Writes a string representation of eventType to the stream os.

std::ostream &cppmicroservices::operator<<(std::ostream &os, FrameworkEvent const &evt)

Writes a string representation of evt to the stream os.

bool cppmicroservices::operator==(FrameworkEvent const &rhs, FrameworkEvent const &lhs)

Compares two framework events for equality.

class cppmicroservices::FrameworkEvent
#include <cppmicroservices/FrameworkEvent.h>

An event from the Micro Services framework describing a Framework event.

FrameworkEvent objects are delivered to listeners connected via BundleContext::AddFrameworkListener() when an event occurs within the Framework which a user would be interested in. A Type code is used to identify the event type for future extendability.

See
BundleContext::AddFrameworkListener

Public Types

enum Type

A type code used to identify the event type for future extendability.

Values:

FRAMEWORK_STARTED = 0x00000001

The Framework has started.

This event is fired when the Framework has started after all installed bundles that are marked to be started have been started. The source of this event is the System Bundle.

FRAMEWORK_ERROR = 0x00000002

An error has occurred.

There was an error associated with a bundle.

FRAMEWORK_WARNING = 0x00000010

A warning has occurred.

There was a warning associated with a bundle.

FRAMEWORK_INFO = 0x00000020

An informational event has occurred.

There was an informational event associated with a bundle.

FRAMEWORK_STOPPED = 0x00000040

The Framework has been stopped.

This event is fired when the Framework has been stopped because of a stop operation on the system bundle. The source of this event is the System Bundle.

FRAMEWORK_STOPPED_UPDATE = 0x00000080

The Framework is about to be stopped.

This event is fired when the Framework has been stopped because of an update operation on the system bundle. The Framework will be restarted after this event is fired. The source of this event is the System Bundle.

FRAMEWORK_WAIT_TIMEDOUT = 0x00000200

The Framework did not stop before the wait timeout expired.

This event is fired when the Framework did not stop before the wait timeout expired. The source of this event is the System Bundle.

Public Functions

FrameworkEvent()

Creates an invalid instance.

operator bool() const

Returns false if the FrameworkEvent is empty (i.e invalid) and true if the FrameworkEvent is not null and contains valid data.

Return
true if this event object is valid, false otherwise.

FrameworkEvent(Type type, Bundle const &bundle, std::string const &message, const std::exception_ptr exception = nullptr)

Creates a Framework event of the specified type.

Parameters
  • type: The event type.
  • bundle: The bundle associated with the event. This bundle is also the source of the event.
  • message: The message associated with the event.
  • exception: The exception associated with this event. Should be nullptr if there is no exception.

Bundle GetBundle() const

Returns the bundle associated with the event.

Return
The bundle associated with the event.

std::string GetMessage() const

Returns the message associated with the event.

Return
the message associated with the event.

std::exception_ptr GetThrowable() const

Returns the exception associated with this event.

Remark
Use std::rethrow_exception to throw the exception returned.
Return
The exception. May be nullptr if there is no related exception.

Type GetType() const

Returns the type of framework event.

The type values are:

Return
The type of Framework event.