Added tuple columns containing immutable indexed data arrays of any type

This commit is contained in:
Celine Mercier
2017-11-15 13:48:59 +01:00
parent 1684f96b79
commit 9a50803c00
32 changed files with 1097 additions and 284 deletions

View File

@ -361,6 +361,7 @@ Obiview_p obi_open_view(OBIDMS_p dms, const char* view_name);
* @param nb_elements_per_line The number of elements per line, if the column is created.
* @param elements_names The names of the elements with ';' as separator (no terminal ';'),
* if the column is created; NULL or "" if the default names are to be used ("0\01\02\0...\0n").
* @param tuples A boolean indicating whether the column should contain indices referring to indexed tuples.
* @param indexer_name The name of the indexer if there is one associated with the column, if the column is created.
* If NULL or "", the indexer name is set as the column name.
* @param associated_column_name The name of the associated column if there is one (otherwise NULL or ""), if the column is created.
@ -383,6 +384,7 @@ int obi_view_add_column(Obiview_p view,
index_t nb_lines,
index_t nb_elements_per_line,
char* elements_names,
bool tuples,
const char* indexer_name,
const char* associated_column_name,
obiversion_t associated_column_version,
@ -2207,4 +2209,88 @@ index_t obi_get_index_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_col
index_t obi_get_index_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name);
/*********** FOR ARRAY COLUMNS ***********/
/**
* @brief Sets a value in an OBIDMS column containing indices referring to indexed arrays,
* using the column pointer, 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.
*
* @param view A pointer on the opened writable view.
* @param column_p A pointer on the column.
* @param line_nb The number of the line where the value should be set.
* @param value The value that should be set.
* @param elt_size The size in bits of one element.
* @param value_length The length (number of elements) of the array to index.
*
* @returns An integer value indicating the success of the operation.
* @retval 0 on success.
* @retval -1 if an error occurred.
*
* @since October 2017
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_set_array_with_col_p_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const void* value, uint8_t elt_size, int32_t value_length);
/**
* @brief Recovers a value in an OBIDMS column containing indices referring to indexed arrays,
* using the column pointer, in the context of a view.
*
* @param view A pointer on the opened view.
* @param column_p A pointer on the column.
* @param line_nb The number of the line where the value should be recovered.
* @param value_length_p A pointer on an int where the length of the value (number of elements in the array) will be stored.
*
* @returns The recovered value.
* @retval OBITuple_NA the NA value of the type if an error occurred and obi_errno is set.
*
* @since October 2017
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
const void* obi_get_array_with_col_p_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, int32_t* value_length_p);
/**
* @brief Sets a value in an OBIDMS column containing indices referring to indexed arrays,
* using the column name, 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.
*
* @param view A pointer on the opened writable view.
* @param column_name The name of the column.
* @param line_nb The number of the line where the value should be set.
* @param value The value that should be set.
* @param elt_size The size in bits of one element.
* @param value_length The length (number of elements) of the array to index.
*
* @returns An integer value indicating the success of the operation.
* @retval 0 on success.
* @retval -1 if an error occurred.
*
* @since October 2017
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_set_array_with_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const void* value, uint8_t elt_size, int32_t value_length);
/**
* @brief Recovers a value in an OBIDMS column containing indices referring to indexed arrays,
* using the column name, in the context of a view.
*
* @param view A pointer on the opened view.
* @param column_name The name of the column.
* @param line_nb The number of the line where the value should be recovered.
* @param value_length_p A pointer on an int where the length of the value (number of elements in the array) will be stored.
*
* @returns The recovered value.
* @retval OBITuple_NA the NA value of the type if an error occurred and obi_errno is set.
*
* @since October 2017
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
const void* obi_get_array_with_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, int32_t* value_length_p);
#endif /* OBIVIEW_H_ */