BundleEvent¶
-
std::ostream &operator<<(std::ostream &os, BundleEvent::Type eventType)¶
Writes a string representation of
eventType
to the streamos
.
-
std::ostream &operator<<(std::ostream &os, BundleEvent const &event)¶
Writes a string representation of
event
to the streamos
.
-
class BundleEvent¶
- #include <cppmicroservices/BundleEvent.h>
An event from the Micro Services framework describing a bundle lifecycle change.
BundleEvent
objects are delivered to listeners connected via BundleContext::AddBundleListener() when a change occurs in a bundles’s lifecycle. A type code is used to identify the event type for future extendability.See also
Public Types
-
enum Type¶
The bundle event type.
Values:
-
enumerator BUNDLE_INSTALLED¶
The bundle has been installed.
The bundle has been installed by the Framework.
See also
BundleContext::InstallBundles(const std::string&)
-
enumerator BUNDLE_STARTED¶
The bundle has been started.
The bundle’s BundleActivator Start method has been executed if the bundle has a bundle activator class.
See also
-
enumerator BUNDLE_STOPPED¶
The bundle has been stopped.
The bundle’s BundleActivator Stop method has been executed if the bundle has a bundle activator class.
See also
-
enumerator BUNDLE_UPDATED¶
The bundle has been updated.
Note
This identifier is reserved for future use and not supported yet.
-
enumerator BUNDLE_UNINSTALLED¶
The bundle has been uninstalled.
See also
-
enumerator BUNDLE_RESOLVED¶
The bundle has been resolved.
See also
-
enumerator BUNDLE_UNRESOLVED¶
The bundle has been unresolved.
See also
Bundle#BUNDLE_INSTALLED
-
enumerator BUNDLE_STARTING¶
The bundle is about to be activated.
The bundle’s BundleActivator start method is about to be called if the bundle has a bundle activator class.
See also
-
enumerator BUNDLE_STOPPING¶
The bundle is about to deactivated.
The bundle’s BundleActivator stop method is about to be called if the bundle has a bundle activator class.
See also
-
enumerator BUNDLE_LAZY_ACTIVATION¶
The bundle will be lazily activated.
The bundle has a lazy activation policy and is waiting to be activated. It is now in the BUNDLE_STARTING state and has a valid
BundleContext
.Note
This identifier is reserved for future use and not supported yet.
-
enumerator BUNDLE_INSTALLED¶
Public Functions
-
BundleEvent()¶
Creates an invalid instance.
-
explicit operator bool() const¶
Can be used to check if this BundleEvent instance is valid, or if it has been constructed using the default constructor.
- Returns:
true
if this event object is valid,false
otherwise.
-
BundleEvent(Type type, Bundle const &bundle)¶
Creates a bundle event of the specified type.
- Parameters:
type – The event type.
bundle – The bundle which had a lifecycle change. This bundle is used as the origin of the event.
-
BundleEvent(Type type, Bundle const &bundle, Bundle const &origin)¶
Creates a bundle event of the specified type.
- Parameters:
type – The event type.
bundle – The bundle which had a lifecycle change.
origin – The bundle which is the origin of the event. For the event type
BUNDLE_INSTALLED
, this is the bundle whose context was used to install the bundle. Otherwise it is the bundle itself.
-
Bundle GetBundle() const¶
Returns the bundle which had a lifecycle change.
- Returns:
The bundle that had a change occur in its lifecycle.
-
Type GetType() const¶
Returns the type of lifecyle event.
The type values are:
- Returns:
The type of lifecycle event.
-
Bundle GetOrigin() const¶
Returns the bundle that was the origin of the event.
For the event type
BUNDLE_INSTALLED
, this is the bundle whose context was used to install the bundle. Otherwise it is the bundle itself.- Returns:
The bundle that was the origin of the event.
-
bool operator==(BundleEvent const &evt) const¶
Compares two bundle events for equality.
- Parameters:
evt – The bundle event to compare this event with.
- Returns:
true
if both events originate from the same bundle, describe a life-cycle change for the same bundle, and are of the same type.false
otherwise. Two invalid bundle events are considered to be equal.
-
enum Type¶