26#ifndef OPENSWMMVIS_TIMESERIES_TIMESERIESPROVIDER_H
27#define OPENSWMMVIS_TIMESERIES_TIMESERIESPROVIDER_H
79 QString
name() const noexcept {
return m_name; }
83 QString
unitsLabel() const noexcept {
return m_unitsLabel; }
87 QString
description() const noexcept {
return m_description; }
94 QString
filePath() const noexcept {
return m_filePath; }
100 QDateTime
fileMTime() const noexcept {
return m_fileMTime; }
130 const QVector<TimeseriesPoint>&
points() const noexcept {
return m_points; }
136 bool setAllPoints(QVector<TimeseriesPoint> newPoints, QString *reasonOut =
nullptr);
140 bool setValueAt(
int i,
double newValue, QString *reasonOut =
nullptr);
148 bool setPointAt(
int i, QDateTime newTime,
double newValue, QString *reasonOut =
nullptr);
153 int insertPoint(QDateTime time,
double value, QString *reasonOut =
nullptr);
236 QString m_unitsLabel;
237 QString m_description;
240 QString m_columnSelector;
241 QDateTime m_fileMTime;
242 QVector<TimeseriesPoint> m_points;
247 int m_relativeCount = 0;
248 bool m_allRelative =
false;
249 QDateTime m_relativeAnchor;
252 static bool isStrictMonotone_(
const QVector<TimeseriesPoint>&
pts);
257 void reconcileRelativeAfterMutation_(
TimeMode prevMode);
Definition timeseriesprovider.h:43
void pointCacheDisposed()
Step F — ExternalFile mode: the lazy point cache was dropped via disposePointCache....
bool setAllPoints(QVector< TimeseriesPoint > newPoints, QString *reasonOut=nullptr)
Replace the entire point list. Validates strict-monotone time before applying. Atomic: either all rep...
Definition timeseriesprovider.cpp:124
int insertPoint(QDateTime time, double value, QString *reasonOut=nullptr)
Insert one point. Returns the new index on success.
Definition timeseriesprovider.cpp:214
TimeMode timeMode() const noexcept
Derived mode: Relative when every point is in the relative prefix (or an empty series carries relativ...
Definition timeseriesprovider.cpp:56
void pointsRemoved(int at, int count)
count points were removed starting at at.
int relativeCount() const noexcept
Leading points authored as elapsed-time-from-start.
Definition timeseriesprovider.h:179
int pointCount() const noexcept
Number of stored points. ExternalFile mode reports 0 until the read-through cache is implemented in i...
Definition timeseriesprovider.h:106
~TimeseriesProvider() override
void setFileSource(QString path, QString columnSelector, QDateTime mtime)
Definition timeseriesprovider.cpp:285
void setUnitsLabel(QString units)
Definition timeseriesprovider.cpp:263
const QVector< TimeseriesPoint > & points() const noexcept
All points (const ref).
Definition timeseriesprovider.h:130
void setSourceMode(SourceMode mode)
Definition timeseriesprovider.cpp:277
QString filePath() const noexcept
External file path (meaningful only when sourceMode == ExternalFile).
Definition timeseriesprovider.h:94
void setRelativeInfo(int count, QDateTime anchor, int allRelativeIntent=-1)
Raw restore used by registry load and undo: sets the prefix count (clamped to [0, pointCount()]),...
Definition timeseriesprovider.cpp:65
void pointsInserted(int at, int count)
count points were inserted starting at at.
QDateTime relativeAnchor() const noexcept
Simulation start the relative points' absolute times are anchored to (invalid when the series has no ...
Definition timeseriesprovider.h:183
void setName(QString newName)
Rename the Tseries. Uniqueness is the registry's responsibility; this just stores + notifies.
Definition timeseriesprovider.cpp:254
bool isPointCacheLoaded() const noexcept
True iff the in-memory point vector is populated. Inline / GeopackageObserved modes always return tru...
Definition timeseriesprovider.cpp:31
QString name() const noexcept
Tseries ID. Uniqueness within a project is owned by the registry.
Definition timeseriesprovider.h:79
QString description() const noexcept
Optional free-text description; surfaced by the editor's header context menu.
Definition timeseriesprovider.h:87
void timeModeChanged()
The derived timeMode() flipped, or the relative anchor moved. Payload-free; subscribers re-read (meta...
void sourceModeChanged(SourceMode prev, SourceMode now)
Source mode flipped.
bool setValueLive(int i, double newValue)
Live variant of setValueAt for drag-edit: does NOT push undo per-frame (caller handles batching)....
Definition timeseriesprovider.cpp:179
bool setPointAt(int i, QDateTime newTime, double newValue, QString *reasonOut=nullptr)
Change both time + value at index i. Validates that the new time still slots between neighbours stric...
Definition timeseriesprovider.cpp:188
bool setValueAt(int i, double newValue, QString *reasonOut=nullptr)
Change only the value at index i. Time stays put so monotonicity is preserved by construction.
Definition timeseriesprovider.cpp:164
QString columnSelector() const noexcept
Column selector inside the external file ("" = first / name-match).
Definition timeseriesprovider.h:97
QDateTime fileMTime() const noexcept
Last-known file mtime for staleness detection.
Definition timeseriesprovider.h:100
void setDescription(QString d)
Definition timeseriesprovider.cpp:270
const TimeseriesPoint & pointAt(int i) const
Read a single point by index. Caller must ensure 0 ≤ i < pointCount().
Definition timeseriesprovider.h:127
void removePointsAt(QVector< int > indices)
Remove points by index. Indices are deduplicated + sorted descending internally so the loop is safe.
Definition timeseriesprovider.cpp:238
TimeMode
How the series' times were authored in the .inp.
Definition timeseriesprovider.h:66
@ Relative
Every row is elapsed time from the simulation start.
@ Mixed
Elapsed head rows + dated tail (loaded, not authored).
@ Absolute
Every row carries (or inherits) an explicit date.
void metadataChanged()
Identity / units / description changed (signal carries no payload; subscribers re-read).
QString unitsLabel() const noexcept
Units label inferred from column suffix or set explicitly (e.g. "m", "ft³/s"). UI hint only — no unit...
Definition timeseriesprovider.h:83
void mutationRejected(QString reason)
A mutator was refused because it would have violated an invariant. Surfaced to UI so the drag-edit st...
void setTimeMode(TimeMode mode, QDateTime anchorForRelative={})
User-facing mode switch. Relative marks every current point relative and records anchorForRelative (w...
Definition timeseriesprovider.cpp:82
SourceMode
Where the data lives.
Definition timeseriesprovider.h:48
@ Inline
Stored in the project (.inp [TIMESERIES] rows).
@ ExternalFile
Linked to a CSV / TSV / .dat file on disk.
@ GeopackageObserved
Stored in the project geopackage observed_* tables.
SourceMode sourceMode() const noexcept
Definition timeseriesprovider.h:91
void disposePointCache()
Drop the in-memory point vector for ExternalFile-mode providers to reclaim memory when the editor swi...
Definition timeseriesprovider.cpp:41
void nameChanged(QString prev, QString now)
Tseries was renamed; dependent-reference cascading is the registry's job (subscribers should not rewr...
void pointsChanged(int firstIndex, int count)
Points in [firstIndex, firstIndex+count) had their value changed in place.
size_t i
Definition contourjob.cpp:27
QuadRegionMode mode
Resolved mode.
Definition meshgenerator.cpp:154
QVector< QPointF > pts
Definition meshpatch.cpp:62
Definition timeseriesprovider.h:34
int path
Definition pslgminsize.cpp:234
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
One (time, value) sample.
Definition timeseriesprovider.h:37
double value
Definition timeseriesprovider.h:39
QDateTime time
Definition timeseriesprovider.h:38