状态类型系统
更多...
#include <rmvl/types.hpp>
|
| StateInfo ()=default |
|
void | add (std::string_view key, double val) |
| 添加数值状态
|
|
void | add (std::string_view key, std::string_view str) |
| 添加字符串状态
|
|
bool | remove (std::string_view key) |
| 移除状态类型
|
|
bool | contains (std::string_view key) const noexcept |
| 是否包含状态类型
|
|
void | clear () noexcept |
| 清空状态类型
|
|
bool | empty () const noexcept |
| 状态类型是否为空
|
|
const StateType & | at (std::string_view key) const |
| 获取状态
|
|
double | at_numeric (std::string_view key) const |
| 获取数值状态,若状态类型不是数值类型,则抛出 std::bad_variant_access 异常
|
|
const std::string & | at_string (std::string_view key) const |
| 获取字符串状态,若状态类型不是字符串类型,则抛出 std::bad_variant_access 异常
|
|
StateType & | at (std::string_view key) |
| 设置状态
|
|
StateType & | operator[] (std::string_view key) noexcept |
| 访问状态
|
|
◆ StateInfo()
rm::StateInfo::StateInfo |
( |
| ) |
|
|
default |
◆ add() [1/2]
void rm::StateInfo::add |
( |
std::string_view | key, |
|
|
double | val ) |
Python: |
---|
| rm.StateInfo.add( | key, val | ) -> | None |
| rm.StateInfo.add( | key, str | ) -> | None |
添加数值状态
void add(std::string_view key, double val)
添加数值状态
- 参数
-
[in] | key | 状态类型名称 |
[in] | val | 数值状态值 |
◆ add() [2/2]
void rm::StateInfo::add |
( |
std::string_view | key, |
|
|
std::string_view | str ) |
Python: |
---|
| rm.StateInfo.add( | key, val | ) -> | None |
| rm.StateInfo.add( | key, str | ) -> | None |
添加字符串状态
state.
add(
"tag1",
"hello");
- 参数
-
[in] | key | 状态类型名称 |
[in] | str | 字符串状态值 |
◆ at() [1/2]
StateType & rm::StateInfo::at |
( |
std::string_view | key | ) |
|
◆ at() [2/2]
const StateType & rm::StateInfo::at |
( |
std::string_view | key | ) |
const |
◆ at_numeric()
double rm::StateInfo::at_numeric |
( |
std::string_view | key | ) |
const |
Python: |
---|
| rm.StateInfo.at_numeric( | key | ) -> | val |
获取数值状态,若状态类型不是数值类型,则抛出 std::bad_variant_access
异常
- 参数
-
- 返回
- 状态
◆ at_string()
const std::string & rm::StateInfo::at_string |
( |
std::string_view | key | ) |
const |
Python: |
---|
| rm.StateInfo.at_string( | key | ) -> | val |
获取字符串状态,若状态类型不是字符串类型,则抛出 std::bad_variant_access
异常
- 参数
-
- 返回
- 状态
◆ clear()
void rm::StateInfo::clear |
( |
| ) |
|
|
noexcept |
Python: |
---|
| rm.StateInfo.clear( | | ) -> | None |
◆ contains()
bool rm::StateInfo::contains |
( |
std::string_view | key | ) |
const |
|
noexcept |
Python: |
---|
| rm.StateInfo.contains( | key | ) -> | <Is Contained ?> |
◆ empty()
bool rm::StateInfo::empty |
( |
| ) |
const |
|
noexcept |
Python: |
---|
| rm.StateInfo.empty( | | ) -> | <Is Empty ?> |
◆ operator[]()
StateType & rm::StateInfo::operator[] |
( |
std::string_view | key | ) |
|
|
noexcept |
Python: |
---|
| rm.StateInfo.__getitem__( | key | ) -> | val |
| rm.StateInfo.__setitem__( | key, val | ) -> | None |
◆ remove()
bool rm::StateInfo::remove |
( |
std::string_view | key | ) |
|
Python: |
---|
| rm.StateInfo.remove( | key | ) -> | None |
该类的文档由以下文件生成: