FrameworkEvent

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

Writes a string representation of eventType to the stream os.

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

Writes a string representation of evt to the stream os.

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

Compares two framework events for equality.

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

Public Types

enum Type

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

Values:

enumerator FRAMEWORK_STARTED

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.

enumerator FRAMEWORK_ERROR

An error has occurred.

There was an error associated with a bundle.

enumerator FRAMEWORK_WARNING

A warning has occurred.

There was a warning associated with a bundle.

enumerator FRAMEWORK_INFO

An informational event has occurred.

There was an informational event associated with a bundle.

enumerator FRAMEWORK_STOPPED

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.

enumerator FRAMEWORK_STOPPED_UPDATE

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.

enumerator FRAMEWORK_WAIT_TIMEDOUT

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.

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

Returns:

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.

Returns:

The bundle associated with the event.

std::string GetMessage() const

Returns the message associated with the event.

Returns:

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.

Returns:

The exception. May be nullptr if there is no related exception.

Type GetType() const

Returns the type of framework event.

The type values are:

Returns:

The type of Framework event.