next up previous contents
Next: Data Parsing Up: Serialisation Previous: Serialisation   Contents

Functionality

The serialisation process within TINA allows arbitrarily complex data structures to be packed into a linear array of data, transmitted to another processor and reconstructed for continued processing. The mechanism handles selected pointers for data structures which may be embedded in the data and can eliminate repeated data referencing ( see repeat_checker() ). This latter facility can be turned off via a call to repeatp_checking_set().

The information needed to serialise/de-serialise a TINA data structure is held in the global array variable tina_data_info_array. During use this array is indexed according to the TINA data type to recover serialisation/deserialisation function pointers. This array is defined in the file tstruct_info.h and the default elements of the array are defined in tstruct_info.c . Modifications to these default settings is made by the routine define_all_ts_handlers(). This is useful for modifying the basic functionality without having to recompile the entire TINA library. The tina_data_info_array has slots allocated for additional user defined structures (User_type_0_id - User_type_9_id) which can be used during algorithm development.

The ts_id flag determines which routines will be called during the serialisation and deserialisation process.

tina_data_info_array[*(int *) data - ts_base_id].serialise()
tina_data_info_array[*(int *) data - ts_base_id].deserialise()

The default version of these routines are ts_serialise() and ts_deserialise() respectively.

Serialisation proceeds by first processing the specified data structure to produce a linked list of all tagged TINA data structure. The type field of the List data structure is used to encode either the size of the data structure (if it is stored with this entry) or a negative offset to a previous entry in the list if it is repeated. This list is then written out as a sequential series of numbers specifying all of the data types present (or offsets) followed by the data contents of these structures. The whole lot is prefixed by the total number of data structures serialised and a magic number to encode byte reversal. During deserialisation the index list is read back and memory allocated for each data structure. The routines which handle this bottom level data transfer are fread_ts() and fwrite_ts().


next up previous contents
Next: Data Parsing Up: Serialisation Previous: Serialisation   Contents
root 2017-09-25