FrameworkEvent¶
-
std::ostream &
cppmicroservices::
operator<<
(std::ostream &os, FrameworkEvent::Type eventType)¶ Writes a string representation of
eventType
to the streamos
.
-
std::ostream &
cppmicroservices::
operator<<
(std::ostream &os, const FrameworkEvent &evt)¶ Writes a string representation of
evt
to the streamos
.
-
bool
cppmicroservices::
operator==
(const FrameworkEvent &rhs, const FrameworkEvent &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. AType
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:
-
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¶ The Framework has been started.
The Framework‘s BundleActivator Start method has been executed.
-
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.
-
Public Functions
-
FrameworkEvent
()¶ Creates an invalid instance.
-
operator bool
() const¶ Returns
false
if the FrameworkEvent is empty (i.e invalid) andtrue
if the FrameworkEvent is not null and contains valid data.- Return
true
if this event object is valid,false
otherwise.
-
FrameworkEvent
(Type type, const Bundle &bundle, const std::string &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:
- FRAMEWORK_STARTED
- FRAMEWORK_ERROR
- FRAMEWORK_WARNING
- FRAMEWORK_INFO
- FRAMEWORK_STOPPED
- FRAMEWORK_STOPPED_UPDATE
- FRAMEWORK_WAIT_TIMEDOUT
- Return
- The type of Framework event.
-
enum