OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches

Stores the full user-flags data: schema definitions + per-object values. More...

#include <UserFlags.hpp>

Collaboration diagram for openswmm::UserFlags:

Public Types

using ValueMap
 

Public Member Functions

void define (UserFlagDef def)
 Register a flag definition.
 
bool undefine (const std::string &name)
 Remove a flag definition and all per-object values assigned to it.
 
bool is_defined (const std::string &name) const
 Check whether a flag name has been defined (schema).
 
const UserFlagDefget_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 unset (const std::string &object_type, const std::string &object_name, const std::string &flag_name)
 Remove the value assigned 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 UserFlagValueget_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< UserFlagValuetry_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 ValueMapall_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 Public Member Functions

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".
 

Detailed Description

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).

Member Typedef Documentation

◆ ValueMap

Initial value:
std::unordered_map<std::string, UserFlagValue, CiHash, CiEqual>

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.

Member Function Documentation

◆ all_defs()

const std::vector< UserFlagDef > & openswmm::UserFlags::all_defs ( ) const
inlinenoexcept

All flag definitions, in insertion order.

Here is the caller graph for this function:

◆ all_values()

const ValueMap & openswmm::UserFlags::all_values ( ) const
inlinenoexcept

All per-object value assignments, keyed by composite string.

Here is the caller graph for this function:

◆ 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.

Here is the caller graph for this function:

◆ define()

void openswmm::UserFlags::define ( UserFlagDef def)
inline

Register a flag definition.

Overwrites any existing definition with the same name.

Here is the caller graph for this function:

◆ get_def()

const UserFlagDef & openswmm::UserFlags::get_def ( const std::string & name) const
inline

Retrieve a flag definition by name.

Exceptions
std::out_of_rangeif not defined.
Here is the caller graph for this function:

◆ 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_rangeif not found.
Here is the call graph for this function:

◆ 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.

Here is the call graph for this function:

◆ is_defined()

bool openswmm::UserFlags::is_defined ( const std::string & name) const
inline

Check whether a flag name has been defined (schema).

Here is the caller graph for this function:

◆ 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; the value map itself compares keys case-insensitively (CiHash/CiEqual), so no component needs pre-normalization and the first-seen spelling is preserved.

Here is the caller graph for this function:

◆ 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.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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.

Here is the call graph for this function:

◆ undefine()

bool openswmm::UserFlags::undefine ( const std::string & name)
inline

Remove a flag definition and all per-object values assigned to it.

Returns
true if the definition existed and was removed.

◆ unset()

bool openswmm::UserFlags::unset ( const std::string & object_type,
const std::string & object_name,
const std::string & flag_name )
inline

Remove the value assigned to (object_type, object_name, flag_name).

Returns
true if a value existed and was removed.
Here is the call graph for this function:

◆ value_count()

std::size_t openswmm::UserFlags::value_count ( ) const
inlinenoexcept

Number of per-object value assignments.

Here is the caller graph for this function:

The documentation for this class was generated from the following file: