High Performance OPC UA Server SDK  1.2.0.193
ua_memorystore Struct Reference

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_variantua_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_variantvalues
 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.
 

Detailed Description

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.

Member Function Documentation

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.

Parameters
storeContext of the memorystore.
valueNew value to attach.
nodeHandle of node associated with the value.
Returns
Zero on success or errorcode on failure.
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.

Parameters
storeContext of the memorystore to clear.
Returns
Pointer to the values array provided in ua_memorystore_init.
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.

Parameters
storeContext of the memorystore.
storeidxStoreindex used for registering the store. Zero means a free value is chosen.
valuesArray with preallocated empty values.
num_valuesNumber of elements in values.

The documentation for this struct was generated from the following files: