open62541 1.3.10
Open source implementation of OPC UA
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
types.h File Reference
#include <open62541/config.h>
#include <open62541/common.h>
#include <open62541/statuscodes.h>

Go to the source code of this file.

Data Structures

struct  UA_String
 
struct  UA_DateTimeStruct
 
struct  UA_Guid
 
struct  UA_NodeId
 
struct  UA_ExpandedNodeId
 
struct  UA_QualifiedName
 
struct  UA_LocalizedText
 
struct  UA_NumericRangeDimension
 
struct  UA_NumericRange
 
struct  UA_Variant
 
struct  UA_ExtensionObject
 
struct  UA_DataValue
 
struct  UA_DiagnosticInfo
 
struct  UA_DataTypeMember
 
struct  UA_DataType
 
struct  UA_DataTypeArray
 
struct  UA_DecodeBinaryOptions
 

Macros

#define UA_TRUE   true UA_INTERNAL_DEPRECATED
 
#define UA_FALSE   false UA_INTERNAL_DEPRECATED
 
#define UA_SBYTE_MIN   (-128)
 
#define UA_SBYTE_MAX   127
 
#define UA_BYTE_MIN   0
 
#define UA_BYTE_MAX   255
 
#define UA_INT16_MIN   (-32768)
 
#define UA_INT16_MAX   32767
 
#define UA_UINT16_MIN   0
 
#define UA_UINT16_MAX   65535
 
#define UA_INT32_MIN   (-2147483648)
 
#define UA_INT32_MAX   2147483647
 
#define UA_UINT32_MIN   0
 
#define UA_UINT32_MAX   4294967295
 
#define UA_INT64_MAX   (int64_t)9223372036854775807LL
 
#define UA_INT64_MIN   ((int64_t)-UA_INT64_MAX-1LL)
 
#define UA_UINT64_MIN   (uint64_t)0
 
#define UA_UINT64_MAX   (uint64_t)18446744073709551615ULL
 
#define UA_STRING_ALLOC(CHARS)   UA_String_fromChars(CHARS)
 
#define UA_STRING_STATIC(CHARS)   {sizeof(CHARS)-1, (UA_Byte*)CHARS}
 
#define UA_DATETIME_USEC   10LL
 
#define UA_DATETIME_MSEC   (UA_DATETIME_USEC * 1000LL)
 
#define UA_DATETIME_SEC   (UA_DATETIME_MSEC * 1000LL)
 
#define UA_DATETIME_UNIX_EPOCH   (11644473600LL * UA_DATETIME_SEC)
 
#define UA_EMPTY_ARRAY_SENTINEL   ((void*)0x01)
 
#define UA_DATATYPEKINDS   31
 
#define UA_deleteMembers(p, type)   UA_clear(p, type)
 
#define UA_TYPENAME(name)
 

Typedefs

typedef int8_t UA_SByte
 
typedef uint8_t UA_Byte
 
typedef int16_t UA_Int16
 
typedef uint16_t UA_UInt16
 
typedef int32_t UA_Int32
 
typedef uint32_t UA_UInt32
 
typedef int64_t UA_Int64
 
typedef uint64_t UA_UInt64
 
typedef float UA_Float
 
typedef double UA_Double
 
typedef uint32_t UA_StatusCode
 
typedef int64_t UA_DateTime
 
typedef struct UA_DateTimeStruct UA_DateTimeStruct
 
typedef UA_String UA_ByteString
 
typedef UA_String UA_XmlElement
 
typedef struct UA_DataType UA_DataType
 
typedef struct UA_DiagnosticInfo UA_DiagnosticInfo
 
typedef struct UA_DataTypeArray UA_DataTypeArray
 

Enumerations

enum  UA_NodeIdType
 
enum  UA_VariantStorageType
 
enum  UA_ExtensionObjectEncoding
 
enum  UA_DataTypeKind
 

Functions

UA_EXPORT const char * UA_StatusCode_name (UA_StatusCode code)
 
UA_String UA_String_fromChars (const char *src)
 
UA_Boolean UA_String_equal (const UA_String *s1, const UA_String *s2)
 
UA_DateTime UA_DateTime_now (void)
 
UA_Int64 UA_DateTime_localTimeUtcOffset (void)
 
UA_DateTime UA_DateTime_nowMonotonic (void)
 
UA_DateTimeStruct UA_DateTime_toStruct (UA_DateTime t)
 
UA_DateTime UA_DateTime_fromStruct (UA_DateTimeStruct ts)
 
UA_Boolean UA_Guid_equal (const UA_Guid *g1, const UA_Guid *g2)
 
