OpenSWMM Engine  6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
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 Member Functions

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 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 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 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 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 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 std::unordered_map< std::string, UserFlagValue > & 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.

Here is the caller graph for this function:

◆ 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 (no case normalization). Callers are responsible for uppercasing object_type and flag_name before storage if case-insensitive lookup is desired.

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:

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