open62541++ 0.13.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
opcua::DataValue Class Reference

#include <DataValue.h>

Inheritance diagram for opcua::DataValue:
[legend]

Detailed Description

UA_DataValue wrapper class.

See also
https://reference.opcfoundation.org/Core/Part4/v105/docs/7.11
Examples
client_subscription.cpp, server_datasource.cpp, and server_valuecallback.cpp.

Definition at line 20 of file DataValue.h.

Public Member Functions

 DataValue (Variant value) noexcept
 
 DataValue (Variant value, std::optional< DateTime > sourceTimestamp, std::optional< DateTime > serverTimestamp, std::optional< uint16_t > sourcePicoseconds, std::optional< uint16_t > serverPicoseconds, std::optional< StatusCode > status) noexcept
 
bool hasValue () const noexcept
 
bool hasSourceTimestamp () const noexcept
 
bool hasServerTimestamp () const noexcept
 
bool hasSourcePicoseconds () const noexcept
 
bool hasServerPicoseconds () const noexcept
 
bool hasStatus () const noexcept
 
bool hasStatusCode () const noexcept
 
VariantgetValue () &noexcept
 
const VariantgetValue () const &noexcept
 
Variant && getValue () &&noexcept
 
const Variant && getValue () const &&noexcept
 
DateTime getSourceTimestamp () const noexcept
 
DateTime getServerTimestamp () const noexcept
 
uint16_t getSourcePicoseconds () const noexcept
 
uint16_t getServerPicoseconds () const noexcept
 
StatusCode getStatus () const noexcept
 
StatusCode getStatusCode () const noexcept
 
void setValue (const Variant &value)
 
void setValue (Variant &&value) noexcept
 
void setSourceTimestamp (DateTime sourceTimestamp) noexcept
 
void setServerTimestamp (DateTime serverTimestamp) noexcept
 
void setSourcePicoseconds (uint16_t sourcePicoseconds) noexcept
 
void setServerPicoseconds (uint16_t serverPicoseconds) noexcept
 
void setStatus (StatusCode status) noexcept
 
void setStatusCode (StatusCode statusCode) noexcept
 
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_DataValue, UA_TYPES_DATAVALUE >
constexpr TypeWrapper ()=default
 
constexpr TypeWrapper (const UA_DataValue &native)
 
constexpr TypeWrapper (UA_DataValue &&native) noexcept
 
constexpr TypeWrapper (const TypeWrapper &other)
 
constexpr TypeWrapper (TypeWrapper &&other) noexcept
 
 ~TypeWrapper ()
 
constexpr TypeWrapperoperator= (const TypeWrapper &other)
 
constexpr TypeWrapperoperator= (const UA_DataValue &native)
 
constexpr TypeWrapperoperator= (TypeWrapper &&other) noexcept
 
constexpr TypeWrapperoperator= (UA_DataValue &&native) noexcept
 
constexpr void swap (TypeWrapper &other) noexcept
 
