IoT::OPC

class Variant

File Information

Library: IoT/OPC
Package: OPCCore
Header: IoT/OPC/Variant.h

Description

This class wraps an OPC-UA Variant.

Member Summary

Member Functions: arrayDimensions, empty, getArray, getScalar, hasArray, hasScalar, internal, isArray, isNumeric, isScalar, operator =, setArray, setScalar, typeId, typeName

Constructors

Variant inline

Variant();

Creates an empty Variant.

Variant

explicit Variant(
    const UA_Variant & variant
);

Creates a Variant from an UA_Variant struct.

Note that the Variant takes ownership of the VA_Variant struct's contents.

Variant

template < typename T > explicit Variant(
    const T & value
);

Creates a Variant with a scalar value of the given type.

Variant

template < typename T > explicit Variant(
    const std::vector < T > & array
);

Creates a Variant with an array of the given type.

Variant

Variant(
    Variant && other
);

Creates a Variant by moving the contents of another one.

Variant

Variant(
    const Variant & param796
) = delete;

Destructor

~Variant

~Variant();

Destroys the Variant.

Member Functions

arrayDimensions inline

std::vector < Poco::UInt32 > arrayDimensions() const;

Returns the Variant's array dimensions, if available.

empty inline

bool empty() const;

Returns true if the Variant is empty, otherwise false.

getArray inline

template < typename T > std::vector < T > getArray() const;

Attempts to extract an array of the given type from the Variant.

Throws a TypeMismatchException if the Variant holds a value of the wrong type.

getScalar inline

template < typename T > T getScalar() const;

Attempts to extract a scalar value of the given type from the Variant.

Throws a TypeMismatchException if the Variant holds a value of the wrong type.

hasArray inline

template < typename T > bool hasArray() const;

Returns true if the Variant holds an array with elements of the given scalar type, otherwise false.

hasScalar inline

template < typename T > bool hasScalar() const;

Returns true if the Variant holds a scalar value with the given type, otherwise false.

internal inline

const UA_Variant * internal() const;

Returns a pointer to the internal UA_Variant struct.

internal

UA_Variant * internal();

Returns a pointer to the internal UA_Variant struct.

isArray inline

bool isArray() const;

Returns true if the Variant holds an array, otherwise false.

isNumeric

bool isNumeric() const;

Returns true if the Variant holds a numeric scalar value, otherwise false.

isScalar inline

bool isScalar() const;

Returns true if the Variant holds a scalar value, otherwise false.

operator =

Variant & operator = (
    Variant && other
);

Move assignment;

operator =

Variant & operator = (
    const Variant & param797
) = delete;

setArray inline

template < typename T > void setArray(
    const std::vector < T > & value
);

Sets the Variant to an array.

setScalar inline

template < typename T > void setScalar(
    const T & value
);

Sets the Variant to a scalar value.

typeId

NodeId typeId() const;

Returns the Node ID of the Variant's type.

Throws a NoValueException if the Variant is empty.

typeName

std::string typeName() const;

Returns the type name of the Variant's content.

Securely control IoT edge devices from anywhere   Connect a Device