Major changes : new cython subclasses to handle columns with multiple

elements per line in a more efficient way + now elements_names are
passed as a list + new function to recover only the header of a column
This commit is contained in:
Celine Mercier
2015-10-14 18:05:34 +02:00
parent 21923e213d
commit 0eaa5aa784
22 changed files with 749 additions and 516 deletions

View File

@ -72,27 +72,10 @@ obiint_t obi_column_get_obiint_with_elt_idx(OBIDMS_column_p column, size_t line_
int obi_column_set_obiint_with_elt_name(OBIDMS_column_p column, size_t line_nb, const char* element_name, obiint_t value)
{
size_t element_idx;
if (!strcmp(element_name, "\0")) // element name is empty
{
if (obi_column_get_nb_elements_per_line(column) == 1) // check that there is only one element per line
element_idx = 0;
else // there is more than one element per line
{
obi_set_errno(OBICOL_UNKNOWN_ERROR);
obidebug(1, "\nAn element name must be specified");
return -1;
}
}
else
{
element_idx = obi_column_get_element_index_from_name(column, element_name);
if (element_idx == SIZE_MAX) //TODO
return -1;
}
element_idx = obi_column_get_element_index_from_name(column, element_name);
if (element_idx == SIZE_MAX) //TODO
return -1;
obi_column_set_obiint_with_elt_idx(column, line_nb, element_idx, value);
return 0;
}
@ -101,24 +84,9 @@ obiint_t obi_column_get_obiint_with_elt_name(OBIDMS_column_p column, size_t line
{
size_t element_idx;
if (!strcmp(element_name, "\0")) // element name is empty
{
if (obi_column_get_nb_elements_per_line(column) == 1) // check that there is only one element per line
element_idx = 0;
else // there is more than one element per line
{
obi_set_errno(OBICOL_UNKNOWN_ERROR);
obidebug(1, "\nAn element name must be specified");
return OBIInt_NA;
}
}
else
{
element_idx = obi_column_get_element_index_from_name(column, element_name);
if (element_idx == SIZE_MAX) //TODO
return OBIInt_NA;
}
element_idx = obi_column_get_element_index_from_name(column, element_name);
if (element_idx == SIZE_MAX) //TODO
return OBIInt_NA;
return obi_column_get_obiint_with_elt_idx(column, line_nb, element_idx);
}