Next: , Previous: Programmers guide, Up: Programmers guide


5.1 Creating database structure

Avldb uses simple C header-file as source of database structure/meta-scheme. Avldb structure is hidden in C source code as names of structs/variables, data structures and few special tags in standart C++ comments.

Keywords understood :

  1. struct name // avldb
  2. struct name // avldb block_size 1048576 See Block size.
  3. struct name // avldb max_block 4096 See Max blocks.
  4. ssize_t size_of_next_ptr_name ; // LO or len_of or enght_of
  5. type *variable-name // idx Idx#
  6. type variable-name // idx Idx#

Here is real-life avldb's meta-scheme definetion.

tests/adb_types_test.h
struct adb_types_test // avldb block_size 1048576 max_blocks 4096
{
        int j ;
        char *vstr ; // idx 0
        char str[25600] ; // idx 1
        long long ll ; // idx 3
        double dbl ; // idx 2
        char huge_str[2048] ;
} ;

The input header file is converted to temporary shared library by somaker utility. The purpose of temporary shared library is to obtain real-life offsets of all structs members. If header file parsing, shared library creation and shared library inspection passed without problems somaker creates the requested database and polulates the requested with data structures specified in input header file . If the database exists prior to call of somaker the result is undefined.