Stores the full user-flags data: schema definitions + per-object values.
More...
#include <UserFlags.hpp>
|
| void | define (UserFlagDef def) |
| | Register a flag definition.
|
| |
| bool | is_defined (const std::string &name) const |
| | Check whether a flag name has been defined (schema).
|
| |
| const UserFlagDef & | get_def (const std::string &name) const |
| | Retrieve a flag definition by name.
|
| |
| const std::vector< UserFlagDef > & | all_defs () const noexcept |
| | All flag definitions, in insertion order.
|
| |
| std::size_t | def_count () const noexcept |
| | Number of defined flag schemas.
|
| |
| void | set (const std::string &object_type, const std::string &object_name, const std::string &flag_name, UserFlagValue value) |
| | Assign a value to (object_type, object_name, flag_name).
|
| |
| bool | has_value (const std::string &object_type, const std::string &object_name, const std::string &flag_name) const |
| | Check whether a value has been assigned for a given triple.
|
| |
| const UserFlagValue & | get_value (const std::string &object_type, const std::string &object_name, const std::string &flag_name) const |
| | Retrieve the value for (object_type, object_name, flag_name).
|
| |
| std::optional< UserFlagValue > | try_get_value (const std::string &object_type, const std::string &object_name, const std::string &flag_name) const |
| | Retrieve the value, or nullopt if not assigned.
|
| |
| const std::unordered_map< std::string, UserFlagValue > & | all_values () const noexcept |
| | All per-object value assignments, keyed by composite string.
|
| |
| std::size_t | value_count () const noexcept |
| | Number of per-object value assignments.
|
| |
| void | clear () noexcept |
| | Clear both schema definitions and per-object value assignments.
|
| |
|
| static std::string | make_key (const std::string &object_type, const std::string &object_name, const std::string &flag_name) |
| | Build the composite lookup key "OBJECTTYPE:OBJECTNAME:FLAGNAME".
|
| |
Stores the full user-flags data: schema definitions + per-object values.
Part of SimulationContext. Accessible at runtime via the C API and Python bindings.
Lookup key for per-object values is the composite string "OBJECTTYPE:OBJECTNAME:FLAGNAME" (all uppercase).
◆ all_defs()
| const std::vector< UserFlagDef > & openswmm::UserFlags::all_defs |
( |
| ) |
const |
|
inlinenoexcept |
All flag definitions, in insertion order.
◆ all_values()
| const std::unordered_map< std::string, UserFlagValue > & openswmm::UserFlags::all_values |
( |
| ) |
const |
|
inlinenoexcept |
All per-object value assignments, keyed by composite string.
◆ clear()
| void openswmm::UserFlags::clear |
( |
| ) |
|
|
inlinenoexcept |
Clear both schema definitions and per-object value assignments.
◆ def_count()
| std::size_t openswmm::UserFlags::def_count |
( |
| ) |
const |
|
inlinenoexcept |
Number of defined flag schemas.
◆ define()
Register a flag definition.
Overwrites any existing definition with the same name.
◆ get_def()
| const UserFlagDef & openswmm::UserFlags::get_def |
( |
const std::string & |
name | ) |
const |
|
inline |
Retrieve a flag definition by name.
- Exceptions
-
| std::out_of_range | if not defined. |
◆ get_value()
| const UserFlagValue & openswmm::UserFlags::get_value |
( |
const std::string & |
object_type, |
|
|
const std::string & |
object_name, |
|
|
const std::string & |
flag_name |
|
) |
| const |
|
inline |
Retrieve the value for (object_type, object_name, flag_name).
- Exceptions
-
| std::out_of_range | if not found. |
◆ has_value()
| bool openswmm::UserFlags::has_value |
( |
const std::string & |
object_type, |
|
|
const std::string & |
object_name, |
|
|
const std::string & |
flag_name |
|
) |
| const |
|
inline |
Check whether a value has been assigned for a given triple.
◆ is_defined()
| bool openswmm::UserFlags::is_defined |
( |
const std::string & |
name | ) |
const |
|
inline |
Check whether a flag name has been defined (schema).
◆ make_key()
| static std::string openswmm::UserFlags::make_key |
( |
const std::string & |
object_type, |
|
|
const std::string & |
object_name, |
|
|
const std::string & |
flag_name |
|
) |
| |
|
inlinestatic |
Build the composite lookup key "OBJECTTYPE:OBJECTNAME:FLAGNAME".
All components are used as-is (no case normalization). Callers are responsible for uppercasing object_type and flag_name before storage if case-insensitive lookup is desired.
◆ set()
| void openswmm::UserFlags::set |
( |
const std::string & |
object_type, |
|
|
const std::string & |
object_name, |
|
|
const std::string & |
flag_name, |
|
|
UserFlagValue |
value |
|
) |
| |
|
inline |
Assign a value to (object_type, object_name, flag_name).
Overwrites any existing assignment for the same triple. object_type and flag_name are stored uppercase.
◆ try_get_value()
| std::optional< UserFlagValue > openswmm::UserFlags::try_get_value |
( |
const std::string & |
object_type, |
|
|
const std::string & |
object_name, |
|
|
const std::string & |
flag_name |
|
) |
| const |
|
inline |
Retrieve the value, or nullopt if not assigned.
◆ value_count()
| std::size_t openswmm::UserFlags::value_count |
( |
| ) |
const |
|
inlinenoexcept |
Number of per-object value assignments.
The documentation for this class was generated from the following file:
- /home/runner/work/openswmm.engine/openswmm.engine/src/engine/core/UserFlags.hpp