open62541pp 0.16.0
C++ wrapper of open62541
|
#include <types.hpp>
UA_Variant wrapper class.
Public Member Functions | |
bool | isEmpty () const noexcept |
bool | isScalar () const noexcept |
bool | isArray () const noexcept |
bool | isType (const UA_DataType *dataType) const noexcept |
bool | isType (const UA_DataType &dataType) const noexcept |
bool | isType (const NodeId &id) const noexcept |
template<typename T > | |
bool | isType () const noexcept |
const UA_DataType * | getDataType () const noexcept |
void * | data () noexcept |
const void * | data () const noexcept |
template<typename T > | |
T & | getScalar () & |
template<typename T > | |
const T & | getScalar () const & |
template<typename T > | |
T && | getScalar () && |
template<typename T > | |
const T && | getScalar () const && |
template<typename T > | |
T | getScalarCopy () const |
size_t | getArrayLength () const noexcept |
Span< const uint32_t > | getArrayDimensions () const noexcept |
template<typename T > | |
Span< T > | getArray () |
template<typename T > | |
Span< const T > | getArray () const |
template<typename T > | |
std::vector< T > | getArrayCopy () const |
template<typename T > | |
void | setScalar (T &value) noexcept |
template<typename T > | |
void | setScalar (T &value, const UA_DataType &dataType) noexcept |
template<typename T > | |
void | setScalarCopy (const T &value) |
template<typename T > | |
void | setScalarCopy (const T &value, const UA_DataType &dataType) |
template<typename ArrayLike > | |
void | setArray (ArrayLike &&array) noexcept |
template<typename ArrayLike > | |
void | setArray (ArrayLike &&array, const UA_DataType &dataType) noexcept |
template<typename ArrayLike > | |
void | setArrayCopy (const ArrayLike &array) |
template<typename ArrayLike > | |
void | setArrayCopy (const ArrayLike &array, const UA_DataType &dataType) |
template<typename InputIt > | |
void | setArrayCopy (InputIt first, InputIt last) |
template<typename InputIt > | |
void | setArrayCopy (InputIt first, InputIt last, const UA_DataType &dataType) |
constexpr | TypeWrapper ()=default |
constexpr | TypeWrapper (const T &native) |
constexpr | TypeWrapper (T &&native) noexcept |
constexpr | TypeWrapper (const TypeWrapper &other) |
constexpr | TypeWrapper (TypeWrapper &&other) noexcept |
Public Member Functions inherited from opcua::TypeWrapper< UA_Variant, UA_TYPES_VARIANT > | |
constexpr | TypeWrapper ()=default |
constexpr | TypeWrapper (const UA_Variant &native) |
constexpr | TypeWrapper (UA_Variant &&native) noexcept |
constexpr | TypeWrapper (const TypeWrapper &other) |
constexpr | TypeWrapper (TypeWrapper &&other) noexcept |
~TypeWrapper () | |
constexpr TypeWrapper & | operator= (const TypeWrapper &other) |
constexpr TypeWrapper & | operator= (const UA_Variant &native) |
constexpr TypeWrapper & | operator= (TypeWrapper &&other) noexcept |
constexpr TypeWrapper & | operator= (UA_Variant &&native) noexcept |
constexpr void | swap (TypeWrapper &other) noexcept |
constexpr void | swap (UA_Variant &native) noexcept |
Public Member Functions inherited from opcua::Wrapper< UA_Variant > | |
constexpr | Wrapper ()=default |
constexpr | Wrapper (const UA_Variant &native) |
constexpr | Wrapper (UA_Variant &&native) noexcept |
constexpr | operator UA_Variant & () noexcept |
constexpr | operator const UA_Variant & () const noexcept |
constexpr UA_Variant * | operator-> () noexcept |
constexpr const UA_Variant * | operator-> () const noexcept |
constexpr UA_Variant * | handle () noexcept |
constexpr const UA_Variant * | handle () const noexcept |
Static Public Member Functions | |
template<VariantPolicy Policy = VariantPolicy::Copy, typename T > | |
static Variant | fromScalar (T &&value) |
template<VariantPolicy Policy = VariantPolicy::Copy, typename T > | |
static Variant | fromScalar (T &&value, const UA_DataType &dataType) |
template<VariantPolicy Policy = VariantPolicy::Copy, typename ArrayLike > | |
static Variant | fromArray (ArrayLike &&array) |
template<VariantPolicy Policy = VariantPolicy::Copy, typename ArrayLike > | |
static Variant | fromArray (ArrayLike &&array, const UA_DataType &dataType) |
template<VariantPolicy Policy = VariantPolicy::Copy, typename InputIt > | |
static Variant | fromArray (InputIt first, InputIt last) |
template<VariantPolicy Policy = VariantPolicy::Copy, typename InputIt > | |
static Variant | fromArray (InputIt first, InputIt last, const UA_DataType &dataType) |
Static Public Member Functions inherited from opcua::TypeWrapper< UA_Variant, UA_TYPES_VARIANT > | |
static constexpr TypeIndex | getTypeIndex () |
Additional Inherited Members | |
Public Types inherited from opcua::Wrapper< UA_Variant > | |
using | NativeType |
Protected Member Functions inherited from opcua::TypeWrapper< UA_Variant, UA_TYPES_VARIANT > | |
constexpr void | clear () noexcept |
Protected Member Functions inherited from opcua::Wrapper< UA_Variant > | |
constexpr const UA_Variant & | native () const noexcept |
constexpr UA_Variant & | native () noexcept |
|
inlinestaticnodiscard |
Create Variant from scalar value.
Policy | Policy (VariantPolicy) how to store the scalar inside the variant |
Definition at line 894 of file types.hpp.
Referenced by opcua::DataValue::fromScalar(), and opcua::Node< Connection >::writeValueScalar().
|
inlinestaticnodiscard |
Create Variant from scalar value with custom data type.
Policy | Policy (VariantPolicy) how to store the scalar inside the variant |
|
inlinestaticnodiscard |
Create Variant from array.
Policy | Policy (VariantPolicy) how to store the array inside the variant |
Definition at line 912 of file types.hpp.
Referenced by opcua::DataValue::fromArray(), opcua::Node< Connection >::writeValueArray(), and opcua::Node< Connection >::writeValueArray().
|
inlinestaticnodiscard |
Create Variant from array with custom data type.
Policy | Policy (VariantPolicy) how to store the array inside the variant |
|
inlinestaticnodiscard |
Create Variant from range of elements (copy required).
Policy | Policy (VariantPolicy) how to store the array inside the variant |
|
inlinestaticnodiscard |
Create Variant from range of elements with custom data type (copy required).
Policy | Policy (VariantPolicy) how to store the array inside the variant |
|
inlinenoexcept |
Check if the variant is empty.
Definition at line 958 of file types.hpp.
Referenced by isArray(), and isScalar().
|
inlinenoexcept |
|
inlinenoexcept |
Check if the variant is an array.
|
inlinenoexcept |
Check if the variant type is equal to the provided data type.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Get pointer to the underlying data.
Check the properties and data type before casting it to the actual type. Use the methods isScalar, isArray, isType / getDataType.
Definition at line 1007 of file types.hpp.
Referenced by opcua::services::detail::AttributeHandler< AttributeId::NodeClass >::fromDataValue(), getArray(), getArray(), and isScalar().
|
inlinenoexcept |
|
inline |
Get reference to scalar value with given template type (only native or wrapper types).
BadVariantAccess | If the variant is not a scalar or not of type `T`. |
Definition at line 1019 of file types.hpp.
Referenced by getScalar(), and getScalar().
|
inline |
Get reference to scalar value with given template type (only native or wrapper types).
BadVariantAccess | If the variant is not a scalar or not of type `T`. |
|
inline |
Get reference to scalar value with given template type (only native or wrapper types).
BadVariantAccess | If the variant is not a scalar or not of type `T`. |
|
inline |
Get reference to scalar value with given template type (only native or wrapper types).
BadVariantAccess | If the variant is not a scalar or not of type `T`. |
|
inline |
Get copy of scalar value with given template type.
BadVariantAccess | If the variant is not a scalar or not convertible to `T`. |
|
inlinenoexcept |
Get array length or 0 if variant is not an array.
|
inlinenoexcept |
|
inline |
Get array with given template type (only native or wrapper types).
BadVariantAccess | If the variant is not an array or not of type `T`. |
|
inline |
Get array with given template type (only native or wrapper types).
BadVariantAccess | If the variant is not an array or not of type `T`. |
|
inline |
Get copy of array with given template type and return it as a std::vector.
BadVariantAccess | If the variant is not an array or not convertible to `T`. |
|
inlinenoexcept |
Assign scalar value to variant (no copy).
Definition at line 1095 of file types.hpp.
Referenced by setScalar().
|
inlinenoexcept |
|
inline |
Copy scalar value to variant.
Definition at line 1108 of file types.hpp.
Referenced by opcua::detail::VariantHandler< VariantPolicy::Copy >::setScalar(), and opcua::detail::VariantHandler< VariantPolicy::Copy >::setScalar().
|
inline |
|
inlinenoexcept |
Assign array to variant (no copy).
array | Container with a contiguous sequence of elements. For example std::array , std::vector or Span . The underlying array must be accessible with std::data and std::size . |
Definition at line 1130 of file types.hpp.
Referenced by setArray().
|
inlinenoexcept |
Assign array to variant with custom data type (no copy).
array | Container with a contiguous sequence of elements. For example std::array , std::vector or Span . The underlying array must be accessible with std::data and std::size . |
dataType | Custom data type. |
|
inline |
Copy array to variant.
array | Iterable container, for example std::vector , std::list or Span . The container must implement begin() and end() . |
Definition at line 1158 of file types.hpp.
Referenced by opcua::detail::VariantHandler< VariantPolicy::Copy >::setArray(), opcua::detail::VariantHandler< VariantPolicy::Copy >::setArray(), opcua::detail::VariantHandler< VariantPolicy::Copy >::setArray(), opcua::detail::VariantHandler< VariantPolicy::Copy >::setArray(), opcua::detail::VariantHandler< VariantPolicy::ReferenceIfPossible >::setArray(), opcua::detail::VariantHandler< VariantPolicy::ReferenceIfPossible >::setArray(), setArrayCopy(), and setArrayCopy().
|
inline |
|
inline |
|
inline |
|
constexprdefault |
|
inlineexplicitconstexpr |
Constructor with native object (deep copy).
Definition at line 31 of file typewrapper.hpp.
|
inlineconstexprnoexcept |
Constructor with native object (move rvalue).
Definition at line 35 of file typewrapper.hpp.
|
inlineconstexpr |
Copy constructor (deep copy).
Definition at line 43 of file typewrapper.hpp.
|
inlineconstexprnoexcept |
Move constructor.
Definition at line 47 of file typewrapper.hpp.