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;
73 const std::vector<std::string>*
find(
const std::string& upper_tag)
const {
75 if (s.first == upper_tag)
91 ComponentConfigSections& out);
103 ComponentConfigSections& out);
155class ProcessComponentRegistry {
160 static ProcessComponentRegistry&
instance();
181 std::vector<std::string>
known_ids()
const;
186 ProcessComponentRegistry();
187 std::map<std::string, ProcessComponentEntry> entries_;
201 const std::string& base_dir);
void register_component(const std::string &id, std::string description, ComponentConfigApply apply, ComponentConfigSave save=nullptr)
Insert or replace a complete component-hook entry and clear its pending phase.
Definition ProcessComponentRegistry.cpp:185
std::vector< std::string > known_ids() const
Copy every registered key, including planned entries without apply hooks.
Definition ProcessComponentRegistry.cpp:197
static ProcessComponentRegistry & instance()
Access the process-global lazily constructed builtin hook registry.
Definition ProcessComponentRegistry.cpp:180
const ProcessComponentEntry * find(const std::string &id) const
Borrow one exact component registry entry.
Definition ProcessComponentRegistry.cpp:192
Definition ProcessComponentRegistry.cpp:37
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.
Definition ProcessComponentRegistry.cpp:129
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.
Definition ProcessComponentRegistry.cpp:121
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.
Definition ProcessComponentRegistry.cpp:209
std::function< void(SimulationContext &ctx, const ProcessComponentSpec &spec, const ComponentConfigSections &config, std::vector< std::string > &errors)> ComponentConfigApply
Definition ProcessComponentRegistry.hpp:107
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:134
Definition ExchangeLaw.hpp:60
One row of [PROCESS_COMPONENTS] (Unified Transport suite, D-UT8).
Definition SimulationContext.hpp:158
Central, reentrant simulation context.
Definition SimulationContext.hpp:390
Definition ProcessComponentRegistry.hpp:65
const std::vector< std::string > * find(const std::string &upper_tag) const
Borrow the first exact section-tag match.
Definition ProcessComponentRegistry.hpp:73
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:137
ComponentConfigApply apply
Definition ProcessComponentRegistry.hpp:140
std::string description
short human-readable description
Definition ProcessComponentRegistry.hpp:138
std::string pending_phase
non-empty ⇒ planned, not yet implemented
Definition ProcessComponentRegistry.hpp:139
ComponentConfigSave save
Definition ProcessComponentRegistry.hpp:144