C++ Based OPC UA Client/Server/PubSub SDK  1.7.6.537
OpcUa_Variant Struct Reference

A union of all built-in data types including an OpcUa_ExtensionObject. More...

#include <opcua_builtintypes.h>

Public Attributes

OpcUa_Byte Datatype
 Indicates the data type stored in the Variant. More...
 
OpcUa_Byte ArrayType
 A flag indicating that an array with one or more dimensions is stored in the Variant.
 
OpcUa_VariantUnion Value
 The value stored in the Variant.
 

Detailed Description

A union of all built-in data types including an OpcUa_ExtensionObject.

Variants can also contain arrays of any of these built-in types. Variants are used to store any value or parameter with a data type of BaseDataType or one of its subtypes.

Variants can be empty. An empty Variant is described as having a null value and should be treated like a null column in a SQL database. A null value in a Variant may not be the same as a null value for data types that support nulls such as Strings. Some development platforms may not be able to preserve the distinction between a null for a DataType and a null for a Variant. Therefore applications shall not rely on this distinction.

Variants can contain arrays of Variants but they cannot directly contain another Variant.

DataValue and DiagnosticInfo types only have meaning when returned in a response message with an associated StatusCode. As a result, Variants cannot contain instances of DataValue or DiagnosticInfo. This requirement means that if an attribute supports the writing of a null value, it shall also support writing of an empty Variant and vice versa.

Variables with a DataType of BaseDataType are mapped to a Variant, however, the ValueRank and ArrayDimensions attributes place restrictions on what is allowed in the Variant. For example, if the ValueRank is Scalar, the Variant may only contain scalar values.

ExtensionObjects and Variants allow unlimited nesting which could result in stack overflow errors even if the message size is less than the maximum allowed. Decoders shall support at least 100 nesting levels. Decoders shall report an error if the number of nesting levels exceeds what it supports.


The documentation for this struct was generated from the following file: