47#ifndef OPENSWMM_ENGINE_PLUGINS_PROCESS_COMPONENT_REGISTRY_HPP
48#define OPENSWMM_ENGINE_PLUGINS_PROCESS_COMPONENT_REGISTRY_HPP
67 std::vector<std::pair<std::string, std::vector<std::string>>>
sections;
70 const std::vector<std::string>*
find(
const std::string& upper_tag)
const {
72 if (s.first == upper_tag)
return &s.second;
88 const std::string& base_dir,
89 ComponentConfigSections& out);
95 const std::string& label,
96 ComponentConfigSections& out);
104 std::vector<std::string>& errors)>;
151class ProcessComponentRegistry {
153 static ProcessComponentRegistry&
instance();
164 std::vector<std::string>
known_ids()
const;
167 ProcessComponentRegistry();
168 std::map<std::string, ProcessComponentEntry> entries_;
181 const std::string& base_dir);
void register_component(const std::string &id, std::string description, ComponentConfigApply apply, ComponentConfigSave save=nullptr)
Definition ProcessComponentRegistry.cpp:168
std::vector< std::string > known_ids() const
Definition ProcessComponentRegistry.cpp:183
static ProcessComponentRegistry & instance()
Definition ProcessComponentRegistry.cpp:163
const ProcessComponentEntry * find(const std::string &id) const
Definition ProcessComponentRegistry.cpp:177
Definition ProcessComponentRegistry.cpp:36
std::string read_component_config(const std::string &path, const std::string &base_dir, ComponentConfigSections &out)
Parse a component configuration file (phase IO2).
Definition ProcessComponentRegistry.cpp:118
std::function< void(SimulationContext &ctx, const ProcessComponentSpec &spec, const ComponentConfigSections &config, std::vector< std::string > &errors)> ComponentConfigApply
Definition ProcessComponentRegistry.hpp:100
std::string parse_component_config_text(const std::string &text, const std::string &label, ComponentConfigSections &out)
Definition ProcessComponentRegistry.cpp:109
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,...
Definition ProcessComponentRegistry.cpp:194
std::function< std::string(const SimulationContext &ctx, const ProcessComponentSpec &spec)> ComponentConfigSave
Save hook (IO3a): render this component's CURRENT engine state back to config-file text — the inverse...
Definition ProcessComponentRegistry.hpp:129
Definition NodeCoupling.cpp:16
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
const std::vector< std::string > * find(const std::string &upper_tag) const
First section with this tag, or nullptr.
Definition ProcessComponentRegistry.hpp:70
std::vector< std::pair< std::string, std::vector< std::string > > > sections
Definition ProcessComponentRegistry.hpp:67
std::string source_path
resolved absolute/effective path
Definition ProcessComponentRegistry.hpp:66
Definition ProcessComponentRegistry.hpp:133
ComponentConfigApply apply
Definition ProcessComponentRegistry.hpp:136
std::string description
short human-readable description
Definition ProcessComponentRegistry.hpp:134
std::string pending_phase
non-empty ⇒ planned, not yet implemented
Definition ProcessComponentRegistry.hpp:135
ComponentConfigSave save
Definition ProcessComponentRegistry.hpp:140