Registry that maps section tags (e.g., "[JUNCTIONS]") to handlers.
More...
#include <SectionRegistry.hpp>
|
| | SectionRegistry ()=default |
| |
| | ~SectionRegistry ()=default |
| |
| void | register_builtin (std::string_view tag, SectionHandler handler) |
| | Register a built-in section handler.
|
| |
| void | register_custom (std::string_view tag, SectionHandler handler) |
| | Register a custom (user-defined) section handler. (R09)
|
| |
| bool | has (std::string_view tag) const |
| | Check if a section tag has a registered handler.
|
| |
| bool | is_custom (std::string_view tag) const |
| | Check if a section tag is a custom (non-builtin) handler.
|
| |
| void | dispatch (std::string_view tag, SimulationContext &ctx, const std::vector< std::string > &lines) const |
| | Dispatch a section to its handler.
|
| |
| std::vector< std::string > | registered_tags () const |
| | List all registered section tags (built-in + custom).
|
| |
Registry that maps section tags (e.g., "[JUNCTIONS]") to handlers.
Two types of sections:
- Built-in sections: Registered by InputReader at startup for all standard SWMM 5.x sections.
- Custom sections: Registered by user code via register_custom() for new or extension sections. Custom sections can override built-ins.
◆ SectionRegistry()
| openswmm::input::SectionRegistry::SectionRegistry |
( |
| ) |
|
|
default |
◆ ~SectionRegistry()
| openswmm::input::SectionRegistry::~SectionRegistry |
( |
| ) |
|
|
default |
◆ dispatch()
| void openswmm::input::SectionRegistry::dispatch |
( |
std::string_view |
tag, |
|
|
SimulationContext & |
ctx, |
|
|
const std::vector< std::string > & |
lines |
|
) |
| const |
Dispatch a section to its handler.
If no handler is registered for tag, the section is silently skipped (and the caller may issue a warning).
- Parameters
-
| tag | Section tag (without brackets, any case). |
| ctx | Simulation context. |
| lines | Lines in the section. |
◆ has()
| bool openswmm::input::SectionRegistry::has |
( |
std::string_view |
tag | ) |
const |
Check if a section tag has a registered handler.
- Parameters
-
| tag | Section tag (without brackets, any case). |
- Returns
- true if a handler is registered.
◆ is_custom()
| bool openswmm::input::SectionRegistry::is_custom |
( |
std::string_view |
tag | ) |
const |
Check if a section tag is a custom (non-builtin) handler.
- Parameters
-
| tag | Section tag (without brackets). |
- Returns
- true if registered via register_custom().
◆ register_builtin()
| void openswmm::input::SectionRegistry::register_builtin |
( |
std::string_view |
tag, |
|
|
SectionHandler |
handler |
|
) |
| |
Register a built-in section handler.
- Parameters
-
| tag | Section tag without brackets (e.g., "JUNCTIONS"). Case is normalized to uppercase before storage. |
| handler | Handler function. |
◆ register_custom()
| void openswmm::input::SectionRegistry::register_custom |
( |
std::string_view |
tag, |
|
|
SectionHandler |
handler |
|
) |
| |
Register a custom (user-defined) section handler. (R09)
Custom handlers override built-in handlers with the same tag. Use this to:
- Add entirely new section types to the input file.
- Override built-in parsing with custom logic.
- Parameters
-
| tag | Section tag without brackets (e.g., "MY_SECTION"). |
| handler | Custom handler function. |
Example:
const std::vector<std::string>& lines) {
for (const auto& line : lines) {
}
});
Central, reentrant simulation context.
Definition SimulationContext.hpp:141
◆ registered_tags()
| std::vector< std::string > openswmm::input::SectionRegistry::registered_tags |
( |
| ) |
const |
List all registered section tags (built-in + custom).
The documentation for this class was generated from the following files: