open62541++ 0.13.0
C++ wrapper of open62541
|
#include <Variant.h>
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 (Type type) const noexcept |
bool | isType (const NodeId &id) const noexcept |
template<typename T > | |
bool | isType () const noexcept |
const UA_DataType * | getDataType () const noexcept |
std::optional< Type > | getVariantType () const noexcept |
void * | data () noexcept |
const void * | data () const noexcept |
void * | getScalar () |
const void * | getScalar () const |
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 |
void * | getArray () |
const void * | getArray () const |
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< T > | |
constexpr | Wrapper ()=default |
constexpr | Wrapper (const T &native) |
constexpr | Wrapper (T &&native) noexcept |
constexpr | operator T& () noexcept |
constexpr | operator const T & () const noexcept |
constexpr T * | operator-> () noexcept |
constexpr const T * | operator-> () const noexcept |
constexpr T * | handle () noexcept |
constexpr const T * | 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< T > | |
using | NativeType = T |
Protected Member Functions inherited from opcua::TypeWrapper< UA_Variant, UA_TYPES_VARIANT > | |
constexpr void | clear () noexcept |
Protected Member Functions inherited from opcua::Wrapper< T > | |
constexpr const T & | native () const noexcept |
constexpr T & | native () noexcept |
|
inlinestatic |
Create Variant from scalar value.
Policy | Policy (VariantPolicy) how to store the scalar inside the variant |
|
inlinestatic |
Create Variant from scalar value with custom data type.
Policy | Policy (VariantPolicy) how to store the scalar inside the variant |
|
inlinestatic |
Create Variant from array.
Policy | Policy (VariantPolicy) how to store the array inside the variant |
|
inlinestatic |
Create Variant from array with custom data type.
Policy | Policy (VariantPolicy) how to store the array inside the variant |
|
inlinestatic |
Create Variant from range of elements (copy required).
Policy | Policy (VariantPolicy) how to store the array inside the variant |
|
inlinestatic |
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 117 of file Variant.h.
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 |
Check if the variant type is equal to the provided type enum.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Get variant type.
|
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 186 of file Variant.h.
Referenced by getArray(), getArray(), and isScalar().
|
inlinenoexcept |
|
inline |
|
inline |
|
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 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 |
|
inline |
|
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 302 of file Variant.h.
Referenced by setScalar().
|
inlinenoexcept |
|
inline |
Copy scalar value to variant.
Definition at line 315 of file Variant.h.
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 337 of file Variant.h.
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 360 of file Variant.h.
Referenced by opcua::detail::VariantHandler< VariantPolicy::Copy >::setArray(), opcua::detail::VariantHandler< VariantPolicy::Copy >::setArray(), opcua::detail::VariantHandler< VariantPolicy::ReferenceIfPossible >::setArray(), opcua::detail::VariantHandler< VariantPolicy::ReferenceIfPossible >::setArray(), opcua::detail::VariantHandler< VariantPolicy::Copy >::setArray(), opcua::detail::VariantHandler< VariantPolicy::Copy >::setArray(), setArrayCopy(), and setArrayCopy().
|
inline |
|
inline |
|
inline |
|
constexprdefault |
|
inlineexplicitconstexpr |
Constructor with native object (deep copy).
Definition at line 36 of file TypeWrapper.h.
|
inlineconstexprnoexcept |
Constructor with native object (move rvalue).
Definition at line 40 of file TypeWrapper.h.
|
inlineconstexpr |
Copy constructor (deep copy).
Definition at line 48 of file TypeWrapper.h.
|
inlineconstexprnoexcept |
Move constructor.
Definition at line 52 of file TypeWrapper.h.