UA_StatusCode UA_ByteString_allocBuffer (UA_ByteString *bs, size_t length)
 
UA_StatusCode UA_ByteString_toBase64 (const UA_ByteString *bs, UA_String *output)
 
UA_StatusCode UA_ByteString_fromBase64 (UA_ByteString *bs, const UA_String *input)
 
UA_UInt32 UA_ByteString_hash (UA_UInt32 initialHashValue, const UA_Byte *data, size_t size)
 
UA_Boolean UA_NodeId_isNull (const UA_NodeId *p)
 
UA_StatusCode UA_NodeId_print (const UA_NodeId *id, UA_String *output)
 
UA_Order UA_NodeId_order (const UA_NodeId *n1, const UA_NodeId *n2)
 
UA_UInt32 UA_NodeId_hash (const UA_NodeId *n)
 
UA_StatusCode UA_ExpandedNodeId_print (const UA_ExpandedNodeId *id, UA_String *output)
 
UA_Boolean UA_ExpandedNodeId_isLocal (const UA_ExpandedNodeId *n)
 
UA_Order UA_ExpandedNodeId_order (const UA_ExpandedNodeId *n1, const UA_ExpandedNodeId *n2)
 
UA_UInt32 UA_ExpandedNodeId_hash (const UA_ExpandedNodeId *n)
 
UA_UInt32 UA_QualifiedName_hash (const UA_QualifiedName *q)
 
UA_Boolean UA_QualifiedName_equal (const UA_QualifiedName *qn1, const UA_QualifiedName *qn2)
 
UA_StatusCode UA_NumericRange_parse (UA_NumericRange *range, const UA_String str)
 
void UA_Variant_setScalar (UA_Variant *v, void *p, const UA_DataType *type)
 
UA_StatusCode UA_Variant_setScalarCopy (UA_Variant *v, const void *p, const UA_DataType *type)
 
void UA_Variant_setArray (UA_Variant *v, void *array, size_t arraySize, const UA_DataType *type)
 
UA_StatusCode UA_Variant_setArrayCopy (UA_Variant *v, const void *array, size_t arraySize, const UA_DataType *type)
 
UA_StatusCode UA_Variant_copyRange (const UA_Variant *src, UA_Variant *dst, const UA_NumericRange range)
 
UA_StatusCode UA_Variant_setRange (UA_Variant *v, void *array, size_t arraySize, const UA_NumericRange range)
 
UA_StatusCode UA_Variant_setRangeCopy (UA_Variant *v, const void *array, size_t arraySize, const UA_NumericRange range)
 
void UA_ExtensionObject_setValue (UA_ExtensionObject *eo, void *p, const UA_DataType *type)
 
void UA_ExtensionObject_setValueNoDelete (UA_ExtensionObject *eo, void *p, const UA_DataType *type)
 
UA_StatusCode UA_ExtensionObject_setValueCopy (UA_ExtensionObject *eo, void *p, const UA_DataType *type)
 
UA_StatusCode UA_DataValue_copyVariantRange (const UA_DataValue *src, UA_DataValue *dst, const UA_NumericRange range)
 
UA_Boolean UA_DataType_isNumeric (const UA_DataType *type)
 
UA_Int16 UA_DataType_getPrecedence (const UA_DataType *type)
 
const UA_DataTypeUA_findDataType (const UA_NodeId *typeId)
 
void * UA_new (const UA_DataType *type)
 
UA_StatusCode UA_copy (const void *src, void *dst, const UA_DataType *type)
 
void UA_clear (void *p, const UA_DataType *type)
 
void UA_delete (void *p, const UA_DataType *type)
 
UA_Order UA_order (const void *p1, const void *p2, const UA_DataType *type)
 
UA_EXPORT size_t UA_calcSizeBinary (const void *p, const UA_DataType *type)
 
UA_EXPORT UA_StatusCode UA_encodeBinary (const void *p, const UA_DataType *type, UA_ByteString *outBuf)
 
UA_EXPORT UA_StatusCode UA_decodeBinary (const UA_ByteString *inBuf, void *p, const UA_DataType *type, const UA_DecodeBinaryOptions *options)
 
void * UA_Array_new (size_t size, const UA_DataType *type)
 
UA_StatusCode UA_Array_copy (const void *src, size_t size, void **dst, const UA_DataType *type)
 
UA_StatusCode UA_Array_resize (void **p, size_t *size, size_t newSize, const UA_DataType *type)
 
UA_StatusCode UA_Array_append (void **p, size_t *size, void *newElem, const UA_DataType *type)
 
UA_StatusCode UA_Array_appendCopy (void **p, size_t *size, const void *newElem, const UA_DataType *type)
 
void UA_Array_delete (void *p, size_t size, const UA_DataType *type)
 
void UA_random_seed (UA_UInt64 seed)
 
UA_UInt32 UA_UInt32_random (void)
 
UA_Guid UA_Guid_random (void)
 

Variables

_UA_BEGIN_DECLS typedef bool UA_Boolean
 
UA_EXPORT const UA_String UA_STRING_NULL
 
UA_EXPORT const UA_Guid UA_GUID_NULL
 
UA_EXPORT const UA_ByteString UA_BYTESTRING_NULL
 
UA_EXPORT const UA_NodeId UA_NODEID_NULL
 
UA_EXPORT const UA_ExpandedNodeId UA_EXPANDEDNODEID_NULL
 

Macro Definition Documentation

◆ UA_TRUE

#define UA_TRUE   true UA_INTERNAL_DEPRECATED

Definition at line 27 of file types.h.

◆ UA_FALSE

#define UA_FALSE   false UA_INTERNAL_DEPRECATED

Definition at line 28 of file types.h.

◆ UA_SBYTE_MIN

#define UA_SBYTE_MIN   (-128)

Definition at line 32 of file types.h.

◆ UA_SBYTE_MAX

#define UA_SBYTE_MAX   127

Definition at line 33 of file types.h.

◆ UA_BYTE_MIN

#define UA_BYTE_MIN   0

Definition at line 37 of file types.h.

◆ UA_BYTE_MAX

#define UA_BYTE_MAX   255

Definition at line 38 of file types.h.

◆ UA_INT16_MIN

#define UA_INT16_MIN   (-32768)

Definition at line 42 of file types.h.

◆ UA_INT16_MAX

#define UA_INT16_MAX   32767

Definition at line 43 of file types.h.

◆ UA_UINT16_MIN

#define UA_UINT16_MIN   0

Definition at line 47 of file types.h.

◆ UA_UINT16_MAX

#define UA_UINT16_MAX   65535

Definition at line 48 of file types.h.

◆ UA_INT32_MIN

#define UA_INT32_MIN   (-2147483648)

Definition at line 52 of file types.h.

◆ UA_INT32_MAX

#define UA_INT32_MAX   2147483647

Definition at line 53 of file types.h.

◆ UA_UINT32_MIN

#define UA_UINT32_MIN   0

Definition at line 57 of file types.h.

◆ UA_UINT32_MAX

#define UA_UINT32_MAX   4294967295

Definition at line 58 of file types.h.

◆ UA_INT64_MAX

#define UA_INT64_MAX   (int64_t)9223372036854775807LL

Definition at line 62 of file types.h.

◆ UA_INT64_MIN

#define UA_INT64_MIN   ((int64_t)-UA_INT64_MAX-1LL)

Definition at line 63 of file types.h.

◆ UA_UINT64_MIN

#define UA_UINT64_MIN   (uint64_t)0

Definition at line 67 of file types.h.

◆ UA_UINT64_MAX

#define UA_UINT64_MAX   (uint64_t)18446744073709551615ULL

Definition at line 68 of file types.h.

◆ UA_STRING_ALLOC

#define UA_STRING_ALLOC ( CHARS)    UA_String_fromChars(CHARS)

Definition at line 137 of file types.h.

◆ UA_STRING_STATIC

#define UA_STRING_STATIC ( CHARS)    {sizeof(CHARS)-1, (UA_Byte*)CHARS}

Define strings at compile time (in ROM)

Definition at line 140 of file types.h.

◆ UA_DATETIME_USEC

#define UA_DATETIME_USEC   10LL

Multiples to convert durations to DateTime.

Definition at line 147 of file types.h.

◆ UA_DATETIME_MSEC

#define UA_DATETIME_MSEC   (UA_DATETIME_USEC * 1000LL)

Definition at line 148 of file types.h.

◆ UA_DATETIME_SEC

#define UA_DATETIME_SEC   (UA_DATETIME_MSEC * 1000LL)

Definition at line 149 of file types.h.

◆ UA_DATETIME_UNIX_EPOCH

#define UA_DATETIME_UNIX_EPOCH   (11644473600LL * UA_DATETIME_SEC)

The C99 standard (7.23.1) says: "The range and precision of times representable in clock_t and time_t are implementation-defined.

" On most systems, time_t is a 4 or 8 byte integer counting seconds since the UTC Unix epoch. The following methods are used for conversion. Datetime of 1 Jan 1970 00:00

Definition at line 183 of file types.h.

◆ UA_EMPTY_ARRAY_SENTINEL

#define UA_EMPTY_ARRAY_SENTINEL   ((void*)0x01)

