Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

gtcdb.h File Reference

Database streaming. More...

#include <gtcspeaker.h>
#include <gtcmesh.h>

Go to the source code of this file.

Compounds

struct  _gtcBitBufferList
struct  _gtcDBNode
 Nodes in the hash table (database). More...

struct  _vectype
 How a vector type is stored. More...

struct  gtcBitBuffer
struct  gtcBitSettings
struct  gtcDB

Defines

#define GTCBITBUFFERSIZE   256
#define HASHSIZE   256

Typedefs

typedef struct _gtcBitBufferList gtcBitBufferList
typedef struct _vectype  vectype
 How a vector type is stored.

typedef struct _gtcDBNode gtcDBNode

Enumerations

enum  gtcDBTypes {
  gtcDBBegin = 0, gtcDBInt, gtcDBUnsigned, gtcDBFloat,
  gtcDBMatrix, gtcDBChar, gtcDBIntVec, gtcDBUnsignedVec,
  gtcDBFloatVec, gtcDBMatrixVec, gtcDBCharVec, gtcDBEnd
}
 Types that entries in a database can be.


Functions

gtcBitBuffer* gtc_new_bitbuffer ()
void gtc_destroy_bitbuffer (gtcBitBuffer *bb)
void gtc_bitbuffer_put_bit (gtcBitBuffer *bb, int bit)
gtcPacketgtc_bitbuffer_to_packet (gtcBitBuffer *bb)
void gtc_bitbuffer_ip (gtcBitBuffer *bb, int i, int prec)
 Put int with given # of bits.

void gtc_bitbuffer_up (gtcBitBuffer *bb, unsigned i, int prec)
 Put unsigned with given # of bits.

void gtc_bitbuffer_iv (gtcBitBuffer *bb, int i)
 Put int with variable # of bits.

void gtc_bitbuffer_uv (gtcBitBuffer *bb, unsigned i)
 Put unsigned with variable # of bits.

void gtc_bitbuffer_float (gtcBitBuffer *bb, float f, int mantissa, int exponent)
 Put a float with given # of bits of mantissa and exponent.

void gtc_bitbuffer_matrix (gtcBitBuffer *bb, float f[3][3], int mantissa, int exponent)
 Put a 3x3 matrix with given # of bits of mantissa and exponent.

void gtc_bitbuffer_string (gtcBitBuffer *bb, char *s)
 Put a string.

void gtc_bitpacket_prepare (gtcPacket *p)
int gtc_bitpacket_get_bit (gtcPacket *p)
int gtc_bitpacket_ip (gtcPacket *p, int prec)
 Get int with given # of bits.

unsigned gtc_bitpacket_up (gtcPacket *p, int prec)
 Get unsigned with given # of bits.

int gtc_bitpacket_iv (gtcPacket *p)
 Get int with variable # of bits.

unsigned gtc_bitpacket_uv (gtcPacket *p)
 Get unsigned with variable # of bits.

float gtc_bitpacket_float (gtcPacket *p, int mantissa, int exponent)
 Get float with given # of mantissa and exponent bits.

void gtc_bitpacket_matrix (gtcPacket *p, float f[3][3], int mantissa, int exponent)
 Get a 3x3 matrix with given # of bits of mantissa and exponent.

char* gtc_bitpacket_string (gtcPacket *p)
 Get a string.

gtcDBNode* gtc_new_dbnode (int id, int type, void *value)
 Makes a new DbNode -- copies the value.

gtcDBNode* gtc_new_dbnode_vec (int id, int type, int size, void *values)
 Makes a new array DbNode. copies the values.

void gtc_delete_dbnode (gtcDBNode *node)
 Frees the node and the value.

int gtc_hash (int size, void *data, int hash)
 Generic hash function -- dunno if it's any good. You can pass in a previous hash to mix several hashes together, or zero otherwise.

gtcDB* gtc_db_new (void)
 Create a new, empty database.

void gtc_db_delete (gtcDB *db)
 Delete a database, destroying all data (node->values too!).

int gtc_db_insert_int (gtcDB *db, int i)
 Insert an int into the database -- return id.

int gtc_db_insert_unsigned (gtcDB *db, unsigned i)
 Insert an unsigned into the database -- return id.

int gtc_db_insert_float (gtcDB *db, gtcReal f)
 Insert a float into the database -- return id.

int gtc_db_insert_matrix33 (gtcDB *db, gtcReal m[3][3])
 Insert a matrix into the database -- return id.

int gtc_db_insert_matrix44 (gtcDB *db, gtcReal m[4][4])
 Insert a matrix into the database -- return id. this function only uses the 3x3 upper left corner of the 4x4 matrix.

int gtc_db_insert_char (gtcDB *db, char x)
 Insert a char into the database -- return id.

int gtc_db_insert_array_int (gtcDB *db, int length, int elems[])
 Insert array of ints, return id.

int gtc_db_insert_array_unsigned (gtcDB *db, int length, unsigned elems[])
 Insert array of unsigned, return id.

int gtc_db_insert_array_float (gtcDB *db, int length, gtcReal elems[])
 Insert array of floats, return id.

int gtc_db_insert_array_matrix33 (gtcDB *db, int length, gtcReal elems[][3][3])
 Insert array of matrices, return id.

int gtc_db_insert_array_matrix44 (gtcDB *db, int length, gtcReal elems[][4][4])
 Insert array of matrices, return id. only the upper left 3x3 corner of the matrices are used.

int gtc_db_insert_array_char (gtcDB *db, int length, char elems[])
 Insert array of chars, return id.

int gtc_db_insert_string (gtcDB *db, char string[])
 Insert a null-terminated string as an array of chars, return id.

gtcDBNode* gtc_db_get (gtcDB *db, int id)
 Get an item from the database from its id.

void gtc_dbnode_print (gtcDBNode *foo)
 Print a gtcDBNode.

void gtc_bitbuffer_db (gtcBitBuffer *bb, gtcDB *db, gtcBitSettings *set, gtcDB *prev)
 Stream a database to a bitbuffer.

gtcDB* gtc_bitpacket_db (gtcPacket *bp, gtcBitSettings *set, gtcDB *prev)
 Restore a database from a bitpacket.


Variables

const int gtcDBTypeSizes []


Detailed Description

Database streaming.

This piece of GTC has facilities for streaming data for exchange over the wire. Basic data such as floats and strings can be sent, but 3d vectors, matrices and such also have special compression routines and the database can also hold vectors.

Compression is lossy.

Communication is one-way. The sender (server) has the master database and the receiver (client) receives the database.


Variable Documentation

const int gtcDBTypeSizes
 

Initial value:

{
  0,
  sizeof(int),
  sizeof(unsigned),
  sizeof(gtcReal),
  sizeof(gtcReal)*9,
  sizeof(char),
  sizeof(int),
  sizeof(unsigned),
  sizeof(gtcReal),
  sizeof(gtcReal)*9,
  sizeof(char),
  -1
}


Generated at Sat Jul 14 18:53:52 2001 for GTC by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001