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

Slice IO-8 — hydrate SimulationContext external-file slots from the Part D GeoPackage tables and materialise scratch files in the legacy on-disk format so legacy fopen sites keep working. More...

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

Go to the source code of this file.

Namespaces

namespace  openswmm
 
namespace  openswmm::gpkg
 

Functions

void openswmm::gpkg::read_external_content (sqlite3 *db, openswmm::SimulationContext &ctx, const std::string &simulation_id, const std::string &scratch_dir)
 Hydrate every external-file slot on ctx from the Part D tables and materialise scratch files in scratch_dir.
 
std::string openswmm::gpkg::scratchDirFor (const std::string &gpkg_path)
 Compute the canonical scratch-dir path for a given .gpkg file.
 

Detailed Description

Slice IO-8 — hydrate SimulationContext external-file slots from the Part D GeoPackage tables and materialise scratch files in the legacy on-disk format so legacy fopen sites keep working.

Companion to ExternalContentWriter. For each role with rows present in the Part D tables:

  1. Group rows by owner (gage, timeseries, node-id, hot-start slot, etc.) and feed them through the matching IO-6 materialiser to write a scratch file under <gpkg-stem>.scratch/.
  2. Populate the matching slot's FilePathPair:
    • .absolute ← scratch file path (ready for fopen).
    • .original ← diagnostic sentinel of the form "<gpkg:role:owner>" so InpWriter does not emit a stale path token if the model is later saved as .inp.

Scratch directory sits next to the .gpkg rather than in $TMPDIR so a reviewer can inspect what was fed to the engine (CLAUDE.md §4 transparent-IO directive).

On engine close, the orchestrator deletes the scratch directory; that hookup arrives with the C-API/engine lifecycle slice and is not part of IO-8.

Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License