Definition at line 553 of file types.h.

◆ UA_DATATYPEKINDS

#define UA_DATATYPEKINDS   31

The DataType "kind" is an internal type classification.

It is used to dispatch handling to the correct routines.

Definition at line 805 of file types.h.

◆ UA_deleteMembers

#define UA_deleteMembers ( p,
type )   UA_clear(p, type)

Definition at line 935 of file types.h.

◆ UA_TYPENAME

#define UA_TYPENAME ( name)

The following is used to exclude type names in the definition of UA_DataType structures if the feature is disabled.

Definition at line 1149 of file types.h.

Typedef Documentation

◆ UA_SByte

typedef int8_t UA_SByte

Definition at line 31 of file types.h.

◆ UA_Byte

typedef uint8_t UA_Byte

Definition at line 36 of file types.h.

◆ UA_Int16

typedef int16_t UA_Int16

Definition at line 41 of file types.h.

◆ UA_UInt16

typedef uint16_t UA_UInt16

Definition at line 46 of file types.h.

◆ UA_Int32

typedef int32_t UA_Int32

Definition at line 51 of file types.h.

◆ UA_UInt32

typedef uint32_t UA_UInt32

Definition at line 56 of file types.h.

◆ UA_Int64

typedef int64_t UA_Int64

Definition at line 61 of file types.h.

◆ UA_UInt64

typedef uint64_t UA_UInt64

Definition at line 66 of file types.h.

◆ UA_Float

typedef float UA_Float

Definition at line 71 of file types.h.

◆ UA_Double

typedef double UA_Double

Definition at line 74 of file types.h.

◆ UA_StatusCode

typedef uint32_t UA_StatusCode

Definition at line 77 of file types.h.

◆ UA_DateTime

typedef int64_t UA_DateTime

Definition at line 144 of file types.h.

◆ UA_DateTimeStruct

typedef struct UA_DateTimeStruct UA_DateTimeStruct

Represents a Datetime as a structure.

◆ UA_ByteString

Definition at line 224 of file types.h.

◆ UA_XmlElement

Definition at line 271 of file types.h.

◆ UA_DataType

typedef struct UA_DataType UA_DataType

Definition at line 551 of file types.h.

◆ UA_DiagnosticInfo

typedef struct UA_DiagnosticInfo UA_DiagnosticInfo

◆ UA_DataTypeArray

typedef struct UA_DataTypeArray UA_DataTypeArray

Datatype arrays with custom type definitions can be added in a linked list to the client or server configuration.

Enumeration Type Documentation

◆ UA_NodeIdType

Enumerator
UA_NODEIDTYPE_NUMERIC 
UA_NODEIDTYPE_STRING 
UA_NODEIDTYPE_GUID 
UA_NODEIDTYPE_BYTESTRING 

Definition at line 274 of file types.h.

◆ UA_VariantStorageType

Enumerator
UA_VARIANT_DATA 
UA_VARIANT_DATA_NODELETE 

Definition at line 555 of file types.h.

◆ UA_ExtensionObjectEncoding

Enumerator
UA_EXTENSIONOBJECT_ENCODED_NOBODY 
UA_EXTENSIONOBJECT_ENCODED_BYTESTRING 
UA_EXTENSIONOBJECT_ENCODED_XML 
UA_EXTENSIONOBJECT_DECODED 
UA_EXTENSIONOBJECT_DECODED_NODELETE 

Definition at line 691 of file types.h.

◆ UA_DataTypeKind

Enumerator
UA_DATATYPEKIND_BOOLEAN 
UA_DATATYPEKIND_SBYTE 
UA_DATATYPEKIND_BYTE 
UA_DATATYPEKIND_INT16 
UA_DATATYPEKIND_UINT16 
UA_DATATYPEKIND_INT32 
UA_DATATYPEKIND_UINT32 
UA_DATATYPEKIND_INT64 
UA_DATATYPEKIND_UINT64 
UA_DATATYPEKIND_FLOAT 
UA_DATATYPEKIND_DOUBLE 
UA_DATATYPEKIND_STRING 
UA_DATATYPEKIND_DATETIME 
UA_DATATYPEKIND_GUID 
UA_DATATYPEKIND_BYTESTRING 
UA_DATATYPEKIND_XMLELEMENT 
UA_DATATYPEKIND_NODEID 
UA_DATATYPEKIND_EXPANDEDNODEID 
UA_DATATYPEKIND_STATUSCODE 
UA_DATATYPEKIND_QUALIFIEDNAME 
UA_DATATYPEKIND_LOCALIZEDTEXT 
UA_DATATYPEKIND_EXTENSIONOBJECT 
UA_DATATYPEKIND_DATAVALUE 
UA_DATATYPEKIND_VARIANT 
UA_DATATYPEKIND_DIAGNOSTICINFO 
UA_DATATYPEKIND_DECIMAL 
UA_DATATYPEKIND_ENUM 
UA_DATATYPEKIND_STRUCTURE 
UA_DATATYPEKIND_OPTSTRUCT 
UA_DATATYPEKIND_UNION 
UA_DATATYPEKIND_BITFIELDCLUSTER 

