High Performance OPC UA Server SDK
1.2.0.193
|
Implementation of a store using in-memory values. More...
#include <memorystore.h>
Public Member Functions | |
static void | ua_memorystore_get_value (void *memorystore, ua_node_t node, unsigned int idx, bool source_ts, struct ua_indexrange *range, unsigned int num_ranges, struct ua_datavalue *result) |
static ua_statuscode | ua_memorystore_attach_value (void *memorystore, ua_node_t node, unsigned int idx, struct ua_indexrange *range, unsigned int num_ranges, struct ua_datavalue *value) |
int | ua_memorystore_attach_new_value (struct ua_memorystore *store, struct ua_variant *value, ua_node_t node) |
Attach a new value to the memorystore. More... | |
int | ua_memorystore_init (struct ua_memorystore *store, uint8_t storeidx, struct ua_variant *values, unsigned int num_values) |
Initialize a memorystore with a preallocated ua_variant array. More... | |
struct ua_variant * | ua_memorystore_clear (struct ua_memorystore *store) |
Clear all values in a memorystore and the store itself. More... | |
uint8_t | ua_memorystore_get_storeindex (struct ua_memorystore *store) |
Get the storeindex of a memorystore. | |
Data Fields | |
struct ua_variant * | values |
Array with values. | |
unsigned int | num_values |
Number of currently used values. | |
unsigned int | max_values |
Number of elements in the array. | |
uint8_t | storeidx |
Index of the store. | |
Implementation of a store using in-memory values.
A new memorystore must be initialized with a user provided array of empty ua_variant structs using ua_memorystore_init. The number of elements in the array is the capacity of the store. Then values can be added with ua_memorystore_attach_new_value. This function also registers the store with the given storeindex.
For a full example how to use the memorystore see Lesson 2: Custom Provider with Value Stores.
int ua_memorystore_attach_new_value | ( | struct ua_memorystore * | store, |
struct ua_variant * | value, | ||
ua_node_t | node | ||
) |
Attach a new value to the memorystore.
A new value is added to the memorystore by creating a shallow copy. The store index and value index are written to the node
.
store | Context of the memorystore. |
value | New value to attach. |
node | Handle of node associated with the value. |
static ua_statuscode ua_memorystore_attach_value | ( | void * | memorystore, |
ua_node_t | node, | ||
unsigned int | idx, | ||
struct ua_indexrange * | range, | ||
unsigned int | num_ranges, | ||
struct ua_datavalue * | value | ||
) |
Implementation of the ua_store_attach function for the memorystore.
struct ua_variant * ua_memorystore_clear | ( | struct ua_memorystore * | store | ) |
Clear all values in a memorystore and the store itself.
store | Context of the memorystore to clear. |
static void ua_memorystore_get_value | ( | void * | memorystore, |
ua_node_t | node, | ||
unsigned int | idx, | ||
bool | source_ts, | ||
struct ua_indexrange * | range, | ||
unsigned int | num_ranges, | ||
struct ua_datavalue * | result | ||
) |
Implementation of the ua_store_get function for the memorystore.
int ua_memorystore_init | ( | struct ua_memorystore * | store, |
uint8_t | storeidx, | ||
struct ua_variant * | values, | ||
unsigned int | num_values | ||
) |
Initialize a memorystore with a preallocated ua_variant array.
store | Context of the memorystore. |
storeidx | Storeindex used for registering the store. Zero means a free value is chosen. |
values | Array with preallocated empty values. |
num_values | Number of elements in values. |