Finished adding all the functions to directly set and get indices in

columns containing indices referring to any type of data.
This commit is contained in:
Celine Mercier
2016-11-30 11:08:11 +01:00
parent 6f6099687d
commit 4ad8c16a73
4 changed files with 168 additions and 40 deletions

View File

@ -1314,6 +1314,38 @@ const char* obi_get_str_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_c
const char* obi_get_str_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name);
/**
* @brief Sets a value in an OBIDMS column containing indices, using the index of the element in the line,
* in the context of a view.
*
* Note: If the column is read-only or if there is a line selection associated with the view (making columns non-writable), it is cloned.
*
* Note: Columns containing indices refer to data stored elsewhere, for example lines in other columns,
* or data stored in indexers.
*
* In the case of columns referring to values stored in indexers, this allows to directly set already-known
* indices without going through the time-consuming step of indexing the value.
*
* @param view A pointer on the opened writable view.
* @param column A pointer on the column.
* @param line_nb The number of the line where the value should be set.
* @param element_idx The index of the element that should be set in the line.
* @param value The value that should be set.
*
* @returns An integer value indicating the success of the operation.
* @retval 0 on success.
* @retval -1 if an error occurred.
*
* @since November 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_set_index_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx, index_t value);
// TODO
int obi_set_index_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx, index_t value);
/**
* @brief Recovers a value in an OBIDMS column containing indexes, in the context of a view.
*
@ -1338,6 +1370,38 @@ index_t obi_get_index_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_colu
index_t obi_get_index_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx);
/**
* @brief Sets a value in an OBIDMS column containing indices, using the index of the element in the line,
* in the context of a view.
*
* Note: If the column is read-only or if there is a line selection associated with the view (making columns non-writable), it is cloned.
*
* Note: Columns containing indices refer to data stored elsewhere, for example lines in other columns,
* or data stored in indexers.
*
* In the case of columns referring to values stored in indexers, this allows to directly set already-known
* indices without going through the time-consuming step of indexing the value.
*
* @param view A pointer on the opened writable view.
* @param column A pointer on the column.
* @param line_nb The number of the line where the value should be set.
* @param element_name The name of the element that should be recovered in the line.
* @param value The value that should be set.
*
* @returns An integer value indicating the success of the operation.
* @retval 0 on success.
* @retval -1 if an error occurred.
*
* @since November 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_set_index_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name, index_t value);
// TODO
int obi_set_index_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name, index_t value);
/**
* @brief Recovers a value in an OBIDMS column containing indexes,
* using the name of the element in the line, in the context of a view.