RMVL  2.1.0-dev
Robotic Manipulation and Vision Library
载入中...
搜索中...
未找到
rm::Variable类 参考final

OPC UA 变量 更多...

#include <rmvl/opcua/variable.hpp>

rm::Variable 的协作图:

Public 成员函数

 Variable ()=default
 
template<typename Tp , typename DecayT = typename std::decay_t<Tp>, typename = std::enable_if_t<std::is_fundamental_v<DecayT> || std::is_same_v<DecayT, const char *>>>
 Variable (Tp val)
 单值构造
 
template<typename Tp , typename Enable = std::enable_if_t<std::is_fundamental_v<Tp> && !std::is_same_v<bool, Tp>>>
 Variable (const std::vector< Tp > &arr)
 列表构造
 
 Variable (VariableType &vtype)
 从变量类型构造新的变量节点
 
bool operator== (const Variable &val) const
 比较两个变量是否相等,当且仅当两个变量的数据类型、维数、数据值均相等时返回 true,而不考虑变量的名称、描述等信息
 
bool operator!= (const Variable &val) const
 比较两个变量是否不等
 
constexpr bool empty () const
 判断变量节点是否为空
 
template<typename Tp >
Tp cast () const
 将变量节点转化为指定类型的数据
 
template<typename Tp , typename DecayT = typename std::decay_t<Tp>, typename = std::enable_if_t<std::is_fundamental_v<DecayT> || std::is_same_v<DecayT, const char *>>>
 operator Tp () const
 基本数据类型转换函数
 
template<typename Tp , typename Enable = std::enable_if_t<std::is_fundamental_v<Tp> && !std::is_same_v<bool, Tp>>>
 operator std::vector< Tp > () const
 列表数据类型转换函数
 
const VariableTypetype () const
 获取用 rm::VariableType 表示的变量类型
 
const auto & data () const
 获取数据
 
DataType getDataType () const
 获取形如 UA_TYPES_<xxx> 的数据类型
 
UA_UInt32 size () const
 获取大小
 

静态 Public 成员函数

template<typename Tp >
static Tp cast (const rm::Variable &val)
 将变量节点转化为指定类型的数据
 

Public 属性

uint16_t ns {1U}
 命名空间索引,默认为 1
 
std::string browse_name {}
 浏览名称 BrowseName
 
std::string display_name {}
 展示名称 DisplayName
 
std::string description {}
 变量的描述
 
uint8_t access_level {}
 访问性
 

详细描述

OPC UA 变量

示例
samples/opcua/opcua_server.cpp.

构造及析构函数说明

◆ Variable() [1/4]

rm::Variable::Variable ( )
default

◆ Variable() [2/4]

template<typename Tp , typename DecayT = typename std::decay_t<Tp>, typename = std::enable_if_t<std::is_fundamental_v<DecayT> || std::is_same_v<DecayT, const char *>>>
rm::Variable::Variable ( Tp val)
inline

单值构造

模板参数
Tp变量的存储数据类型,必须是可包含 cv 限定符的基础类型及其引用类型,和 const char * 表示的字符串类型
参数
[in]val标量、数量值

◆ Variable() [3/4]

template<typename Tp , typename Enable = std::enable_if_t<std::is_fundamental_v<Tp> && !std::is_same_v<bool, Tp>>>
rm::Variable::Variable ( const std::vector< Tp > & arr)
inline

列表构造

模板参数
Tp变量的存储数据类型,必须是非 bool 的基础类型
参数
[in]arr列表、数组

◆ Variable() [4/4]

rm::Variable::Variable ( VariableType & vtype)
inlineexplicit

从变量类型构造新的变量节点

参数
[in]vtype既存的待作为变量节点类型信息的使用 rm::VariableType 表示的变量类型

成员函数说明

◆ cast() [1/2]

template<typename Tp >
Tp rm::Variable::cast ( ) const
inline

将变量节点转化为指定类型的数据

模板参数
Tp变量的数据类型
返回
该数据类型的数据
函数调用图:

◆ cast() [2/2]

template<typename Tp >
static Tp rm::Variable::cast ( const rm::Variable & val)
inlinestatic

将变量节点转化为指定类型的数据

模板参数
Tp变量的数据类型
参数
[in]val变量节点
返回
Tp 该数据类型的数据
示例
samples/opcua/opcua_client.cpp.
函数调用图:

◆ data()

const auto & rm::Variable::data ( ) const
inline

获取数据

◆ empty()

bool rm::Variable::empty ( ) const
inlineconstexpr

判断变量节点是否为空

◆ getDataType()

DataType rm::Variable::getDataType ( ) const
inline

获取形如 UA_TYPES_<xxx> 的数据类型

◆ operator std::vector< Tp >()

template<typename Tp , typename Enable = std::enable_if_t<std::is_fundamental_v<Tp> && !std::is_same_v<bool, Tp>>>
rm::Variable::operator std::vector< Tp > ( ) const
inline

列表数据类型转换函数

◆ operator Tp()

template<typename Tp , typename DecayT = typename std::decay_t<Tp>, typename = std::enable_if_t<std::is_fundamental_v<DecayT> || std::is_same_v<DecayT, const char *>>>
rm::Variable::operator Tp ( ) const
inline

基本数据类型转换函数

◆ operator!=()

bool rm::Variable::operator!= ( const Variable & val) const
inline

比较两个变量是否不等

参见
rm::Variable::operator==
参数
[in]val另一个变量
返回
是否不等

◆ operator==()

bool rm::Variable::operator== ( const Variable & val) const

比较两个变量是否相等,当且仅当两个变量的数据类型、维数、数据值均相等时返回 true,而不考虑变量的名称、描述等信息

参数
[in]val另一个变量
返回
是否相等

◆ size()

UA_UInt32 rm::Variable::size ( ) const
inline

获取大小

注解
未初始化则返回 0

◆ type()

const VariableType * rm::Variable::type ( ) const
inline

获取用 rm::VariableType 表示的变量类型

参见
_type
返回
变量类型

类成员变量说明

◆ access_level

uint8_t rm::Variable::access_level {}

访问性

◆ browse_name

std::string rm::Variable::browse_name {}

浏览名称 BrowseName

  • 属于非服务器层面的 ID 号,可用于完成路径搜索
  • 同一个命名空间 ns 下该名称不能重复
示例
samples/opcua/opcua_server.cpp.

◆ description

std::string rm::Variable::description {}

变量的描述

◆ display_name

std::string rm::Variable::display_name {}

展示名称 DisplayName

  • 在服务器上对外展示的名字 - en-US
  • 同一个命名空间 ns 下该名称可以相同
示例
samples/opcua/opcua_server.cpp.

◆ ns

uint16_t rm::Variable::ns {1U}

命名空间索引,默认为 1


该类的文档由以下文件生成: