open62541pp 0.16.0
C++ wrapper of open62541
Loading...
Searching...
No Matches
opcua::ValueBackendDataSource Struct Reference

#include <nodestore.hpp>

Detailed Description

Data source backend for variable nodes.

The server redirects every read and write request to callback functions. Internally, the data source needs to implement its own memory management.

See also
https://www.open62541.org/doc/1.3/tutorial_server_datasource.html
Examples
server_datasource.cpp.

Definition at line 45 of file nodestore.hpp.

Public Attributes

std::function< StatusCode(DataValue &value, const NumericRange &range, bool timestamp)> read
 
std::function< StatusCode(const DataValue &value, const NumericRange &range)> write
 

Member Data Documentation

◆ read

std::function<StatusCode(DataValue& value, const NumericRange& range, bool timestamp)> opcua::ValueBackendDataSource::read

Callback to set the read value, the result status and optionally a source timestamp.

Note
Zero-copy operations are possible. It is not required to return a copy of the actual content data. You can return a pointer to memory owned by the user. Memory can be reused between read callbacks of a data source, as the result is already encoded on the network buffer between each read operation. To use zero-copy reads, set the value of the Variant (DataValue::getValue) without copying, e.g. with Variant::setScalar or Variant::setArray.
Parameters
valueThe DataValue that is returned to the reader
rangeIf not empty, then the data source shall return only a selection of the (nonscalar) data. Set UA_STATUSCODE_BADINDEXRANGEINVALID in value if this does not apply
timestampSet the source timestamp of value if true
Returns
StatusCode
Examples
server_datasource.cpp.

Definition at line 63 of file nodestore.hpp.

◆ write

std::function<StatusCode(const DataValue& value, const NumericRange& range)> opcua::ValueBackendDataSource::write

Callback to write the value into a data source.

This function can be empty if the operation is unsupported.

Parameters
valueThe DataValue that has been written by the writer
rangeIf not empty, then only this selection of (non-scalar) data should be written into the data source
Returns
StatusCode
Examples
server_datasource.cpp.

Definition at line 74 of file nodestore.hpp.