Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

Overview of the DataTree library

C_lang_v0.8_beta

Purpose

This library provides support for a hierarchical data structures, which can streamed to/from a flat file, or dynamically manipulated in-memory.

It is a convenent tool to support:

In some ways, it can be seen as similar to XML, but it is a much more lightweight approach, and is not intended to be used as a text markup (just as XML wasn't designed for storing application data, or for readability of the text form by naive users).

This library is lightweight and modular, written in portable C. Its modularity means that it is very easy to implement support for new file formats, or even to replace the in-memory representation of a tree

The structure of a datatree

A data tree is made of a hierarchy of nodes, which can be of 3 types:

This tree-like structure can be represented and manipulated in two forms:

These two representations are independently implemented, and can be independently replaced. This library currently provides one in-memory representation, and supports streaming to a single text file format.

In-memory representation.

When a datatree is loaded in memory, each node is represented as an instance of the dt_node_ base class -- an internally defined structure accessed through a pointer and a set of provided functions.

Three subclasses of dt_node implement the leaf, array and record nodes. They are instantiated using the dt_make_leaf(), dt_make_arr(), and dt_make_rec() functions.

See also:
dt_node.h

Streaming of a datatree

When a datatree is streamed, it is flattended by traversing the tree. The traversal starts from the root, reports when an array or record is entered or being left, and includes each leaf node data.
Each event that occurs during traversal is described in data structure of type dt_stream_step.

Tree traversal can happen either in pull or push mode, and is supported by the following objects:

These objects are comparable to input/output ports. Utility functions can transfer data from a source to a destination, and can also validate the consistency of the transferred data (that is, check that record and array entry/exit events are properly paired). (See file dt_stream_util.h).

See also:
dt_stream.h

Overview of interfaces

The following headers provide the core C interface to this library:

Historical Notes

Earlier versions of this library have been in use since 1996, and were implemented in C++. It also had been ported to Delphi. For increased portability, this library has been ported to plain C in May 2003.

Author:
Ivan Vecerina -- http://www.post1.com/~ivec

Generated on Sun Jun 1 16:35:38 2003 for datatree by doxygen 1.3.1