Function tskit::bindings::tsk_table_collection_dump[][src]

pub unsafe extern "C" fn tsk_table_collection_dump(
    self_: *mut tsk_table_collection_t,
    filename: *const c_char,
    options: tsk_flags_t
) -> c_int

@brief Write a table collection to file.

@rst Writes the data from this table collection to the specified file. Usually we expect that data written to a file will be in a form that can be read directly and used to create a tree sequence; that is, we assume that by default the tables are :ref:sorted <sec_table_sorting> and :ref:indexed <sec_table_indexes>. Following these assumptions, if the tables are not already indexed, we index the tables before writing to file to save the cost of building these indexes at load time. This behaviour requires that the tables are sorted. If this automatic indexing is not desired, it can be disabled using the TSK_NO_BUILD_INDEXES option.

If an error occurs the file path is deleted, ensuring that only complete and well formed files will be written.

Options**

Options can be specified by providing one or more of the following bitwise flags:

TSK_NO_BUILD_INDEXES Do not build indexes for this table before writing to file. This is useful if you wish to write unsorted tables to file, as building the indexes will raise an error if the table is unsorted.

Examples**

.. code-block:: c

int ret; tsk_table_collection_t tables;

ret = tsk_table_collection_init(&tables, 0); error_check(ret); tables.sequence_length = 1.0; ret = tsk_table_collection_dump(&tables, “empty.trees”, 0); error_check(ret);

@endrst

@param self A pointer to an initialised tsk_table_collection_t object. @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.