Definition at line 806 of file types.h.

Function Documentation

◆ UA_StatusCode_name()

UA_EXPORT const char * UA_StatusCode_name ( UA_StatusCode code)

Returns the human-readable name of the StatusCode.

If no matching StatusCode is found, a default string for "Unknown" is returned. This feature might be disabled to create a smaller binary with the UA_ENABLE_STATUSCODE_DESCRIPTIONS build-flag. Then the function returns an empty string for every StatusCode.

◆ UA_String_fromChars()

UA_String UA_String_fromChars ( const char * src)

Copies the content on the heap.

Returns a null-string when alloc fails

◆ UA_String_equal()

UA_Boolean UA_String_equal ( const UA_String * s1,
const UA_String * s2 )

◆ UA_DateTime_now()

UA_DateTime UA_DateTime_now ( void )

The current time in UTC time.

◆ UA_DateTime_localTimeUtcOffset()

UA_Int64 UA_DateTime_localTimeUtcOffset ( void )

Offset between local time and UTC time.

◆ UA_DateTime_nowMonotonic()

UA_DateTime UA_DateTime_nowMonotonic ( void )

CPU clock invariant to system time changes.

Use only to measure durations, not absolute time.

◆ UA_DateTime_toStruct()

UA_DateTimeStruct UA_DateTime_toStruct ( UA_DateTime t)

◆ UA_DateTime_fromStruct()

UA_DateTime UA_DateTime_fromStruct ( UA_DateTimeStruct ts)

◆ UA_Guid_equal()

UA_Boolean UA_Guid_equal ( const UA_Guid * g1,
const UA_Guid * g2 )

◆ UA_ByteString_allocBuffer()

UA_StatusCode UA_ByteString_allocBuffer ( UA_ByteString * bs,
size_t length )

Allocates memory of size length for the bytestring.

The content is not set to zero.

◆ UA_ByteString_toBase64()

UA_StatusCode UA_ByteString_toBase64 ( const UA_ByteString * bs,
UA_String * output )

Converts a ByteString to the corresponding base64 representation.

◆ UA_ByteString_fromBase64()

UA_StatusCode UA_ByteString_fromBase64 ( UA_ByteString * bs,
const UA_String * input )

Parse a ByteString from a base64 representation.

◆ UA_ByteString_hash()

UA_UInt32 UA_ByteString_hash ( UA_UInt32 initialHashValue,
const UA_Byte * data,
size_t size )

Returns a non-cryptographic hash of a bytestring.

◆ UA_NodeId_isNull()

UA_Boolean UA_NodeId_isNull ( const UA_NodeId * p)

◆ UA_NodeId_print()

UA_StatusCode UA_NodeId_print ( const UA_NodeId * id,
UA_String * output )

Print the NodeId in the human-readable format defined in Part 6, 5.3.1.10.

Examples: UA_NODEID("i=13") UA_NODEID("ns=10;i=1") UA_NODEID("ns=10;s=Hello:World") UA_NODEID("g=09087e75-8e5e-499b-954f-f2a9603db28a") UA_NODEID("ns=1;b=b3BlbjYyNTQxIQ==") // base64

◆ UA_NodeId_order()

UA_Order UA_NodeId_order ( const UA_NodeId * n1,
const UA_NodeId * n2 )

Total ordering of NodeId.

◆ UA_NodeId_hash()

UA_UInt32 UA_NodeId_hash ( const UA_NodeId * n)

Returns a non-cryptographic hash for NodeId.

◆ UA_ExpandedNodeId_print()

UA_StatusCode UA_ExpandedNodeId_print ( const UA_ExpandedNodeId * id,
UA_String * output )

◆ UA_ExpandedNodeId_isLocal()

UA_Boolean UA_ExpandedNodeId_isLocal ( const UA_ExpandedNodeId * n)

Does the ExpandedNodeId point to a local node? That is, are namespaceUri and serverIndex empty?

◆ UA_ExpandedNodeId_order()

UA_Order UA_ExpandedNodeId_order ( const UA_ExpandedNodeId * n1,
const UA_ExpandedNodeId * n2 )

