![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
Registry that maps section tags (e.g., "[JUNCTIONS]") to handlers. More...
#include <SectionRegistry.hpp>
Public Member Functions | |
| SectionRegistry ()=default | |
| Create empty built-in/custom handler maps. | |
| ~SectionRegistry ()=default | |
| Destroy owned handler function objects and any captures they own. | |
| void | register_builtin (std::string_view tag, SectionHandler handler) |
| Store or replace one built-in section callback. | |
| void | register_custom (std::string_view tag, SectionHandler handler) |
| Store or replace a callback that takes precedence over a built-in. | |
| bool | has (std::string_view tag) const |
| Test whether either normalized handler map contains a tag. | |
| bool | is_custom (std::string_view tag) const |
| Test whether the normalized custom map contains a tag. | |
| void | dispatch (std::string_view tag, SimulationContext &ctx, const std::vector< std::string > &lines) const |
| Invoke a custom callback first, otherwise a built-in, otherwise no-op. | |
| std::vector< std::string > | registered_tags () const |
| Copy the union of normalized built-in/custom tags. | |
Registry that maps section tags (e.g., "[JUNCTIONS]") to handlers.
Two types of sections:
|
default |
Create empty built-in/custom handler maps.
|
default |
Destroy owned handler function objects and any captures they own.
| void openswmm::input::SectionRegistry::dispatch | ( | std::string_view | tag, |
| SimulationContext & | ctx, | ||
| const std::vector< std::string > & | lines ) const |
Invoke a custom callback first, otherwise a built-in, otherwise no-op.
Does not catch callback/allocation exceptions or synthesize unknown-section warnings. Callbacks must not retain line references beyond their valid lifetime. Caller serializes registry mutation and dispatch.
| [in] | tag | Borrowed tag without brackets; copied and normalized using Tokenizer::to_upper(). No bracket stripping or whitespace trimming occurs. |
| [in,out] | ctx | Caller-owned context forwarded by reference; callback controls mutations and error recording. |
| [in] | lines | Borrowed section lines passed synchronously; may include retained comment rows according to InputReader policy. |
| bool openswmm::input::SectionRegistry::has | ( | std::string_view | tag | ) | const |
Test whether either normalized handler map contains a tag.
| [in] | tag | Borrowed tag without brackets; copied and normalized using Tokenizer::to_upper(). No bracket stripping or whitespace trimming occurs. |
| bool openswmm::input::SectionRegistry::is_custom | ( | std::string_view | tag | ) | const |
Test whether the normalized custom map contains a tag.
| [in] | tag | Borrowed tag without brackets; copied and normalized using Tokenizer::to_upper(). No bracket stripping or whitespace trimming occurs. |
| void openswmm::input::SectionRegistry::register_builtin | ( | std::string_view | tag, |
| SectionHandler | handler ) |
Store or replace one built-in section callback.
Does not remove an overriding custom callback. Empty function objects are accepted and throw std::bad_function_call when invoked. Caller serializes registration and dispatch.
| [in] | tag | Borrowed tag without brackets; copied and normalized using Tokenizer::to_upper(). No bracket stripping or whitespace trimming occurs. |
| [in] | handler | Function object passed by value and moved into the registry; captured references must outlive dispatches. |
| void openswmm::input::SectionRegistry::register_custom | ( | std::string_view | tag, |
| SectionHandler | handler ) |
Store or replace a callback that takes precedence over a built-in.
Empty function objects are accepted; dispatch then throws std::bad_function_call. No internal synchronization.
| [in] | tag | Borrowed tag without brackets; copied and normalized using Tokenizer::to_upper(). No bracket stripping or whitespace trimming occurs. |
| [in] | handler | Function object passed by value and moved into owned storage; captured references remain caller-managed. |
| std::vector< std::string > openswmm::input::SectionRegistry::registered_tags | ( | ) | const |
Copy the union of normalized built-in/custom tags.