Function tskit::bindings::tsk_table_collection_load
source · pub unsafe extern "C" fn tsk_table_collection_load(
self_: *mut tsk_table_collection_t,
filename: *const c_char,
options: tsk_flags_t
) -> c_int
Expand description
@brief Load a table collection from a file path.
@rst
Loads the data from the specified file into this table collection.
By default, the table collection is also initialised.
The resources allocated must be freed using
:c:func:tsk_table_collection_free
even in error conditions.
If the :c:macro:TSK_NO_INIT
option is set, the table collection is
not initialised, allowing an already initialised table collection to
be overwritten with the data from a file.
If the file contains multiple table collections, this function will load
the first. Please see the :c:func:tsk_table_collection_loadf
for details
on how to sequentially load table collections from a stream.
If the :c:macro:TSK_LOAD_SKIP_TABLES
option is set, only the non-table information from
the table collection will be read, leaving all tables with zero rows and no
metadata or schema.
If the :c:macro:TSK_LOAD_SKIP_REFERENCE_SEQUENCE
option is set, the table collection is
read without loading the reference sequence.
Options**
Options can be specified by providing one or more of the following bitwise flags:
- :c:macro:
TSK_NO_INIT
- :c:macro:
TSK_LOAD_SKIP_TABLES
- :c:macro:
TSK_LOAD_SKIP_REFERENCE_SEQUENCE
Examples**
.. code-block:: c
int ret; tsk_table_collection_t tables; ret = tsk_table_collection_load(&tables, “data.trees”, 0); if (ret != 0) { fprintf(stderr, “Load error:%s\n”, tsk_strerror(ret)); exit(EXIT_FAILURE); }
@endrst
@param self A pointer to an uninitialised tsk_table_collection_t object if the TSK_NO_INIT option is not set (default), or an initialised tsk_table_collection_t otherwise. @param filename A NULL terminated string containing the filename. @param options Bitwise options. See above for details. @return Return 0 on success or a negative value on failure.