tpl 1.0 review

Download
by rbytes.net on

Tpl is a binary data interchange format and C API. C programs can use tpl to store or load serialized images of structured C data

License: BSD License
File size: 0K
Developer: Troy Hanson
0 stars award from rbytes.net

Tpl is a binary data interchange format and C API.

C programs can use tpl to store or load serialized images of structured C data. The data is stored in its native binary format. The data can consist of the basic C types, binary buffers and strings, and aggregations and arrays. The serialized image is a discrete, strictly-formatted data buffer that can be stored in a file, memory buffer or transmitted via sockets or pipes. It is suited for IPC or data storage.

Example: Storing an array of integers to file.

#include "tpl.h"

int main() {
tpl_node *tn;
int i;

tn = tpl_map( "A(i)", &i );
for( i=0; i file.xml
% tplxml file.xml > file.tpl

Typed, structured data

Every tpl has a data type, expressed as a format string. A few examples: A(i) is an integer array. A(is) is an array of integer/string pairs. Deeper structure is the same-- an array of integers which each have an array of strings is A(iA(s)).

Binary data portability

Tpl addresses binary data portability by transparently applying endian-conversion when necessary. It also prescribes sizes for the supported types. This permits binary data to be shared effectively between machines that use different CPU types. A tpl generated on an 32-bit x86 can be read on a 64-bit Sparc Ultra for example. This is especially useful for socket IPC.

Full native binary efficiency

The data within a tpl is never converted unless necessary, so you get the full efficiency of using your data types in their native binary representation. This makes it feasible to deal with very large tpl images (up to 4GB) efficiently. It also uses memory-mapped I/O when reading and writing files to avoid the overhead of copying data through the kernel.

tpl 1.0 search tags