Home ⌂Doc Index ◂Up ▴

oggz_table.h File Reference

A lookup table. More...

Go to the source code of this file.

Typedefs

typedef void OggzTable
 A table of key-value pairs.

Functions

OggzTableoggz_table_new (void)
 Instantiate a new OggzTable.
void oggz_table_delete (OggzTable *table)
 Delete an OggzTable.
void * oggz_table_insert (OggzTable *table, long key, void *data)
 Insert an element into a table.
int oggz_table_remove (OggzTable *table, long key)
 Remove the element of an OggzTable indexed by a given key.
void * oggz_table_lookup (OggzTable *table, long key)
 Retrieve the element of an OggzTable indexed by a given key.
int oggz_table_size (OggzTable *table)
 Query the number of elements in an OggzTable.
void * oggz_table_nth (OggzTable *table, int n, long *key)
 Retrieve the nth element of an OggzTable, and optionally its key.

Detailed Description

A lookup table.

OggzTable is provided for convenience to allow the storage of serialno-specific data.


Function Documentation

void oggz_table_delete ( OggzTable table  ) 

Delete an OggzTable.

Parameters:
table An OggzTable
void* oggz_table_insert ( OggzTable table,
long  key,
void *  data 
)

Insert an element into a table.

If a previous value existed for this key, it is overwritten with the new data element.

Parameters:
table An OggzTable
key Key to access this data element
data The new element to add
Return values:
data If the element was successfully added
NULL If adding the element failed due to a realloc() error
void* oggz_table_lookup ( OggzTable table,
long  key 
)

Retrieve the element of an OggzTable indexed by a given key.

Parameters:
table An OggzTable
key a key
Returns:
The element indexed by key
Return values:
NULL table is undefined, or no element is indexed by key
OggzTable* oggz_table_new ( void   ) 

Instantiate a new OggzTable.

Returns:
A new OggzTable
Return values:
NULL Could not allocate memory for table
void* oggz_table_nth ( OggzTable table,
int  n,
long *  key 
)

Retrieve the nth element of an OggzTable, and optionally its key.

Parameters:
table An OggzTable
n An index into the table
key Return pointer for key corresponding to nth data element of table. Ignored if NULL.
Returns:
The nth data element of table
Return values:
NULL table is undefined, or n is out of range
int oggz_table_remove ( OggzTable table,
long  key 
)

Remove the element of an OggzTable indexed by a given key.

Parameters:
table An OggzTable
key a key
Return values:
0 Success
-1 Not found
int oggz_table_size ( OggzTable table  ) 

Query the number of elements in an OggzTable.

Parameters:
table An OggzTable
Returns:
the number of elements in table
Generated on Sat Apr 24 09:13:55 2010 for liboggz by  doxygen 1.6.3


Home ⌂Doc Index ◂Up ▴