File Information
Library: IoT/OPC
Package: OPCCore
Header: IoT/OPC/Variant.h
Description
Member Summary
Member Functions: arrayDimensions, empty, getArray, getScalar, hasArray, hasScalar, internal, isArray, isNumeric, isScalar, operator =, setArray, setScalar, typeId, typeName
Constructors
Variant
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
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
std::vector < Poco::UInt32 > arrayDimensions() const;
Returns the Variant's array dimensions, if available.
empty
bool empty() const;
Returns true if the Variant is empty, otherwise false.
getArray
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
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
template < typename T > bool hasArray() const;
Returns true if the Variant holds an array with elements of the given scalar type, otherwise false.
hasScalar
template < typename T > bool hasScalar() const;
Returns true if the Variant holds a scalar value with the given type, otherwise false.
internal
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
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
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
template < typename T > void setArray(
const std::vector < T > & value
);
Sets the Variant to an array.
setScalar
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.