Total ordering of ExpandedNodeId.

◆ UA_ExpandedNodeId_hash()

UA_UInt32 UA_ExpandedNodeId_hash ( const UA_ExpandedNodeId * n)

Returns a non-cryptographic hash for ExpandedNodeId.

The hash of an ExpandedNodeId is identical to the hash of the embedded (simple) NodeId if the ServerIndex is zero and no NamespaceUri is set.

◆ UA_QualifiedName_hash()

UA_UInt32 UA_QualifiedName_hash ( const UA_QualifiedName * q)

Returns a non-cryptographic hash for QualifiedName.

◆ UA_QualifiedName_equal()

UA_Boolean UA_QualifiedName_equal ( const UA_QualifiedName * qn1,
const UA_QualifiedName * qn2 )

◆ UA_NumericRange_parse()

UA_StatusCode UA_NumericRange_parse ( UA_NumericRange * range,
const UA_String str )

◆ UA_Variant_setScalar()

void UA_Variant_setScalar ( UA_Variant * v,
void * p,
const UA_DataType * type )

Set the variant to a scalar value that already resides in memory.

The value takes on the lifecycle of the variant and is deleted with it.

Parameters
vThe variant
pA pointer to the value data
typeThe datatype of the value in question

◆ UA_Variant_setScalarCopy()

UA_StatusCode UA_Variant_setScalarCopy ( UA_Variant * v,
const void * p,
const UA_DataType * type )

Set the variant to a scalar value that is copied from an existing variable.

Parameters
vThe variant
pA pointer to the value data
typeThe datatype of the value
Returns
Indicates whether the operation succeeded or returns an error code

◆ UA_Variant_setArray()

void UA_Variant_setArray ( UA_Variant * v,
void * array,
size_t arraySize,
const UA_DataType * type )

Set the variant to an array that already resides in memory.

The array takes on the lifecycle of the variant and is deleted with it.

Parameters
vThe variant
arrayA pointer to the array data
arraySizeThe size of the array
typeThe datatype of the array

◆ UA_Variant_setArrayCopy()

UA_StatusCode UA_Variant_setArrayCopy ( UA_Variant * v,
const void * array,
size_t arraySize,
const UA_DataType * type )

Set the variant to an array that is copied from an existing array.

Parameters
vThe variant
arrayA pointer to the array data
arraySizeThe size of the array
typeThe datatype of the array
Returns
Indicates whether the operation succeeded or returns an error code

◆ UA_Variant_copyRange()

UA_StatusCode UA_Variant_copyRange ( const UA_Variant * src,
UA_Variant * dst,
const UA_NumericRange range )

Copy the variant, but use only a subset of the (multidimensional) array into a variant.

Returns an error code if the variant is not an array or if the indicated range does not fit.

Parameters
srcThe source variant
dstThe target variant
rangeThe range of the copied data
Returns
Returns UA_STATUSCODE_GOOD or an error code

◆ UA_Variant_setRange()

UA_StatusCode UA_Variant_setRange ( UA_Variant * v,
void * array,
size_t arraySize,
const UA_NumericRange range )

Insert a range of data into an existing variant.

The data array cannot be reused afterwards if it contains types without a fixed size (e.g. strings) since the members are moved into the variant and take on its lifecycle.

Parameters
vThe variant
dataArrayThe data array. The type must match the variant
dataArraySizeThe length of the data array. This is checked to match the range size.
rangeThe range of where the new data is inserted
Returns
Returns UA_STATUSCODE_GOOD or an error code

◆ UA_Variant_setRangeCopy()

UA_StatusCode UA_Variant_setRangeCopy ( UA_Variant * v,
const void * array,
size_t arraySize,
const UA_NumericRange range )

Deep-copy a range of data into an existing variant.

Parameters
vThe variant
dataArrayThe data array. The type must match the variant
dataArraySizeThe length of the data array. This is checked to match the range size.
rangeThe range of where the new data is inserted
Returns
Returns UA_STATUSCODE_GOOD or an error code

◆ UA_ExtensionObject_setValue()

void UA_ExtensionObject_setValue ( UA_ExtensionObject * eo,
void * p,
const UA_DataType * type )

Initialize the ExtensionObject and set the "decoded" value to the given pointer.

The value will be deleted when the ExtensionObject is cleared.

◆ UA_ExtensionObject_setValueNoDelete()

void UA_ExtensionObject_setValueNoDelete ( UA_ExtensionObject * eo,
void * p,
const UA_DataType * type )

Initialize the ExtensionObject and set the "decoded" value to the given pointer.

The value will not be deleted when the ExtensionObject is cleared.

