OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
MultiColumnSeriesFile.hpp File Reference

Parse-once cache for multi-column external series files (CSV / TSV / PCSWMM TSF). More...

#include <string>
#include <string_view>
#include <unordered_map>
#include <vector>
Include dependency graph for MultiColumnSeriesFile.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  openswmm::input::ParsedSeriesFile
 One fully parsed multi-column series file (raw file-unit values). More...
 
class  openswmm::input::MultiColumnFileCache
 Per-resolve-pass cache keyed by resolved path. More...
 

Namespaces

namespace  openswmm
 
namespace  openswmm::input
 

Enumerations

enum class  openswmm::input::SeriesFileStatus {
  openswmm::input::OK ,
  openswmm::input::OPEN_FAILED ,
  openswmm::input::FORMAT_FAILED
}
 Why a parse failed (or that it did not). More...
 

Functions

bool openswmm::input::parse_series_datetime (const std::string &cell, double &out)
 Parse a full datetime cell.
 
bool openswmm::input::parse_multicolumn_series_file (const std::string &abs_path, ParsedSeriesFile &out, std::vector< std::string > &errors, SeriesFileStatus *status=nullptr)
 Parse a multi-column series file (format auto-detected).
 
bool openswmm::input::looks_like_multicolumn_series_file (const std::string &abs_path)
 Cheap content sniff: does this file look multi-column?
 
bool openswmm::input::split_series_file_token (std::string_view token, std::string &path_out, std::string &column_out)
 Split a path[:column] FILE token into its path and column parts.
 
long openswmm::input::multicolumn_parse_count_total () noexcept
 Process-wide count of multi-column file parses (test hook).
 

Detailed Description

Parse-once cache for multi-column external series files (CSV / TSV / PCSWMM TSF).

Implements the eager parse-once design of plans/MULTICOLUMN_SERIES_SINGLE_READ_2026-08-17.md (§3.1): each external file referenced by any number of rain gages and/or FILE-backed [TIMESERIES] tables is read from disk exactly once per resolve pass; consumers copy their selected column out of the shared ParsedSeriesFile and the cache is freed at end of pass.

Values are stored RAW (file units, no rain-type or unit conversion) — each consumer applies its own transform on copy-out, exactly as it did when it read the file itself.

Format auto-detection:

  • First content line starting with IDs: → PCSWMM TSF (tab-delimited; line 1 tokens 1..N are the column names, the next two lines — parameter and units rows — are skipped; datetimes are 12-hour MM/DD/YYYY hh:mm:ss AM/PM).
  • Otherwise CSV/TSV: delimiter sniffed from the header row (tab when tabs dominate, else comma); row 1 = headers, column 0 = time.

Lines are read with std::getline, so there is no fixed line-width limit (replaces the 4096-byte fgets buffers that silently split wide rows — plan gap P2).

See also
src/engine/input/PostParseResolver.cpp — the two consumers
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n Apache-2.0