OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
Loading...
Searching...
No Matches
SectionRegistry.hpp File Reference

Registry that maps SWMM section tags to handler functions. More...

#include <string>
#include <string_view>
#include <vector>
#include <functional>
#include <unordered_map>
Include dependency graph for SectionRegistry.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  openswmm::input::SectionRegistry
 Registry that maps section tags (e.g., "[JUNCTIONS]") to handlers. More...
 

Namespaces

namespace  openswmm
 
namespace  openswmm::input
 

Typedefs

using openswmm::input::SectionHandler = std::function< void(SimulationContext &, const std::vector< std::string > &)>
 Handler function type for input file sections.
 

Detailed Description

Registry that maps SWMM section tags to handler functions.

The SectionRegistry enables optional sections (R09): user code can register custom handler functions for new section tags. Built-in sections (NODES, LINKS, etc.) are registered at startup.

Handler signature:

using SectionHandler = std::function<void(
SimulationContext&,
const std::vector<std::string>& lines
)>;
See also
Legacy reference: src/solver/input.c — findSection(), which uses a static keyword array and switch statement. The new registry replaces that with a hash map of function pointers.
tests/unit/test_section_registry.cpp
Author
Caleb Buahin caleb.nosp@m..bua.nosp@m.hin@g.nosp@m.mail.nosp@m..com
License\n MIT License