◆ UA_ExtensionObject_setValueCopy()

UA_StatusCode UA_ExtensionObject_setValueCopy ( UA_ExtensionObject * eo,
void * p,
const UA_DataType * type )

Initialize the ExtensionObject and set the "decoded" value to a fresh copy of the given value pointer.

The value will be deleted when the ExtensionObject is cleared.

◆ UA_DataValue_copyVariantRange()

UA_StatusCode UA_DataValue_copyVariantRange ( const UA_DataValue * src,
UA_DataValue * dst,
const UA_NumericRange range )

Copy the DataValue, but use only a subset of the (multidimensional) array of of the variant of the source DataValue.

Returns an error code if the variant of the DataValue is not an array or if the indicated range does not fit.

Parameters
srcThe source DataValue
dstThe target DataValue
rangeThe range of the variant of the DataValue to copy
Returns
Returns UA_STATUSCODE_GOOD or an error code

◆ UA_DataType_isNumeric()

UA_Boolean UA_DataType_isNumeric ( const UA_DataType * type)

Returns the offset and type of a structure member.

The return value is false if the member was not found.

If the member is an array, the offset points to the (size_t) length field. (The array pointer comes after the length field without any padding.) Test if the data type is a numeric builtin data type (via the typeKind field of UA_DataType). This includes integers and floating point numbers. Not included are Boolean, DateTime, StatusCode and Enums.

◆ UA_DataType_getPrecedence()

UA_Int16 UA_DataType_getPrecedence ( const UA_DataType * type)

Return the Data Type Precedence-Rank defined in Part 4.

If there is no Precedence-Rank assigned with the type -1 is returned.

◆ UA_findDataType()

const UA_DataType * UA_findDataType ( const UA_NodeId * typeId)

Returns the data type description for the type's identifier or NULL if no matching data type was found.

◆ UA_new()

void * UA_new ( const UA_DataType * type)

Allocates and initializes a variable of type dataType.

Parameters
typeThe datatype description
Returns
Returns the memory location of the variable or NULL if no memory could be allocated

◆ UA_copy()

UA_StatusCode UA_copy ( const void * src,
void * dst,
const UA_DataType * type )

Copies the content of two variables.

If copying fails (e.g. because no memory was available for an array), then dst is emptied and initialized to prevent memory leaks.

Parameters
srcThe memory location of the source variable
dstThe memory location of the destination variable
typeThe datatype description
Returns
Indicates whether the operation succeeded or returns an error code

◆ UA_clear()

void UA_clear ( void * p,
const UA_DataType * type )

Deletes the dynamically allocated content of a variable (e.g.

resets all arrays to undefined arrays). Afterwards, the variable can be safely deleted without causing memory leaks. But the variable is not initialized and may contain old data that is not memory-relevant.

Parameters
pThe memory location of the variable
typeThe datatype description of the variable

◆ UA_delete()

void UA_delete ( void * p,
const UA_DataType * type )

Frees a variable and all of its content.

Parameters
pThe memory location of the variable
typeThe datatype description of the variable

◆ UA_order()

UA_Order UA_order ( const void * p1,
const void * p2,
const UA_DataType * type )

Pretty-print the value from the datatype.

Parameters
pThe memory location of the variable
typeThe datatype description of the variable
outputA string that is memory-allocated for the pretty-printed output
Returns
Indicates whether the operation succeeded Compare two variables and return their order. This can also be used to test for equality of two values.

For numerical types (including StatusCodes and Enums), their natural order is used. NaN is the "smallest" value for floating point values. Different bit representations of NaN are considered identical.

All other types have some absolute ordering so that a < b, b < c -> a < c.

The ordering of arrays (also strings) is in "shortlex": A shorter array is always smaller than a longer array. Otherwise the first different element defines the order.

When members of different types are permitted (in Variants and ExtensionObjects), the memory address in the "UA_DataType*" pointer determines which variable is smaller.

Parameters
p1The memory location of the first value
p2The memory location of the first value
typeThe datatype description of both values

◆ UA_calcSizeBinary()

UA_EXPORT size_t UA_calcSizeBinary ( const void * p,
const UA_DataType * type )

Returns the number of bytes the value p takes in binary encoding.

Returns zero if an error occurs.

◆ UA_encodeBinary()

UA_EXPORT UA_StatusCode UA_encodeBinary ( const void * p,
const UA_DataType * type,
UA_ByteString * outBuf )

Encodes a data-structure in the binary format.

If outBuf has a length of zero, a buffer of the required size is allocated. Otherwise, encoding into the existing outBuf is attempted (and may fail if the buffer is too small).

