High Performance OPC UA Server SDK  1.2.0.193
ua_file_reader Struct Reference

UA File Reader. More...

#include <file_reader.h>

Public Member Functions

int ua_file_reader_init (struct ua_file_reader *r, fct_add_namespace add_namespace_cb, fct_add_string_table add_string_table_cb, fct_add_string add_string_cb, fct_add_node add_node_cb, fct_add_reference add_reference_cb, fct_report_stat report_stat_cb, void *userdata)
 Initializes the file reader context. More...
 
int ua_file_reader_load_file (struct ua_file_reader *r, const char *filename)
 Loads the given file. More...
 

Data Fields

ua_file_t f
 
fct_add_namespace add_namespace_cb
 
fct_add_string_table add_string_table_cb
 
fct_add_string add_string_cb
 
fct_add_node add_node_cb
 
fct_add_reference add_reference_cb
 
fct_report_stat report_stat_cb
 
uint32_t num_reqnamespaces
 
uint32_t num_namespaces
 
struct ua_file_node_stat stat
 
uint32_t num_stringtables
 
uint32_t num_extensions
 
uint32_t lastpos
 for calculating statistics
 
void * userdata
 

Detailed Description

UA File Reader.

Is used for loading Unified Automatio Binary Format files. This implements an event-driven file format parser (similar to SAX in XML) which does not create any intermediate data. Instead it calls a callback for each loaded object that the caller can process as needed. This makes the file parsing independent of the used SDK and suitable for embedded systems. The file format itself was designed in a way to make this event-driven process possible without the need of iterating over the file more than once (unlike the XML Nodeset from OPC Foundation). For this reason the loading binary files is magnitudes faster than XML and only requires a fraction of the memory.

Member Function Documentation

int ua_file_reader_init ( struct ua_file_reader r,
fct_add_namespace  add_namespace_cb,
fct_add_string_table  add_string_table_cb,
fct_add_string  add_string_cb,
fct_add_node  add_node_cb,
fct_add_reference  add_reference_cb,
fct_report_stat  report_stat_cb,
void *  userdata 
)

Initializes the file reader context.

Parameters
rThe file reader context.
add_namespace_cbCallback for adding a new namespace.
add_string_table_cbCallback for adding a new string table.
add_string_cbCallback for adding a new string to an existing string table.
add_node_cbCallback for adding a new node.
add_reference_cbCallback for adding a new reference.
report_stat_cbCallback for reporting the file statistics. This contains the number of all nodes, references, etc. This is called first before any other callback is invoked. This can be used to setup the required memory pools.
Returns
Always returns 0.
int ua_file_reader_load_file ( struct ua_file_reader r,
const char *  filename 
)

Loads the given file.

Parameters
rInitializes file reader context.
filenameFilename of file to load.

Example code:

struct ua_file_reader reader;
int ret;
ua_file_reader_init(&reader, my_add_namespace, my_add_string_table, my_add_string, my_add_node, my_add_reference, my_report_stat);
ret = ua_file_reader_load_file(&reader, filename);
if (ret == 0) {
// Success
} else {
// Error
}
Returns
Zero on success.

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