tblite
Light-weight tight-binding framework
Loading...
Searching...
No Matches
table.h
Go to the documentation of this file.
1/* This file is part of tblite.
2 * SPDX-Identifier: LGPL-3.0-or-later
3 *
4 * tblite is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * tblite is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with tblite. If not, see <https://www.gnu.org/licenses/>.
16**/
17
26#pragma once
27
28#include "tblite/macros.h"
29#include "tblite/error.h"
30
36typedef struct _tblite_table* tblite_table;
37
44
50
60 tblite_table table,
61 char key[],
62 double* value,
63 int n);
64
74 tblite_table table,
75 char key[],
76 int64_t* value,
77 int n);
78
88 tblite_table table,
89 char key[],
90 bool* value,
91 int n);
92
102 tblite_table table,
103 char key[],
104 char (* value)[],
105 int n);
106
115 tblite_table table,
116 char key[]);
117
118/*
119 * Type generic macros
120 */
121
128#define tblite_table_set_value(error, table, key, value, ...) \
129 _Generic((value), \
130 double*: tblite_table_set_double, \
131 int64_t*: tblite_table_set_int64_t, \
132 bool*: tblite_table_set_bool, \
133 char(*)[]: tblite_table_set_char \
134 )((error), (table), (key), (value), __VA_ARGS__)
Provides a light-weight error handler for communicating with the library.
struct _tblite_error * tblite_error
Error instance.
Definition error.h:35
General macro definitions for the tblite C API bindings.
#define TBLITE_API_ENTRY
Definition macros.h:49
#define TBLITE_API_CALL
Definition macros.h:57
TBLITE_API_ENTRY void TBLITE_API_CALL tblite_delete_table(tblite_table *table)
struct _tblite_table * tblite_table
Definition table.h:36
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 tblite_table TBLITE_API_CALL tblite_table_add_table(tblite_error error, tblite_table table, char key[])
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)
TBLITE_API_ENTRY tblite_table TBLITE_API_CALL tblite_new_table(tblite_table *table)