27#define OPENSWMM_MODEL_EVENTS_IID "io.opensimulator.openswmm.IEventSource/1.0"
130 if (
const auto *
value = std::get_if<ModelEvent>(&
payload))
131 return value->instanceId;
132 if (
const auto *
value = std::get_if<SpatialEvent>(&
payload))
133 return value->instanceId;
134 if (
const auto *
value = std::get_if<ResultsEvent>(&
payload))
135 return value->instanceId;
185 std::function<
void(
const Event &)> callback) = 0;
201 : mConnection(std::move(connection))
216 : mConnection(std::exchange(other.mConnection, {}))
225 reset(std::exchange(other.mConnection, {}));
230 void reset(QMetaObject::Connection connection = {})
232 QObject::disconnect(mConnection);
233 mConnection = std::move(connection);
238 [[nodiscard]]
bool isConnected()
const {
return static_cast<bool>(mConnection); }
241 QMetaObject::Connection mConnection;
#define OPENSWMM_MODEL_EVENTS_IID
Frozen Qt interface identity for the first typed host event service.
Definition IModelEvents.hpp:27
Optional, frozen interface for receiver-scoped typed GUI observations.
Definition IModelEvents.hpp:165
virtual QMetaObject::Connection subscribe(QObject *context, const EventFilter &filter, std::function< void(const Event &)> callback)=0
Subscribe to filtered typed observations on the GUI thread.
virtual ~IModelEvents()=default
Destroy an implementation; plugins borrow the host-owned service.
Move-only owner that disconnects a Qt subscription when its scope ends.
Definition IModelEvents.hpp:194
ScopedEventSubscription(ScopedEventSubscription &&other) noexcept
Transfer connection ownership, leaving the source empty.
Definition IModelEvents.hpp:215
ScopedEventSubscription(const ScopedEventSubscription &other)=delete
Forbid duplicated ownership of a disconnect action.
ScopedEventSubscription & operator=(const ScopedEventSubscription &other)=delete
Forbid duplicated ownership of a disconnect action.
ScopedEventSubscription & operator=(ScopedEventSubscription &&other) noexcept
Disconnect this owner and transfer another connection into it.
Definition IModelEvents.hpp:222
ScopedEventSubscription(QMetaObject::Connection connection)
Take responsibility for disconnecting a connection.
Definition IModelEvents.hpp:200
bool isConnected() const
Inspect whether this owner holds a valid Qt connection handle.
Definition IModelEvents.hpp:238
void reset(QMetaObject::Connection connection={})
Disconnect the current handle and optionally take another one.
Definition IModelEvents.hpp:230
ScopedEventSubscription()=default
Construct an empty subscription owner.
~ScopedEventSubscription()
Disconnect the currently owned connection.
Definition IModelEvents.hpp:205
QPointer< QObject > context
Required provider lifetime guard.
Definition extensionattributes.cpp:31
Public header-only ABI for independently compiled native GUI extensions.
Definition ExtensionHost.hpp:24
constexpr auto MODEL_EVENTS_IID
Discoverable interface IID, equivalent to OPENSWMM_MODEL_EVENTS_IID.
Definition IModelEvents.hpp:32
std::variant< ModelEvent, SpatialEvent, ResultsEvent, RunsEvent, SettingsEvent, ThemeEvent, JobProgressEvent, JobFinishedEvent > EventPayload
Closed, owning payload alternatives for the frozen IModelEvents event service.
Definition IModelEvents.hpp:109
EventKind
Existing host observations with explicit, stable numeric identities.
Definition IModelEvents.hpp:37
@ AttributesChanged
The native attributeChanged observation identified an object or broad invalidation.
@ InstanceActivated
MDI activation resolved to a model, or a null UUID for another document.
@ SelectionChanged
Shared authored-model selection changed.
@ RunsChanged
Simulation Status metadata or row membership changed.
@ InstanceDiscovered
First discovery of a model facade, possibly before loading completes.
@ LayersChanged
Canvas layer membership changed; the affected layer identity is unspecified.
@ JobFinished
The owning extension's background worker completed.
@ ThemeChanged
The main-window palette changed.
@ ViewportChanged
Visible canvas extent or CRS changed, including resizing.
@ BoundaryChanged
A watched vector boundary source changed in place.
@ ActiveResultsChanged
Active 1D/2D results source changed, without a playback guarantee.
@ InstanceClosing
Model closure has begun; treat the model as unavailable.
@ SettingsChanged
The owning extension wrote or removed one settings key/group.
@ JobProgress
The owning extension reported background-job progress.
@ ModelEdited
The native modelEdited observation was emitted.
double value
Definition rasterfluxintegration.cpp:27
Immutable-at-registration selection of event kinds and a model identity.
Definition IModelEvents.hpp:145
bool accepts(const Event &event) const
Test a typed value against this filter without consulting host state.
Definition IModelEvents.hpp:152
QUuid instanceId
Accepted model UUID, or null for every model/global event.
Definition IModelEvents.hpp:147
QList< EventKind > kinds
Accepted kinds, or empty for every IModelEvents kind.
Definition IModelEvents.hpp:146
One typed observation published by an extension's host facade.
Definition IModelEvents.hpp:118
quint64 sequence
Host-local publication identity; zero is an unpublished default value.
Definition IModelEvents.hpp:121
EventPayload payload
Owning domain value; its alternative is fixed by kind.
Definition IModelEvents.hpp:123
EventKind kind
Case-sensitive legacy observations have typed identities here.
Definition IModelEvents.hpp:119
QUuid instanceId() const
Resolve the model identity carried by the typed domain value.
Definition IModelEvents.hpp:128
Copied completion status from one of the owning extension's background jobs.
Definition IModelEvents.hpp:100
bool ok
False for failure or cancellation; these outcomes are not distinguished here.
Definition IModelEvents.hpp:102
QString error
Failure detail; cancellation may produce an empty string.
Definition IModelEvents.hpp:104
QString title
Human-readable job title, not a unique operation identity.
Definition IModelEvents.hpp:101
Copied progress from one of the owning extension's background jobs.
Definition IModelEvents.hpp:93
QString text
Optional short progress-stage description.
Definition IModelEvents.hpp:96
double progress
Normalized completion fraction in the range [0,1].
Definition IModelEvents.hpp:95
QString title
Human-readable job title, not a unique operation identity.
Definition IModelEvents.hpp:94
Model discovery, closing, activation, selection, edit or attribute observation.
Definition IModelEvents.hpp:61
QUuid instanceId
Persistent model UUID; null activation means no active model.
Definition IModelEvents.hpp:62
QString objectName
Native object identifier for AttributesChanged, possibly empty for broad invalidation; never a field ...
Definition IModelEvents.hpp:64
Active result-source observation without result-reader ownership.
Definition IModelEvents.hpp:74
QUuid instanceId
Persistent model UUID whose active 1D/2D source changed.
Definition IModelEvents.hpp:75
Simulation Status invalidation; query the run registry for current rows.
Definition IModelEvents.hpp:80
One owning extension's settings invalidation.
Definition IModelEvents.hpp:84
QString key
Extension-local key or removed group, without another plugin's prefix.
Definition IModelEvents.hpp:85
Visible-area, canvas membership or watched vector-boundary observation.
Definition IModelEvents.hpp:68
QUuid instanceId
Persistent model UUID containing the canvas/source.
Definition IModelEvents.hpp:69
QString layerId
Watched source for BoundaryChanged; empty for viewport/membership changes.
Definition IModelEvents.hpp:70
Palette invalidation; query current host theme tokens.
Definition IModelEvents.hpp:89