OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::TableData Struct Reference

SoA collection of all time series and curves in the model. More...

#include <TableData.hpp>

Collaboration diagram for openswmm::TableData:

Public Member Functions

std::size_t count () const noexcept
 
Tableoperator[] (int idx)
 
const Tableoperator[] (int idx) const
 
int add (const std::string &id, TableType type)
 Add a new empty table with the given ID and type.
 
void rebuild_index ()
 Rebuilds by_name from tables.
 
int find_by_kind (std::string_view name, bool want_timeseries) const noexcept
 Lowest-indexed table with this name and kind; -1 if none.
 
void reset_cursors () noexcept
 Reset all cursors (call before re-running a simulation).
 

Public Attributes

std::vector< Tabletables
 All tables in index order.
 
std::unordered_map< std::string, std::vector< int >, CiHash, CiEqualby_name
 Case-insensitive name → table indices, ascending.
 

Detailed Description

SoA collection of all time series and curves in the model.

Indexed by table index (integer). Lookup by name is done via the SimulationContext name-to-index hash map.

Member Function Documentation

◆ add()

int openswmm::TableData::add ( const std::string & id,
TableType type )
inline

Add a new empty table with the given ID and type.

Returns
Index of the new table.
Here is the caller graph for this function:

◆ count()

std::size_t openswmm::TableData::count ( ) const
inlinenoexcept
Here is the caller graph for this function:

◆ find_by_kind()

int openswmm::TableData::find_by_kind ( std::string_view name,
bool want_timeseries ) const
inlinenoexcept

Lowest-indexed table with this name and kind; -1 if none.

Parameters
want_timeseriestrue for TIMESERIES, false for any CURVE_*.
Here is the caller graph for this function:

◆ operator[]() [1/2]

Table & openswmm::TableData::operator[] ( int idx)
inline

◆ operator[]() [2/2]

const Table & openswmm::TableData::operator[] ( int idx) const
inline

◆ rebuild_index()

void openswmm::TableData::rebuild_index ( )
inline

Rebuilds by_name from tables.

Required after any structural change that is not an append — in practice only ObjectDeleter's erase-and-renumber, which is already O(n). Anything that mutates tables directly without calling this leaves lookups stale.

Here is the caller graph for this function:

◆ reset_cursors()

void openswmm::TableData::reset_cursors ( )
inlinenoexcept

Reset all cursors (call before re-running a simulation).

Member Data Documentation

◆ by_name

std::unordered_map<std::string, std::vector<int>, CiHash, CiEqual> openswmm::TableData::by_name

Case-insensitive name → table indices, ascending.

Replaces the linear ieq scan that find_timeseries() / find_curve() used to run over every table. That scan was the load path's worst complexity defect: [TIMESERIES] and [CURVES] rows repeat their object's name on every row in standard SWMM files, so parsing a model with many long series cost O(total_rows x n_tables) string compares before anything else happened.

A name maps to a list because legacy keeps TSERIES and CURVE in separate hash tables, so one name may legitimately denote both a timeseries and a curve. Lists are in ascending index order (add() only appends), which is what makes a hash hit return the same winner the old first-match scan did — the duplicate-name parity the name-case tests pin.

◆ tables

std::vector<Table> openswmm::TableData::tables

All tables in index order.


The documentation for this struct was generated from the following file: