tblite
Light-weight tight-binding framework
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
table.h File Reference

Provides a representation of a generic table data structure. More...

#include "tblite/macros.h"
#include "tblite/error.h"

Go to the source code of this file.

Macros

#define tblite_table_set_value(error, table, key, value, ...)
 

Typedefs

typedef struct _tblite_table * tblite_table
 

Functions

TBLITE_API_ENTRY tblite_table TBLITE_API_CALL tblite_new_table (tblite_table *table)
 
TBLITE_API_ENTRY void TBLITE_API_CALL tblite_delete_table (tblite_table *table)
 
TBLITE_API_ENTRY void TBLITE_API_CALL tblite_table_set_double (tblite_error error, tblite_table table, char key[], double *value, int n)
 
TBLITE_API_ENTRY void TBLITE_API_CALL tblite_table_set_int64_t (tblite_error error, tblite_table table, char key[], int64_t *value, int n)
 
TBLITE_API_ENTRY void TBLITE_API_CALL tblite_table_set_bool (tblite_error error, tblite_table table, char key[], bool *value, int n)
 
TBLITE_API_ENTRY void TBLITE_API_CALL tblite_table_set_char (tblite_error error, tblite_table table, char key[], char(*value)[], int n)
 
TBLITE_API_ENTRY tblite_table TBLITE_API_CALL tblite_table_add_table (tblite_error error, tblite_table table, char key[])
 

Detailed Description

Provides a representation of a generic table data structure.

Used to mirror the data available in the tblite_param object. It aims to provide a programmatic accessible representation of the parametrization records.

Macro Definition Documentation

◆ tblite_table_set_value

#define tblite_table_set_value ( error,
table,
key,
value,
... )
Value:
_Generic((value), \
char(*)[]: tblite_table_set_char \
)((error), (table), (key), (value), __VA_ARGS__)
TBLITE_API_ENTRY void TBLITE_API_CALL tblite_table_set_int64_t(tblite_error error, tblite_table table, char key[], int64_t *value, int n)
TBLITE_API_ENTRY void TBLITE_API_CALL tblite_table_set_bool(tblite_error error, tblite_table table, char key[], bool *value, int n)
TBLITE_API_ENTRY void TBLITE_API_CALL tblite_table_set_double(tblite_error error, tblite_table table, char key[], double *value, int n)
TBLITE_API_ENTRY void TBLITE_API_CALL tblite_table_set_char(tblite_error error, tblite_table table, char key[], char(*value)[], int n)

Generic setter based on the type of the value

Parameters
errorError handle
tableTable data structure
keyKey to set value at
valueValue to set at key

Typedef Documentation

◆ tblite_table

typedef struct _tblite_table* tblite_table

Handle for holding a table data structure

The table can either own its data or reference another table. Table references can be created from existing table data structures or by adding new table entries into an existing table, which returns a reference to the newly created table.

Function Documentation

◆ tblite_delete_table()

TBLITE_API_ENTRY void TBLITE_API_CALL tblite_delete_table ( tblite_table * table)

Delete a data table object

Parameters
tableTable object to be deleted

◆ tblite_new_table()

Create new data table object

Parameters
tableTable object to reference in new table (optional)
Returns
: New table data structure

◆ tblite_table_add_table()

TBLITE_API_ENTRY tblite_table TBLITE_API_CALL tblite_table_add_table ( tblite_error error,
tblite_table table,
char key[] )

Create new subtable in existing data table

Parameters
errorError handle
tableTable data structure
keyKey to add new subtable at
Returns
New table data structure

◆ tblite_table_set_bool()

TBLITE_API_ENTRY void TBLITE_API_CALL tblite_table_set_bool ( tblite_error error,
tblite_table table,
char key[],
bool * value,
int n )

Set boolean value to data table

Parameters
errorError handle
tableTable data structure
keyKey to set value at
valueBoolean value or array to add to table
nNumber of entries to add, 0 for adding scalars

◆ tblite_table_set_char()

TBLITE_API_ENTRY void TBLITE_API_CALL tblite_table_set_char ( tblite_error error,
tblite_table table,
char key[],
char(*) value[],
int n )

Set character string to data table

Parameters
errorError handle
tableTable data structure
keyKey to set value at
valueCharacter value or array to add to table
nNumber of entries to add, 0 for adding scalars

◆ tblite_table_set_double()

TBLITE_API_ENTRY void TBLITE_API_CALL tblite_table_set_double ( tblite_error error,
tblite_table table,
char key[],
double * value,
int n )

Set floating point number to data table

Parameters
errorError handle
tableTable data structure
keyKey to set value at
valueDouble value or array to add to table
nNumber of entries to add, 0 for adding scalars

◆ tblite_table_set_int64_t()

TBLITE_API_ENTRY void TBLITE_API_CALL tblite_table_set_int64_t ( tblite_error error,
tblite_table table,
char key[],
int64_t * value,
int n )

Set integer number to data table (use int64_t rather than long)

Parameters
errorError handle
tableTable data structure
keyKey to set value at
valueInteger value or array to add to table
nNumber of entries to add, 0 for adding scalars