![]() |
SWMMVis
6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
|
#include <patternregistry.h>
Signals | |
| void | providerAdded (openswmmvis::pattern::PatternProvider *provider) |
| A provider was created and added to the registry. | |
| void | providerAboutToBeRemoved (openswmmvis::pattern::PatternProvider *provider) |
| A provider is about to be removed. Subscribers must drop refs. | |
| void | providerRenamed (openswmmvis::pattern::PatternProvider *provider, const QString &prevName, const QString &newName) |
| A provider's name changed. | |
Public Member Functions | |
| PatternRegistry (QObject *parent=nullptr) | |
| ~PatternRegistry () override | |
| QVector< PatternProvider * > | providers () const |
| All providers in insertion order. | |
| int | providerCount () const noexcept |
| PatternProvider * | findByName (const QString &name) const |
| Find by exact name (case-insensitive). Returns nullptr if absent. | |
| bool | hasName (const QString &name) const |
| True iff a provider with this name exists (case-insensitive). | |
| PatternProvider * | create (const QString &name, PatternType type) |
| Create + own a new provider with the given name + type. | |
| PatternProvider * | duplicate (const QString &srcName, const QString &newName) |
Clone an existing provider under a new name. Copies the source provider's type and all factor values. Returns nullptr if either name is invalid or newName already exists. | |
| void | remove (PatternProvider *p) |
Remove + delete a provider. Safe to call with a stale pointer (no-op if not owned by this registry). When an engine handle is attached the matching pattern is also dropped from the engine via swmm_pattern_remove, cascading to any reference sites. | |
| bool | rename (PatternProvider *p, const QString &newName) |
Rename a provider. Performs the uniqueness check; returns false (and emits no signal) if newName collides with a different existing provider. Same provider with same name is a no-op success. When an engine handle is attached the rename is mirrored via swmm_pattern_rename so every engine-side reference updates atomically. | |
| int | loadFromEngine (void *engineHandle) |
Populate the registry from a live SWMM engine handle. Walks swmm_pattern_*, creates one PatternProvider per entry — loading all factors. Pre-existing providers are NOT cleared; conflicts (duplicate name) are skipped silently. | |
| int | saveToEngine (void *engineHandle) |
Push every provider's factors back to the engine via swmm_pattern_set_factors. New providers (missing from the engine) are added via swmm_pattern_add first (requires the engine to be in BUILDING state). | |
| void | attachEngine (void *engineHandle) |
Attach an engine handle so subsequent mutations (create / remove / rename / duplicate) are mirrored to the engine via the matching swmm_pattern_* calls. Passing nullptr detaches. Used by SWMMModelLayer::ensurePatternRegistry. | |
| void * | engineHandle () const noexcept |
| The currently-attached engine handle (or nullptr). | |
|
explicit |
|
overridedefault |
|
inline |
Attach an engine handle so subsequent mutations (create / remove / rename / duplicate) are mirrored to the engine via the matching swmm_pattern_* calls. Passing nullptr detaches. Used by SWMMModelLayer::ensurePatternRegistry.
| PatternProvider * openswmmvis::pattern::PatternRegistry::create | ( | const QString & | name, |
| PatternType | type | ||
| ) |
Create + own a new provider with the given name + type.
If an engine handle is attached (see attachEngine), the new pattern is also added to the engine via swmm_pattern_add so the two stay in sync from the moment of creation.
| PatternProvider * openswmmvis::pattern::PatternRegistry::duplicate | ( | const QString & | srcName, |
| const QString & | newName | ||
| ) |
Clone an existing provider under a new name. Copies the source provider's type and all factor values. Returns nullptr if either name is invalid or newName already exists.
|
inlinenoexcept |
The currently-attached engine handle (or nullptr).
| PatternProvider * openswmmvis::pattern::PatternRegistry::findByName | ( | const QString & | name | ) | const |
Find by exact name (case-insensitive). Returns nullptr if absent.
|
inline |
True iff a provider with this name exists (case-insensitive).
| int openswmmvis::pattern::PatternRegistry::loadFromEngine | ( | void * | engineHandle | ) |
Populate the registry from a live SWMM engine handle. Walks swmm_pattern_*, creates one PatternProvider per entry — loading all factors. Pre-existing providers are NOT cleared; conflicts (duplicate name) are skipped silently.
| engineHandle | Opaque pointer to SWMM_Engine. Passed as void* so this header stays free of the engine C header. |
|
signal |
A provider is about to be removed. Subscribers must drop refs.
|
signal |
A provider was created and added to the registry.
|
inlinenoexcept |
|
signal |
A provider's name changed.
|
inline |
All providers in insertion order.
| void openswmmvis::pattern::PatternRegistry::remove | ( | PatternProvider * | p | ) |
Remove + delete a provider. Safe to call with a stale pointer (no-op if not owned by this registry). When an engine handle is attached the matching pattern is also dropped from the engine via swmm_pattern_remove, cascading to any reference sites.
| bool openswmmvis::pattern::PatternRegistry::rename | ( | PatternProvider * | p, |
| const QString & | newName | ||
| ) |
Rename a provider. Performs the uniqueness check; returns false (and emits no signal) if newName collides with a different existing provider. Same provider with same name is a no-op success. When an engine handle is attached the rename is mirrored via swmm_pattern_rename so every engine-side reference updates atomically.
| int openswmmvis::pattern::PatternRegistry::saveToEngine | ( | void * | engineHandle | ) |
Push every provider's factors back to the engine via swmm_pattern_set_factors. New providers (missing from the engine) are added via swmm_pattern_add first (requires the engine to be in BUILDING state).