High Performance OPC UA Server SDK  1.2.0.193

Create/delete/iterate through references. More...

Macros

#define UA_REF_INVALID   (ua_ref_t)-1
 Value of an invalid reference handle.
 
#define UA_REF_BEFORE_LIST   (ua_ref_t)-2
 
#define UA_NSIDX_INVALID   (uint16_t)-1
 
#define ua_node_foreach(ref, node)   for (ref = ua_node_first_reference(node); ref != UA_REF_INVALID; ref = (ref == UA_REF_BEFORE_LIST) ? ua_node_first_reference(node) : ua_node_next_reference(ref))
 Foreach loop for iterating over all forward references of a node.
 
#define ua_node_foreach_inv(ref, node)   for (ref = ua_node_first_inv_reference(node); ref != UA_REF_INVALID; ref = (ref == UA_REF_BEFORE_LIST) ? ua_node_first_inv_reference(node) : ua_node_next_inv_reference(ref))
 Foreach loop for iterating over all inverse references of a node.
 

Typedefs

typedef int32_t ua_ref_t
 Handle for a reference in the addressspace.
 

Functions

ua_ref_t ua_node_first_reference (ua_node_t node)
 Get the first reference of a node. More...
 
ua_ref_t ua_node_next_reference (ua_ref_t ref)
 Get the next reference of a node. More...
 
ua_ref_t ua_node_first_inv_reference (ua_node_t node)
 Get the first inverse reference of a node. More...
 
ua_ref_t ua_node_next_inv_reference (ua_ref_t ref)
 Get the next inverse reference of a node. More...
 
unsigned int ua_node_forward_ref_count (ua_node_t node)
 Get the number of forward references for a node. More...
 
unsigned int ua_node_inverse_ref_count (ua_node_t node)
 Get the number of inverse references for a node. More...
 
ua_ref_t ua_reference_prepend (ua_node_t src, ua_node_t dst, ua_node_t reftype)
 Inserts a new reference at the beginning of the reference list. More...
 
ua_ref_t ua_reference_add (ua_node_t src, ua_node_t dst, ua_node_t reftype)
 Adds a new reference to the given src node. More...
 
ua_ref_t ua_reference_add0 (ua_node_t src, ua_node_t dst, uint32_t reftypeid)
 Convenience function for adding a reference with reftype from NS0. More...
 
int ua_reference_remove (ua_ref_t ref, ua_ref_t *prev_ref, ua_ref_t *prev_inv_ref)
 Remove a reference from the addressspace. More...
 
ua_node_t ua_reference_target (ua_ref_t ref)
 Get the target node of a reference. More...
 
ua_node_t ua_reference_source (ua_ref_t ref)
 Get the source node of a reference. More...
 
ua_node_t ua_reference_type (ua_ref_t ref)
 Get the type node of a reference. More...
 

Detailed Description

Create/delete/iterate through references.

Function Documentation

ua_ref_t ua_node_first_inv_reference ( ua_node_t  node)

Get the first inverse reference of a node.

See also
ua_node_first_reference
ua_ref_t ua_node_first_reference ( ua_node_t  node)

Get the first reference of a node.

You can iterate through all references of a node by combining this function with ua_node_next_reference. Or use ua_node_foreach.

Parameters
nodeHandle to get reference from.
Returns
handle to first reference, or UA_REF_INVALID if there is none.
unsigned int ua_node_forward_ref_count ( ua_node_t  node)

Get the number of forward references for a node.

Parameters
nodehandle of node
Returns
Number of forward references
unsigned int ua_node_inverse_ref_count ( ua_node_t  node)

Get the number of inverse references for a node.

Parameters
nodehandle of node
Returns
Number of inverse references
ua_ref_t ua_node_next_inv_reference ( ua_ref_t  ref)

Get the next inverse reference of a node.

See also
ua_node_next_reference
ua_ref_t ua_node_next_reference ( ua_ref_t  ref)

Get the next reference of a node.

Parameters
refhandle to current reference
Returns
handle to next reference, or UA_REF_INVALID if there is none.
ua_ref_t ua_reference_add ( ua_node_t  src,
ua_node_t  dst,
ua_node_t  reftype 
)

Adds a new reference to the given src node.

Parameters
srcsource node handle
dstdestination node handle
reftypereference type node handle Note, the reference is added to the reference pool in the same namespace as the source node. So the source node 'owns' the reference. This operation works with O(n), because it checks all reference in list if the reference to add already exists. This avoids adding references twice.
ua_ref_t ua_reference_add0 ( ua_node_t  src,
ua_node_t  dst,
uint32_t  reftypeid 
)

Convenience function for adding a reference with reftype from NS0.

See also
ua_reference_add
ua_ref_t ua_reference_prepend ( ua_node_t  src,
ua_node_t  dst,
ua_node_t  reftype 
)

Inserts a new reference at the beginning of the reference list.

This works in O(1) but does not check for double reference entries, so the caller is responsible to ensure consistent references. The src node must not be a static node (compiled-in address space).

Parameters
srcSource node of reference.
dstDestination node of reference.
reftypeReference type of reference.
Returns
Handle of new reference, or UA_REF_INVALID if the operations fails.
int ua_reference_remove ( ua_ref_t  ref,
ua_ref_t prev_ref,
ua_ref_t prev_inv_ref 
)

Remove a reference from the addressspace.

Parameters
refreference handle of reference to remove
prev_refreturns the previous forward reference on success. The reason for this is to make it possible to remove references while iterating of the forward references list. It is not allowed to call ua_node_next_reference() on a deleted reference. By returning the previous reference the ua_node_next_reference() will work and returns the next valid reference, skipping the deleted one. The parameter is optional, it is allowed the pass NULL, if the previous reference is not needed. Note, if the first reference was deleted *prev_ref will be set to UA_REF_BEFORE_LIST. If the function return a non-zero return value, the value of *prev_ref is undefined.
pref_inv_refthe same as prev_ref for reverse references. This allows to call ua_node_next_inv_reference with UA_REF_BEFORE_LIST.
Returns
Zero on success or errorcode on failure
ua_node_t ua_reference_source ( ua_ref_t  ref)

Get the source node of a reference.

Parameters
refHandle of the reference.
Returns
Handle of the source node.
ua_node_t ua_reference_target ( ua_ref_t  ref)

Get the target node of a reference.

Parameters
refHandle of the reference.
Returns
Handle of the target node.
ua_node_t ua_reference_type ( ua_ref_t  ref)

Get the type node of a reference.

Parameters
refHandle of the reference.
Returns
Handle of the type node.