◆ UA_decodeBinary()

UA_EXPORT UA_StatusCode UA_decodeBinary ( const UA_ByteString * inBuf,
void * p,
const UA_DataType * type,
const UA_DecodeBinaryOptions * options )

Decodes a data structure from the input buffer in the binary format.

It is assumed that p points to valid memory (not necessarily zeroed out). The options can be NULL and will be disregarded in that case.

◆ UA_Array_new()

void * UA_Array_new ( size_t size,
const UA_DataType * type )

Allocates and initializes an array of variables of a specific type.

Parameters
sizeThe requested array length
typeThe datatype description
Returns
Returns the memory location of the variable or NULL if no memory could be allocated

◆ UA_Array_copy()

UA_StatusCode UA_Array_copy ( const void * src,
size_t size,
void ** dst,
const UA_DataType * type )

Allocates and copies an array.

Parameters
srcThe memory location of the source array
sizeThe size of the array
dstThe location of the pointer to the new array
typeThe datatype of the array members
Returns
Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY

◆ UA_Array_resize()

UA_StatusCode UA_Array_resize ( void ** p,
size_t * size,
size_t newSize,
const UA_DataType * type )

Resizes (and reallocates) an array.

The last entries are initialized to zero if the array length is increased. If the array length is decreased, the last entries are removed if the size is decreased.

Parameters
pDouble pointer to the array memory. Can be overwritten by the result of a realloc.
sizeThe current size of the array. Overwritten in case of success.
newSizeThe new size of the array
typeThe datatype of the array members
Returns
Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY. The original array is left untouched in the failure case.

◆ UA_Array_append()

UA_StatusCode UA_Array_append ( void ** p,
size_t * size,
void * newElem,
const UA_DataType * type )

Append the given element at the end of the array.

The content is moved (shallow copy) and the original memory is _init'ed if appending is successful.

Parameters
pDouble pointer to the array memory. Can be overwritten by the result of a realloc.
sizeThe current size of the array. Overwritten in case of success.
newElemThe element to be appended. The memory is reset upon success.
typeThe datatype of the array members
Returns
Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY. The original array is left untouched in the failure case.

◆ UA_Array_appendCopy()

UA_StatusCode UA_Array_appendCopy ( void ** p,
size_t * size,
const void * newElem,
const UA_DataType * type )

Append a copy of the given element at the end of the array.

Parameters
pDouble pointer to the array memory. Can be overwritten by the result of a realloc.
sizeThe current size of the array. Overwritten in case of success.
newElemThe element to be appended.
typeThe datatype of the array members
Returns
Returns UA_STATUSCODE_GOOD or UA_STATUSCODE_BADOUTOFMEMORY. The original array is left untouched in the failure case.

◆ UA_Array_delete()

void UA_Array_delete ( void * p,
size_t size,
const UA_DataType * type )

Deletes an array.

Parameters
pThe memory location of the array
sizeThe size of the array
typeThe datatype of the array members

◆ UA_random_seed()

void UA_random_seed ( UA_UInt64 seed)

◆ UA_UInt32_random()

UA_UInt32 UA_UInt32_random ( void )

◆ UA_Guid_random()

UA_Guid UA_Guid_random ( void )

Variable Documentation

◆ UA_Boolean

_UA_BEGIN_DECLS typedef bool UA_Boolean

This Source Code Form is subject to the terms of the Mozilla Public License, v.

2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Copyright 2014 (c) Leon Urbas Copyright 2014, 2016-2017 (c) Florian Palm Copyright 2014-2017 (c) Fraunhofer IOSB (Author: Julius Pfrommer) Copyright 2015-2016 (c) Sten GrĂ¼ner Copyright 2015-2016 (c) Chris Iatrou Copyright 2015 (c) Nick Goossens Copyright 2015-2016 (c) Oleksiy Vasylyev Copyright 2017 (c) Stefan Profanter, fortiss GmbH Copyright 2017 (c) Thomas Stalder, Blue Time Concept SA

Definition at line 26 of file types.h.

◆ UA_STRING_NULL

UA_EXPORT const UA_String UA_STRING_NULL
extern

◆ UA_GUID_NULL

UA_EXPORT const UA_Guid UA_GUID_NULL
extern

◆ UA_BYTESTRING_NULL

UA_EXPORT const UA_ByteString UA_BYTESTRING_NULL
extern

◆ UA_NODEID_NULL

UA_EXPORT const UA_NodeId UA_NODEID_NULL
extern

◆ UA_EXPANDEDNODEID_NULL

UA_EXPORT const UA_ExpandedNodeId UA_EXPANDEDNODEID_NULL
extern