1+ /**
2+ * @file tsk_tables.h
3+ * @brief Tskit Tables API.
4+ */
15#ifndef TSK_TABLES_H
26#define TSK_TABLES_H
37
@@ -99,6 +103,9 @@ typedef struct {
99103/* Table definitions */
100104/****************************************************************************/
101105
106+ /**
107+ @brief The individual table.
108+ */
102109typedef struct {
103110 tsk_tbl_size_t num_rows ;
104111 tsk_tbl_size_t max_rows ;
@@ -116,6 +123,9 @@ typedef struct {
116123 tsk_tbl_size_t * metadata_offset ;
117124} tsk_individual_tbl_t ;
118125
126+ /**
127+ @brief The node table.
128+ */
119129typedef struct {
120130 tsk_tbl_size_t num_rows ;
121131 tsk_tbl_size_t max_rows ;
@@ -131,6 +141,9 @@ typedef struct {
131141 tsk_tbl_size_t * metadata_offset ;
132142} tsk_node_tbl_t ;
133143
144+ /**
145+ @brief The site table.
146+ */
134147typedef struct {
135148 tsk_tbl_size_t num_rows ;
136149 tsk_tbl_size_t max_rows ;
@@ -148,6 +161,9 @@ typedef struct {
148161 tsk_tbl_size_t * metadata_offset ;
149162} tsk_site_tbl_t ;
150163
164+ /**
165+ @brief The mutation table.
166+ */
151167typedef struct {
152168 tsk_tbl_size_t num_rows ;
153169 tsk_tbl_size_t max_rows ;
@@ -167,6 +183,9 @@ typedef struct {
167183 tsk_tbl_size_t * metadata_offset ;
168184} tsk_mutation_tbl_t ;
169185
186+ /**
187+ @brief The edge table.
188+ */
170189typedef struct {
171190 tsk_tbl_size_t num_rows ;
172191 tsk_tbl_size_t max_rows ;
@@ -177,6 +196,9 @@ typedef struct {
177196 tsk_id_t * child ;
178197} tsk_edge_tbl_t ;
179198
199+ /**
200+ @brief The migration table.
201+ */
180202typedef struct {
181203 tsk_tbl_size_t num_rows ;
182204 tsk_tbl_size_t max_rows ;
@@ -189,6 +211,9 @@ typedef struct {
189211 double * time ;
190212} tsk_migration_tbl_t ;
191213
214+ /**
215+ @brief The population table.
216+ */
192217typedef struct {
193218 tsk_tbl_size_t num_rows ;
194219 tsk_tbl_size_t max_rows ;
@@ -200,6 +225,9 @@ typedef struct {
200225 tsk_tbl_size_t * metadata_offset ;
201226} tsk_population_tbl_t ;
202227
228+ /**
229+ @brief The provenance table.
230+ */
203231typedef struct {
204232 tsk_tbl_size_t num_rows ;
205233 tsk_tbl_size_t max_rows ;
@@ -216,10 +244,16 @@ typedef struct {
216244 tsk_tbl_size_t * record_offset ;
217245} tsk_provenance_tbl_t ;
218246
247+ /**
248+ @brief The table collection.
249+ */
219250typedef struct {
251+ /** @brief The sequence length defining the tree sequence's coordinate space */
220252 double sequence_length ;
221253 char * file_uuid ;
254+ /** @brief The individual table */
222255 tsk_individual_tbl_t * individuals ;
256+ /* TODO document other public members */
223257 tsk_node_tbl_t * nodes ;
224258 tsk_edge_tbl_t * edges ;
225259 tsk_migration_tbl_t * migrations ;
@@ -438,7 +472,32 @@ int tsk_provenance_tbl_get_row(tsk_provenance_tbl_t *self, size_t index, tsk_pro
438472/* Table collection .*/
439473/****************************************************************************/
440474
475+ /**
476+ @brief Allocate a new table collection.
477+
478+ @rst
479+ After allocation, each of the consituent tables is allocated with the default size increment.
480+ The sequence length is set to zero.
481+ @endrst
482+
483+ @param self A pointer to an uninitialised tsk_tbl_collection_t object.
484+ @param flags Allocation time options. Currently unused.
485+ @return Return 0 on success or a negative value on failure.
486+ */
441487int tsk_tbl_collection_alloc (tsk_tbl_collection_t * self , int flags );
488+
489+ /**
490+ @brief Load a table collection from file.
491+
492+ @rst
493+ Reads a table collection from the specified file.
494+ @endrst
495+
496+ @param self A pointer to an uninitialised tsk_tbl_collection_t object.
497+ @param filename A NULL terminated string containing the filename.
498+ @param flags Load time options. Currently unused.
499+ @return Return 0 on success or a negative value on failure.
500+ */
442501int tsk_tbl_collection_load (tsk_tbl_collection_t * self , const char * filename , int flags );
443502int tsk_tbl_collection_dump (tsk_tbl_collection_t * tables , const char * filename , int flags );
444503int tsk_tbl_collection_copy (tsk_tbl_collection_t * self , tsk_tbl_collection_t * dest );
0 commit comments