tpl 1.5

A binary data interchange format and C API.

  Add it to your Download Basket!

 Add it to your Watch List!


Rate it!

What's new in tpl 1.5:

  • tpl now builds as a DLL under Microsoft Visual Studio! (thanks, degski and Zhang Yafei!)
  • there are now two download options: the tarball and the Visual Studio solution
  • a crash in tpl_free on certain format strings has been fixed (thanks, Eric Rose!)
  • fixed a bug in tpl_dump on 64-bit, big-endian platforms
Read full changelog
send us
an update
BSD License 
Troy Hanson
ROOT \ System \ Clustering and Distributed Networks
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.

Last updated on February 6th, 2010

#binary data interchange #data interchange #C API #tpl #binary #data #interchange

Add your review!