SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
extensionattributes.cpp File Reference

Guarded attribute registration, namespacing and shared derived-value evaluation. More...

#include "plugins/extensionattributes.h"
#include <QDebug>
#include <QHash>
#include <QMap>
#include <QPointer>
#include <QRegularExpression>
#include <QScopeGuard>
#include <QSet>
#include <QThread>
#include <exception>
#include <memory>
Include dependency graph for extensionattributes.cpp:

Namespaces

namespace  openswmmvis
 

Functions

bool openswmmvis::registerExtensionAttributes (QObject *layer, const QString &id, OpenSWMM::Sdk::IComputedAttributeProvider *provider, QObject *context, std::function< void(bool)> changed, QString *error=nullptr)
 Atomically register one guarded provider on a layer.
 
void openswmmvis::unregisterExtensionAttributes (QObject *layer, const QString &id)
 Remove a provider and notify its live layer.
 
void openswmmvis::refreshExtensionAttributes (QObject *layer, const QString &id)
 Invalidate provider values, allowing retry after a calculation exception.
 
QVector< OpenSWMM::Render::AttributeField > openswmmvis::extensionAttributeFields (const QObject *layer, OpenSWMMVis::SwmmCategory category)
 Read validated, qualified field descriptors in deterministic provider order.
 
QVariantMap openswmmvis::extensionAttributeValues (const QObject *layer, OpenSWMMVis::SwmmCategory category, const QString &name, const QVariantMap &base)
 Merge derived values into a base model-object attribute snapshot.
 

Detailed Description

Guarded attribute registration, namespacing and shared derived-value evaluation.

Descriptors are validated before any registration is published. QObject guards remove callbacks before provider/model destruction. Shared entry snapshots tolerate unregistration during evaluation, and a per-thread recursion guard prevents derived-value dependency cycles. C++ calculation exceptions disable that provider's values until a deliberate refresh.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
Date
2026
License
GPL-3.0-or-later

Variable Documentation

◆ changed

std::function<void(bool)> changed

Guarded layer refresh callback.

◆ context

QPointer<QObject> context

Required provider lifetime guard.

◆ destroyed

QMetaObject::Connection destroyed

Disconnect when replacing/removing this entry.

◆ failed

bool failed = false

Suppress repeated exceptions until an explicit refresh.

◆ fields

QMap<int, QVector<OpenSWMM::Render::AttributeField> > fields

Local keys, grouped by category.

◆ provider

Initial value:
=
nullptr

Borrowed while context lives.