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

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)
 
std::string parse_component_config_text (const std::string &text, const std::string &label, ComponentConfigSections &out)
 
std::string read_component_config (const std::string &path, const std::string &base_dir, ComponentConfigSections &out)
 Parse a component configuration file (phase IO2).
 
std::vector< std::string > resolve_process_components (SimulationContext &ctx, const std::string &base_dir)
 Resolve every [PROCESS_COMPONENTS] spec (phase IO1): look up the id, read its config file, and invoke the apply hook.
 

Typedef Documentation

◆ ComponentConfigApply

Initial value:
std::function<void(SimulationContext& ctx,
const ProcessComponentSpec& spec,
const ComponentConfigSections& config,
std::vector<std::string>& errors)>
One row of [PROCESS_COMPONENTS] (Unified Transport suite, D-UT8).
Definition SimulationContext.hpp:154
Central, reentrant simulation context.
Definition SimulationContext.hpp:353
Definition ProcessComponentRegistry.hpp:65

Apply hook: consume the parsed config into engine state. Push diagnostics into errors (fatal) — never throw.

◆ ComponentConfigSave

Initial value:
std::function<std::string(const SimulationContext& ctx,
const ProcessComponentSpec& spec)>

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.

Returns
the complete config-file text, or empty to decline — an empty return means "I have nothing to serialize", and the writer falls back to the IO3 carry-alongside copy. Declining is how a component that has not implemented saving yet stays correct rather than truncating its own file to nothing.
Note
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.

Function Documentation

◆ parse_component_config_stream()

std::string openswmm::components::parse_component_config_stream ( std::istream & in,
const std::string & label,
ComponentConfigSections & out )
Here is the caller graph for this function:

◆ parse_component_config_text()

std::string openswmm::components::parse_component_config_text ( const std::string & text,
const std::string & label,
ComponentConfigSections & out )

Parse config TEXT (same dialect/rules as read_component_config) — E-C3's swmm_reactions_check_text / apply_text surface. label names the source in diagnostics.

Here is the call graph for this function:

◆ read_component_config()

std::string openswmm::components::read_component_config ( const std::string & path,
const std::string & base_dir,
ComponentConfigSections & out )

Parse a component configuration file (phase IO2).

Parameters
pathAs given in config="…".
base_dirDirectory of the parent .inp ("" ⇒ cwd) — relative paths resolve against it ([2D_MESH_FILE] §3).
out[out] cleared and filled.
Returns
Empty string on success, else a fatal diagnostic (missing file, unreadable, nested [PROCESS_COMPONENTS]).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resolve_process_components()

std::vector< std::string > openswmm::components::resolve_process_components ( SimulationContext & ctx,
const std::string & base_dir )

Resolve every [PROCESS_COMPONENTS] spec (phase IO1): look up the id, read its config file, and invoke the apply hook.

Parameters
base_dirDirectory of the parent .inp for relative config paths.
Returns
Diagnostics; empty ⇒ all specs resolved and applied. The caller (SWMMEngine::open) decides fatality/leniency, mirroring the external-2D-mesh handling.
Here is the call graph for this function: