libsf3
|
#include "sf3_core.h"
Go to the source code of this file.
Data Structures | |
struct | sf3_column_spec |
Description of a column within the table. More... | |
struct | sf3_table |
Macros | |
#define | SF3_FORMAT_ID_TABLE 0x07 |
The format_id for a table file. | |
Enumerations | |
enum | sf3_column_type { SF3_COLUMN_UINT8 = 0x01 , SF3_COLUMN_UINT16 = 0x02 , SF3_COLUMN_UINT32 = 0x04 , SF3_COLUMN_UINT64 = 0x08 , SF3_COLUMN_INT8 = 0x11 , SF3_COLUMN_INT16 = 0x12 , SF3_COLUMN_INT32 = 0x14 , SF3_COLUMN_INT64 = 0x18 , SF3_COLUMN_FLOAT16 = 0x22 , SF3_COLUMN_FLOAT32 = 0x24 , SF3_COLUMN_FLOAT64 = 0x28 , SF3_COLUMN_STRING = 0x31 , SF3_COLUMN_TIMESTAMP = 0x48 , SF3_COLUMN_HIGH_RESOLUTION_TIMESTAMP = 0x58 , SF3_COLUMN_BOOLEAN = 0x61 } |
The column value types that can be stored. More... | |
Functions | |
SF3_INLINE const char * | sf3_table_data (const struct sf3_table *table) |
Returns a pointer to the encoded table data. | |
SF3_INLINE const struct sf3_column_spec * | sf3_table_next_column (const struct sf3_column_spec *column) |
SF3_INLINE const struct sf3_column_spec * | sf3_table_column (const struct sf3_table *table, uint16_t column) |
SF3_INLINE const char * | sf3_table_row (const struct sf3_table *table, uint64_t row) |
SF3_EXPORT const char * | sf3_table_cell (const struct sf3_table *table, uint64_t row, uint64_t column, const struct sf3_column_spec **spec) |
SF3_INLINE uint8_t | sf3_table_element_size (const struct sf3_column_spec *column) |
Returns the number of bytes per element of the given column. | |
SF3_INLINE uint32_t | sf3_table_element_count (const struct sf3_column_spec *column) |
Returns the number of elements in a cell of the given column. | |
SF3_EXPORT const char * | sf3_table_column_type (enum sf3_column_type type) |
Returns a human-readable string description of the column type. | |
SF3_EXPORT size_t | sf3_table_size (const struct sf3_table *table) |
Computes the size of the table file in bytes. | |
#define SF3_FORMAT_ID_TABLE 0x07 |
The format_id for a table file.
Definition at line 6 of file sf3_table.h.
enum sf3_column_type |
The column value types that can be stored.
Definition at line 9 of file sf3_table.h.
SF3_EXPORT const char * sf3_table_cell | ( | const struct sf3_table * | table, |
uint64_t | row, | ||
uint64_t | column, | ||
const struct sf3_column_spec ** | spec | ||
) |
Returns a pointer to the start of the given cell. Also returns ap ointer to the associated column descriptor in spec. If an invalid row or column index is given, null is returned instead and the spec pointer is considered invalid.
Note that this function needs to scan over all columns preceding the requested column. If you are reading out multiple rows of the same column, writing your own iteration with the cached offset of the column start would be much more efficient.
Definition at line 117 of file sf3_table.h.
SF3_INLINE const struct sf3_column_spec * sf3_table_column | ( | const struct sf3_table * | table, |
uint16_t | column | ||
) |
Returns the column spec at the requested index. If an invalid column index is given, null is returned instead.
Definition at line 91 of file sf3_table.h.
SF3_EXPORT const char * sf3_table_column_type | ( | enum sf3_column_type | type | ) |
Returns a human-readable string description of the column type.
Definition at line 142 of file sf3_table.h.
SF3_INLINE const char * sf3_table_data | ( | const struct sf3_table * | table | ) |
Returns a pointer to the encoded table data.
Definition at line 77 of file sf3_table.h.
SF3_INLINE uint32_t sf3_table_element_count | ( | const struct sf3_column_spec * | column | ) |
Returns the number of elements in a cell of the given column.
Definition at line 136 of file sf3_table.h.
SF3_INLINE uint8_t sf3_table_element_size | ( | const struct sf3_column_spec * | column | ) |
Returns the number of bytes per element of the given column.
Definition at line 131 of file sf3_table.h.
SF3_INLINE const struct sf3_column_spec * sf3_table_next_column | ( | const struct sf3_column_spec * | column | ) |
Returns the next column spec after this one. Note that this function does not perform any bounds checking whatsoever. It is up to you to ensure you do not call this with the last column spec of a table.
Definition at line 85 of file sf3_table.h.
SF3_INLINE const char * sf3_table_row | ( | const struct sf3_table * | table, |
uint64_t | row | ||
) |
Returns a pointer to the start of the given row. If an invalid row index is given, null is returned instead.
Definition at line 102 of file sf3_table.h.
SF3_EXPORT size_t sf3_table_size | ( | const struct sf3_table * | table | ) |
Computes the size of the table file in bytes.
Definition at line 164 of file sf3_table.h.