![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Classes | |
| struct | ComponentConfigSections |
| struct | ProcessComponentEntry |
| class | ProcessComponentRegistry |
| Process-global id → entry table. More... | |
Typedefs | |
| using | ComponentConfigApply |
| using | ComponentConfigSave |
| Save hook (IO3a): render this component's CURRENT engine state back to config-file text — the inverse of ComponentConfigApply. | |
Functions | |
| std::string | parse_component_config_stream (std::istream &in, const std::string &label, ComponentConfigSections &out) |
| Append parsed bracketed sections from the current stream position. | |
| std::string | parse_component_config_text (const std::string &text, const std::string &label, ComponentConfigSections &out) |
| Parse component configuration text using the same section/comment rules as files. | |
| std::string | read_component_config (const std::string &path, const std::string &base_dir, ComponentConfigSections &out) |
| Clear sections, resolve a UTF-8 config path and parse the component dialect. | |
| std::vector< std::string > | resolve_process_components (SimulationContext &ctx, const std::string &base_dir) |
| Validate specs, parse each config and apply implemented builtin hooks in order. | |
Apply hook: consume the parsed config into engine state. Push diagnostics into errors (fatal) — never throw.
Save hook (IO3a): render this component's CURRENT engine state back to config-file text — the inverse of ComponentConfigApply.
Until this existed, swmm_model_write emitted the [PROCESS_COMPONENTS] config= PATH and copied the file the model was read from, but nothing rewrote its CONTENT. So every edit made through a C API or the GUI — a [HEAT_SOURCES] temperature, a reaction expression — was silently lost on save, while a hand-edit of the same file persisted. InpWriter's own comment states the intended division ("the component config FILES are each
component's own to write, never ours"); this is the hook that lets a component honour it.
ctx is CONST. A save must not mutate the model it is describing; that is the property that makes writing twice give the same file. | std::string openswmm::components::parse_component_config_stream | ( | std::istream & | in, |
| const std::string & | label, | ||
| ComponentConfigSections & | out ) |
Append parsed bracketed sections from the current stream position.
| [in,out] | in | Borrowed stream consumed until getline ends or a syntax error. |
| label | Source text used only in diagnostics. | |
| [in,out] | out | Existing sections are not cleared here; accepted sections append. A nested PROCESS_COMPONENTS section or content before the first recognized header returns an error with earlier appended data retained. |
| std::string openswmm::components::parse_component_config_text | ( | const std::string & | text, |
| const std::string & | label, | ||
| ComponentConfigSections & | out ) |
Parse component configuration text using the same section/comment rules as files.
| text | Borrowed complete text copied into an input stream. | |
| label | Diagnostic source label also stored as out.source_path. | |
| [out] | out | Sections cleared before parsing; a rejected document can retain its successfully parsed prefix. |
| std::string openswmm::components::read_component_config | ( | const std::string & | path, |
| const std::string & | base_dir, | ||
| ComponentConfigSections & | out ) |
Clear sections, resolve a UTF-8 config path and parse the component dialect.
| path | Config filename; relative paths join base_dir when nonempty. | |
| base_dir | Parent-input directory, or empty to use process working directory. Resolution does not force absolute/canonical form. | |
| [out] | out | Sections cleared immediately and source_path set to effective UTF-8 spelling, even on failure. Parsing errors can leave a retained prefix. |
| std::vector< std::string > openswmm::components::resolve_process_components | ( | SimulationContext & | ctx, |
| const std::string & | base_dir ) |
Validate specs, parse each config and apply implemented builtin hooks in order.
| [in,out] | ctx | Engine state holding process_component_specs and hook targets. Duplicate exact IDs are detected before any hook; then specs are handled in order. Unknown/planned/path-like IDs, absent config and parser errors append diagnostics and continue. Successfully parsed specs retain resolved_config_path before apply. |
| base_dir | Parent input directory for relative config paths; empty uses cwd. |