constexpr void swap (UA_DataValue &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... Args>
static DataValue fromScalar (Args &&... args)
 
template<VariantPolicy Policy = VariantPolicy::Copy, typename... Args>
static DataValue fromArray (Args &&... args)
 
- Static Public Member Functions inherited from opcua::TypeWrapper< UA_DataValue, UA_TYPES_DATAVALUE >
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_DataValue, UA_TYPES_DATAVALUE >
constexpr void clear () noexcept
 
- Protected Member Functions inherited from opcua::Wrapper< T >
constexpr const T & native () const noexcept
 
constexpr T & native () noexcept
 

Constructor & Destructor Documentation

◆ DataValue() [1/2]

opcua::DataValue::DataValue ( Variant value)
inlineexplicitnoexcept

Definition at line 24 of file DataValue.h.

◆ DataValue() [2/2]

opcua::DataValue::DataValue ( Variant value,
std::optional< DateTime > sourceTimestamp,
std::optional< DateTime > serverTimestamp,
std::optional< uint16_t > sourcePicoseconds,
std::optional< uint16_t > serverPicoseconds,
std::optional< StatusCode > status )
inlinenoexcept

Definition at line 28 of file DataValue.h.

Member Function Documentation

◆ fromScalar()

template<VariantPolicy Policy = VariantPolicy::Copy, typename... Args>
static DataValue opcua::DataValue::fromScalar ( Args &&... args)
inlinestatic

Create DataValue from scalar value.

See also
Variant::fromScalar

Definition at line 56 of file DataValue.h.

Referenced by opcua::services::detail::AttributeHandlerScalar< T, Enable >::toDataValue().

◆ fromArray()

template<VariantPolicy Policy = VariantPolicy::Copy, typename... Args>
static DataValue opcua::DataValue::fromArray ( Args &&... args)
inlinestatic

◆ hasValue()

bool opcua::DataValue::hasValue ( ) const
inlinenoexcept

◆ hasSourceTimestamp()

bool opcua::DataValue::hasSourceTimestamp ( ) const
inlinenoexcept

Definition at line 71 of file DataValue.h.

◆ hasServerTimestamp()

bool opcua::DataValue::hasServerTimestamp ( ) const
inlinenoexcept

Definition at line 75 of file DataValue.h.

◆ hasSourcePicoseconds()

bool opcua::DataValue::hasSourcePicoseconds ( ) const
inlinenoexcept

Definition at line 79 of file DataValue.h.

◆ hasServerPicoseconds()

bool opcua::DataValue::hasServerPicoseconds ( ) const
inlinenoexcept

Definition at line 83 of file DataValue.h.

◆ hasStatus()

bool opcua::DataValue::hasStatus ( ) const
inlinenoexcept

Definition at line 87 of file DataValue.h.

Referenced by hasStatusCode().

◆ hasStatusCode()

bool opcua::DataValue::hasStatusCode ( ) const
inlinenoexcept
Deprecated
Use hasStatus() instead

Definition at line 93 of file DataValue.h.

◆ getValue() [1/4]

Variant & opcua::DataValue::getValue ( ) &
inlinenoexcept

Get value.

Examples
client_subscription.cpp, and server_datasource.cpp.

Definition at line 98 of file DataValue.h.

◆ getValue() [2/4]

const Variant & opcua::DataValue::getValue ( ) const &
inlinenoexcept

Get value.

Definition at line 103 of file DataValue.h.

◆ getValue() [3/4]

Variant && opcua::DataValue::getValue ( ) &&
inlinenoexcept

Get value (rvalue).

Definition at line 108 of file DataValue.h.

◆ getValue() [4/4]

const Variant && opcua::DataValue::getValue ( ) const &&
inlinenoexcept

Get value (rvalue).

Definition at line 113 of file DataValue.h.

◆ getSourceTimestamp()

DateTime opcua::DataValue::getSourceTimestamp ( ) const
inlinenoexcept

Get source timestamp for the value.

Definition at line 118 of file DataValue.h.

◆ getServerTimestamp()

DateTime opcua::DataValue::getServerTimestamp ( ) const
inlinenoexcept

Get server timestamp for the value.

Definition at line 123 of file DataValue.h.

◆ getSourcePicoseconds()

uint16_t opcua::DataValue::getSourcePicoseconds ( ) const
inlinenoexcept

Get picoseconds interval added to the source timestamp.

Definition at line 128 of file DataValue.h.

◆ getServerPicoseconds()

uint16_t opcua::DataValue::getServerPicoseconds ( ) const
inlinenoexcept

Get picoseconds interval added to the server timestamp.

Definition at line 133 of file DataValue.h.

◆ getStatus()

StatusCode opcua::DataValue::getStatus ( ) const
inlinenoexcept

Get status.

Definition at line 138 of file DataValue.h.

Referenced by getStatusCode().

◆ getStatusCode()

StatusCode opcua::DataValue::getStatusCode ( ) const
inlinenoexcept
Deprecated
Use getStatus() instead

Definition at line 144 of file DataValue.h.

◆ setValue() [1/2]

void opcua::DataValue::setValue ( const Variant & value)
inline

Set value (copy).

Definition at line 149 of file DataValue.h.

Referenced by DataValue().

◆ setValue() [2/2]

void opcua::DataValue::setValue ( Variant && value)
inlinenoexcept

Set value (move).

Definition at line 155 of file DataValue.h.

◆ setSourceTimestamp()

void opcua::DataValue::setSourceTimestamp ( DateTime sourceTimestamp)
inlinenoexcept

Set source timestamp for the value.

Examples
server_datasource.cpp.

Definition at line 161 of file DataValue.h.

◆ setServerTimestamp()

void opcua::DataValue::setServerTimestamp ( DateTime serverTimestamp)
inlinenoexcept

Set server timestamp for the value.

Definition at line 167 of file DataValue.h.

◆ setSourcePicoseconds()

void opcua::DataValue::setSourcePicoseconds ( uint16_t sourcePicoseconds)
inlinenoexcept

Set picoseconds interval added to the source timestamp.

Definition at line 173 of file DataValue.h.

◆ setServerPicoseconds()

void opcua::DataValue::setServerPicoseconds ( uint16_t serverPicoseconds)
inlinenoexcept

Set picoseconds interval added to the server timestamp.

Definition at line 179 of file DataValue.h.

◆ setStatus()

void opcua::DataValue::setStatus ( StatusCode status)
inlinenoexcept

Set status.

Definition at line 185 of file DataValue.h.

Referenced by opcua::services::detail::createDataValueFromStatus(), and setStatusCode().

◆ setStatusCode()

void opcua::DataValue::setStatusCode ( StatusCode statusCode)
inlinenoexcept
Deprecated
Use setStatus(StatusCode) instead

Definition at line 192 of file DataValue.h.

◆ TypeWrapper() [1/5]

constexpr opcua::TypeWrapper< T, typeIndex >::TypeWrapper ( )
constexprdefault

◆ TypeWrapper() [2/5]

constexpr opcua::TypeWrapper< T, typeIndex >::TypeWrapper ( const T & native)
inlineexplicitconstexpr

Constructor with native object (deep copy).

Definition at line 36 of file TypeWrapper.h.

◆ TypeWrapper() [3/5]

constexpr opcua::TypeWrapper< T, typeIndex >::TypeWrapper ( T && native)
inlineconstexprnoexcept

Constructor with native object (move rvalue).

Definition at line 40 of file TypeWrapper.h.

◆ TypeWrapper() [4/5]

constexpr opcua::TypeWrapper< T, typeIndex >::TypeWrapper ( const TypeWrapper & other)
inlineconstexpr

Copy constructor (deep copy).

Definition at line 48 of file TypeWrapper.h.

◆ TypeWrapper() [5/5]

constexpr opcua::TypeWrapper< T, typeIndex >::TypeWrapper ( TypeWrapper && other)
inlineconstexprnoexcept

Move constructor.

Definition at line 52 of file TypeWrapper.h.