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

@@ -6,10 +6,10 @@
* @file obidsmcolumn_idx.h
* @author Celine Mercier
* @date February 14th 2016
* @brief Header file for the functions handling OBIColumns containing data with the OBIType OBI_IDX.
* @brief Header file for the functions handling OBIColumns containing indices (stored data type: OBI_IDX).
*
* Note: OBI_IDX columns contain indices referring to data stored elsewhere
* (for example lines in other columns) and contain only one element (index) per line.
* Note: Columns containing indices refer to data stored elsewhere, for example lines in other columns,
* or data stored in indexers.
*/
@@ -25,47 +25,40 @@
/**
* @brief Sets a value in an OBIDMS column containing data with the type OBI_IDX.
* @brief Sets a value in an OBIDMS column containing indices (stored data type: OBI_IDX),
* using the index of the element in the line.
*
* Note: OBI_IDX columns contain indices referring to data stored elsewhere
* (for example lines in other columns) and contain only one element (index) per line.
* 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.
*
* @warning Pointers returned by obi_open_column() don't allow writing.
*
* @param column A pointer as returned by obi_create_column() or obi_clone_column().
* @param line_nb The number of the line where the value should be set.
* @param value The value that should be set.
* @param element_idx The index of the element that should be set in the line.
* @param value The index 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 February 2016
* @since November 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_column_set_index(OBIDMS_column_p column, index_t line_nb, index_t value);
int obi_column_set_index_with_elt_idx(OBIDMS_column_p column, index_t line_nb, index_t element_idx, index_t value);
/**
* @brief Recovers a value in an OBIDMS column containing data with the type OBI_IDX.
* @brief Recovers a value in an OBIDMS column containing indices (stored data type: OBI_IDX),
* using the index of the element in the line.
*
* Note: OBI_IDX columns contain indices referring to data stored elsewhere
* (for example lines in other columns) and contain only one element (index) per line.
* Note: Columns containing indices refer to data stored elsewhere, for example lines in other columns,
* or data stored in indexers.
*
* @param column A pointer as returned by obi_create_column() or obi_clone_column().
* @param line_nb The number of the line where the value should be recovered.
*
* @returns The recovered value.
* @retval OBIIdx_NA the NA value of the type if an error occurred and obi_errno is set.
*
* @since February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
index_t obi_column_get_index(OBIDMS_column_p column, index_t line_nb);
/**
* @brief Recovers a value in an OBIDMS column containing data with the type OBI_IDX.
* The value recovered is the index itself and not the data it is referring to.
*
* @param column A pointer as returned by obi_create_column().
* @param line_nb The number of the line where the value should be recovered.
@@ -81,9 +74,41 @@ index_t obi_column_get_index_with_elt_idx(OBIDMS_column_p column, index_t line_n
/**
* @brief Recovers a value in an OBIDMS column containing data with the type OBI_IDX,
* @brief Sets a value in an OBIDMS column containing indices (stored data type: OBI_IDX),
* using the index of the element in the line.
*
* 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.
*
* @warning Pointers returned by obi_open_column() don't allow writing.
*
* @param column A pointer as returned by obi_create_column() or obi_clone_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 set in the line.
* @param value The index 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_column_set_index_with_elt_name(OBIDMS_column_p column, index_t line_nb, index_t element_idx, index_t value);
/**
* @brief Recovers a value in an OBIDMS column containing indices (stored data type: OBI_IDX),
* using the name of the element in the line.
*
* Note: Columns containing indices refer to data stored elsewhere, for example lines in other columns,
* or data stored in indexers.
*
* The value recovered is the index itself and not the data it is referring to.
*
* @param column A pointer as returned by obi_create_column() or obi_clone_column().
* @param line_nb The number of the line where the value should be recovered.
* @param element_name The name of the element that should be recovered in the line.