High Performance OPC UA Server SDK
1.2.0.193
|
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 |
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.
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.
r | The file reader context. |
add_namespace_cb | Callback for adding a new namespace. |
add_string_table_cb | Callback for adding a new string table. |
add_string_cb | Callback for adding a new string to an existing string table. |
add_node_cb | Callback for adding a new node. |
add_reference_cb | Callback for adding a new reference. |
report_stat_cb | Callback 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. |
int ua_file_reader_load_file | ( | struct ua_file_reader * | r, |
const char * | filename | ||
) |
Loads the given file.
r | Initializes file reader context. |
filename | Filename of file to load. |
Example code: