Modules | Typedefs | Functions
NodeStore
Server

Detailed Description

Stores the nodes in the address space. Internally, it is based on a hash-map that maps nodes to their nodeid.

Nodes need to be allocated on the heap before adding them to the nodestore with. When adding, the node is copied to a new (managed) location in the nodestore and the original memory is freed. The nodes in the nodestore are immutable. To change the content of a node, it needs to be replaced as a whole.

Every node you _get from the nodestore needs to be _released when it is no longer needed. In the background, reference counting is used to know if somebody still uses the node in multi-threaded environments.

Modules

 External Nodestore
 

An external application that manages its own data and data model.


Typedefs

typedef struct UA_NodeStore UA_NodeStore
typedef void(* UA_NodeStore_nodeVisitor )(const UA_Node *node)

Functions

UA_NodeStoreUA_NodeStore_new (void)
void UA_NodeStore_delete (UA_NodeStore *ns)
UA_StatusCode UA_NodeStore_insert (UA_NodeStore *ns, UA_Node *node, const UA_Node **inserted)
UA_StatusCode UA_NodeStore_replace (UA_NodeStore *ns, const UA_Node *oldNode, UA_Node *node, const UA_Node **inserted)
UA_StatusCode UA_NodeStore_remove (UA_NodeStore *ns, const UA_NodeId *nodeid)
const UA_NodeUA_NodeStore_get (const UA_NodeStore *ns, const UA_NodeId *nodeid)
void UA_NodeStore_release (const UA_Node *managed)
void UA_NodeStore_iterate (const UA_NodeStore *ns, UA_NodeStore_nodeVisitor visitor)

Typedef Documentation

typedef struct UA_NodeStore UA_NodeStore
typedef void(* UA_NodeStore_nodeVisitor)(const UA_Node *node)

A function that can be evaluated on all entries in a namespace via UA_NodeStore_iterate. Note that the visitor is read-only on the nodes.


Function Documentation

Delete the namespace and all nodes in it

const UA_Node* UA_NodeStore_get ( const UA_NodeStore ns,
const UA_NodeId nodeid 
)

Retrieve a node (read-only) from the namespace. Nodes are immutable. They can only be replaced. After the Node is no longer used, the locked entry needs to be released.

UA_StatusCode UA_NodeStore_insert ( UA_NodeStore ns,
UA_Node node,
const UA_Node **  inserted 
)

Inserts a new node into the namespace. If the nodeid is zero, then a fresh numeric nodeid from namespace 1 is assigned. The memory of the original node is freed and the content is moved to a managed (immutable) node. If inserted is not NULL, then a pointer to the managed node is returned (and must be released).

void UA_NodeStore_iterate ( const UA_NodeStore ns,
UA_NodeStore_nodeVisitor  visitor 
)

Iterate over all nodes in a namespace.

Create a new namespace

void UA_NodeStore_release ( const UA_Node managed)

Release a managed node. Do never insert a node that isn't stored in a namespace.

UA_StatusCode UA_NodeStore_remove ( UA_NodeStore ns,
const UA_NodeId nodeid 
)

Remove a node from the namespace. Always succeeds, even if the node was not found.

UA_StatusCode UA_NodeStore_replace ( UA_NodeStore ns,
const UA_Node oldNode,
UA_Node node,
const UA_Node **  inserted 
)

Replace an existing node in the nodestore. If the node was already replaced, UA_STATUSCODE_BADINTERNALERROR is returned. If inserted is not NULL, a pointer to the managed (immutable) node is returned.