The number of lines used is updated in the header when a value is set,
and the iteration on the values of a column is done on the number of lines used (instead of on the total line count).
This commit is contained in:
@ -1089,6 +1089,12 @@ size_t obi_column_get_line_count(OBIDMS_column_p column)
|
||||
}
|
||||
|
||||
|
||||
size_t obi_column_get_nb_lines_used(OBIDMS_column_p column)
|
||||
{
|
||||
return (column->header)->lines_used;
|
||||
}
|
||||
|
||||
|
||||
OBIType_t obi_column_get_data_type(OBIDMS_column_p column)
|
||||
{
|
||||
return (column->header)->data_type;
|
||||
|
@ -243,6 +243,19 @@ void obi_column_make_unwritable(OBIDMS_column_p column);
|
||||
size_t obi_column_get_line_count(OBIDMS_column_p column);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Recovers the number of lines used in an OBIDMS column.
|
||||
*
|
||||
* @param column a pointer on an OBIDMS column
|
||||
*
|
||||
* @return the number of lines used in the column
|
||||
*
|
||||
* @since August 2015
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
size_t obi_column_get_nb_lines_used(OBIDMS_column_p column);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Recovers the data type of an OBIDMS column.
|
||||
*
|
||||
|
@ -30,7 +30,9 @@
|
||||
|
||||
int obi_column_set_bool_with_elt_idx(OBIDMS_column_p column, size_t line_nb, size_t element_idx, obibool_t value)
|
||||
{
|
||||
// when/where check if can write?
|
||||
// Update lines used
|
||||
if ((line_nb+1) > (column->header)->lines_used)
|
||||
(column->header)->lines_used = line_nb+1;
|
||||
*(((obibool_t*) (column->data)) + (line_nb * ((column->header)->nb_elements_per_line)) + element_idx) = value;
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,7 +30,9 @@
|
||||
|
||||
int obi_column_set_char_with_elt_idx(OBIDMS_column_p column, size_t line_nb, size_t element_idx, obichar_t* value)
|
||||
{
|
||||
// when/where check if can write?
|
||||
// Update lines used
|
||||
if ((line_nb+1) > (column->header)->lines_used)
|
||||
(column->header)->lines_used = line_nb+1;
|
||||
*(((obichar_t*) (column->data)) + (line_nb * ((column->header)->nb_elements_per_line)) + element_idx) = value[0];
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,7 +30,9 @@
|
||||
|
||||
int obi_column_set_float_with_elt_idx(OBIDMS_column_p column, size_t line_nb, size_t element_idx, obifloat_t value)
|
||||
{
|
||||
// when/where check if can write?
|
||||
// Update lines used
|
||||
if ((line_nb+1) > (column->header)->lines_used)
|
||||
(column->header)->lines_used = line_nb+1;
|
||||
*(((obifloat_t*) (column->data)) + (line_nb * ((column->header)->nb_elements_per_line)) + element_idx) = value;
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,7 +30,9 @@
|
||||
|
||||
int obi_column_set_idx_with_elt_idx(OBIDMS_column_p column, size_t line_nb, size_t element_idx, obiidx_t value)
|
||||
{
|
||||
// when/where check if can write?
|
||||
// Update lines used
|
||||
if ((line_nb+1) > (column->header)->lines_used)
|
||||
(column->header)->lines_used = line_nb+1;
|
||||
*(((obiidx_t*) (column->data)) + (line_nb * ((column->header)->nb_elements_per_line)) + element_idx) = value;
|
||||
return 0;
|
||||
}
|
||||
|
@ -30,7 +30,9 @@
|
||||
|
||||
int obi_column_set_int_with_elt_idx(OBIDMS_column_p column, size_t line_nb, size_t element_idx, obiint_t value)
|
||||
{
|
||||
// when/where check if can write?
|
||||
// Update lines used
|
||||
if ((line_nb+1) > (column->header)->lines_used)
|
||||
(column->header)->lines_used = line_nb+1;
|
||||
*(((obiint_t*) (column->data)) + (line_nb * ((column->header)->nb_elements_per_line)) + element_idx) = value;
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user