Stores the full user-flags data: schema definitions + per-object values.
More...
#include <UserFlags.hpp>
|
| void | define (UserFlagDef def) |
| | Insert or replace an exact-case flag schema.
|
| |
| bool | undefine (const std::string &name) |
| | Remove a schema and matching assignment suffixes.
|
| |
| bool | is_defined (const std::string &name) const |
| | Test exact-case schema membership.
|
| |
| const UserFlagDef & | get_def (const std::string &name) const |
| | Borrow an exact-case schema definition.
|
| |
| const std::vector< UserFlagDef > & | all_defs () const noexcept |
| | Borrow schema definitions in insertion order.
|
| |
| std::size_t | def_count () const noexcept |
| | Count schema definitions.
|
| |
| void | set (const std::string &object_type, const std::string &object_name, const std::string &flag_name, UserFlagValue value) |
| | Assign an owned variant value using a case-insensitive composite key.
|
| |
| bool | unset (const std::string &object_type, const std::string &object_name, const std::string &flag_name) |
| | Remove a case-insensitive composite assignment.
|
| |
| bool | has_value (const std::string &object_type, const std::string &object_name, const std::string &flag_name) const |
| | Test case-insensitive composite assignment membership.
|
| |
| const UserFlagValue & | get_value (const std::string &object_type, const std::string &object_name, const std::string &flag_name) const |
| | Borrow a case-insensitive composite assignment value.
|
| |
| std::optional< UserFlagValue > | try_get_value (const std::string &object_type, const std::string &object_name, const std::string &flag_name) const |
| | Copy a case-insensitive composite assignment when present.
|
| |
| const ValueMap & | all_values () const noexcept |
| | Borrow the complete case-insensitive assignment map.
|
| |
| std::size_t | value_count () const noexcept |
| | Count stored composite assignments.
|
| |
| void | clear () noexcept |
| | Erase all schemas and assignments.
|
| |
|
| static std::string | make_key (const std::string &object_type, const std::string &object_name, const std::string &flag_name) |
| | Join three unmodified components with colon delimiters.
|
| |
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" with original spelling and ASCII-insensitive value lookup. Schema definition lookup remains exact-case; callers normalize schema names when required.
◆ ValueMap
Composite-key value map; case-insensitive so object-name lookups match the engine's legacy-parity name semantics, while the stored key keeps the first-seen spelling for faithful [USER_FLAG_VALUES] round-trips.
◆ all_defs()
| const std::vector< UserFlagDef > & openswmm::UserFlags::all_defs |
( |
| ) |
const |
|
inlinenoexcept |
Borrow schema definitions in insertion order.
- Returns
- Reference to the owned vector; do not retain element references across schema edits.
◆ all_values()
| const ValueMap & openswmm::UserFlags::all_values |
( |
| ) |
const |
|
inlinenoexcept |
Borrow the complete case-insensitive assignment map.
- Returns
- Owned map reference; edits can invalidate iterators, and replacing/erasing entries invalidates borrowed values.
◆ clear()
| void openswmm::UserFlags::clear |
( |
| ) |
|
|
inlinenoexcept |
Erase all schemas and assignments.
Invalidates borrowed schema/value references and iterators; vector/map capacity is not explicitly released.
◆ def_count()
| std::size_t openswmm::UserFlags::def_count |
( |
| ) |
const |
|
inlinenoexcept |
Count schema definitions.
- Returns
- Number of exact-case schema entries.
◆ define()
Insert or replace an exact-case flag schema.
Replacing preserves schema insertion order and existing assignments, including values whose variant no longer matches the schema type. Adding can invalidate borrowed schema references.
- Parameters
-
| [in] | def | Definition passed by value and moved into storage; name/type/description are not normalized or validated. |
◆ get_def()
| const UserFlagDef & openswmm::UserFlags::get_def |
( |
const std::string & | name | ) |
const |
|
inline |
Borrow an exact-case schema definition.
- Parameters
-
| [in] | name | Exact-case schema key; this schema map does not normalize case. |
- Returns
- Engine-owned definition reference, invalidated by schema vector mutation or container destruction.
- Exceptions
-
| std::out_of_range | When the exact schema key is absent. |
◆ 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 |
Borrow a case-insensitive composite assignment value.
- Parameters
-
| [in] | object_type | Borrowed object-category token; copied into the composite key. |
| [in] | object_name | Borrowed object ID; no model-object existence check is performed. |
| [in] | flag_name | Borrowed flag token; no schema/type validation is performed by this value-map operation. |
- Returns
- Reference to the owned variant, valid until that entry is replaced/erased or the container is destroyed.
◆ has_value()
| bool openswmm::UserFlags::has_value |
( |
const std::string & | object_type, |
|
|
const std::string & | object_name, |
|
|
const std::string & | flag_name ) const |
|
inline |
Test case-insensitive composite assignment membership.
- Parameters
-
| [in] | object_type | Borrowed object-category token; copied into the composite key. |
| [in] | object_name | Borrowed object ID; no model-object existence check is performed. |
| [in] | flag_name | Borrowed flag token; no schema/type validation is performed by this value-map operation. |
- Returns
- True when the composite key is present.
◆ is_defined()
| bool openswmm::UserFlags::is_defined |
( |
const std::string & | name | ) |
const |
|
inline |
Test exact-case schema membership.
- Parameters
-
| [in] | name | Exact-case schema key; this schema map does not normalize case. |
- Returns
- True if that exact schema key exists.
◆ 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 |
Join three unmodified components with colon delimiters.
Performs no escaping, normalization or validation. Callers needing an unambiguous composite identity must ensure components contain no colons.
- Parameters
-
| [in] | object_type | Borrowed object-category token; copied into the composite key. |
| [in] | object_name | Borrowed object ID; no model-object existence check is performed. |
| [in] | flag_name | Borrowed flag token; no schema/type validation is performed by this value-map operation. |
- Returns
- New owned string object_type + colon + object_name + colon + flag_name.
◆ set()
| void openswmm::UserFlags::set |
( |
const std::string & | object_type, |
|
|
const std::string & | object_name, |
|
|
const std::string & | flag_name, |
|
|
UserFlagValue | value ) |
|
inline |
Assign an owned variant value using a case-insensitive composite key.
Overwrites an equivalent key while preserving its first stored spelling. Components are not uppercased; the map folds ASCII case. Caller serializes reads/edits; no engine lifecycle check occurs here.
- Parameters
-
| [in] | object_type | Borrowed object-category token; copied into the composite key. |
| [in] | object_name | Borrowed object ID; no model-object existence check is performed. |
| [in] | flag_name | Borrowed flag token; no schema/type validation is performed by this value-map operation. |
| [in] | value | Variant passed by value and moved into the map; no conversion to a declared schema type. |
◆ 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 |
Copy a case-insensitive composite assignment when present.
- Parameters
-
| [in] | object_type | Borrowed object-category token; copied into the composite key. |
| [in] | object_name | Borrowed object ID; no model-object existence check is performed. |
| [in] | flag_name | Borrowed flag token; no schema/type validation is performed by this value-map operation. |
- Returns
- Independent value copy, or std::nullopt for an absent key. String values may allocate while copying.
◆ undefine()
| bool openswmm::UserFlags::undefine |
( |
const std::string & | name | ) |
|
|
inline |
Remove a schema and matching assignment suffixes.
Renumbers following schema slots, then removes values whose suffix after the second colon equals name case-sensitively. Mixed-case assignment spellings can therefore survive; components containing colons are ambiguous to this suffix scan.
- Parameters
-
| [in] | name | Exact-case schema key; this schema map does not normalize case. |
- Returns
- True when the exact schema key existed; false leaves all assignments unchanged.
◆ unset()
| bool openswmm::UserFlags::unset |
( |
const std::string & | object_type, |
|
|
const std::string & | object_name, |
|
|
const std::string & | flag_name ) |
|
inline |
Remove a case-insensitive composite assignment.
- Parameters
-
| [in] | object_type | Borrowed object-category token; copied into the composite key. |
| [in] | object_name | Borrowed object ID; no model-object existence check is performed. |
| [in] | flag_name | Borrowed flag token; no schema/type validation is performed by this value-map operation. |
- Returns
- True when an equivalent key was erased.
◆ value_count()
| std::size_t openswmm::UserFlags::value_count |
( |
| ) |
const |
|
inlinenoexcept |
Count stored composite assignments.
- Returns
- Number of case-insensitively distinct composite keys.
The documentation for this class was generated from the following file:
- /home/runner/work/openswmm.engine/openswmm.engine/src/engine/core/UserFlags.hpp