Function tskit::bindings::tsk_tree_get_sites
source · pub unsafe extern "C" fn tsk_tree_get_sites(
self_: *const tsk_tree_t,
sites: *mut *const tsk_site_t,
sites_length: *mut tsk_size_t
) -> c_int
Expand description
@brief Get the list of sites for this tree.
@rst
Gets the list of :c:data:tsk_site_t
objects in the parent tree sequence
for which the position lies within this tree’s genomic interval.
The memory pointed to by the sites
parameter is managed by the
tsk_tree_t
object and must not be altered or freed by client code.
.. code-block:: c
static void print_sites(const tsk_tree_t *tree) { int ret; tsk_size_t j, num_sites; const tsk_site_t *sites;
ret = tsk_tree_get_sites(tree, &sites, &num_sites); check_tsk_error(ret); for (j = 0; j < num_sites; j++) { printf(“position = %f\n”, sites[j].position); } }
This is a constant time operation.
@endrst
@param self A pointer to a tsk_tree_t object. @param sites The destination pointer for the list of sites. @param sites_length A pointer to a tsk_size_t value in which the number of sites is stored. @return 0 on success or a negative value on failure.