C sources modified to add the handling of OBIDM columns with the type

OBI_INT, and the handling of multiple types in general
This commit is contained in:
celinemercier
2015-07-31 18:03:48 +02:00
parent a6abc74500
commit 5f62cd8526
6 changed files with 684 additions and 10 deletions

49
src/obidmscolumn_int.c Normal file
View File

@ -0,0 +1,49 @@
/****************************************************************************
* OBIDMS_column_int functions *
****************************************************************************/
/**
* @file obidsmcolumn_int.c
* @author Celine Mercier
* @date July 21st 2015
* @brief Functions handling OBIColumns containing data with the OBIType OBI_INT.
*/
#include <stdlib.h>
#include <stdio.h>
#include "obidmscolumn.h"
#include "obitypes.h"
#include "obierrno.h"
#include "obidebug.h"
/**********************************************************************
*
* D E F I N I T I O N O F T H E P U B L I C F U N C T I O N S
*
**********************************************************************/
int obi_column_set_int(OBIDMS_column_p column, size_t line_nb, size_t element_idx, obiint_t value)
{
// check if can write?
size_t nb_elements_per_line = -1;
nb_elements_per_line = (column->header)->nb_elements_per_line;
*(((obiint_t*) (column->data)) + (line_nb * nb_elements_per_line) + element_idx) = value;
return 0;
}
obiint_t obi_column_get_int(OBIDMS_column_p column, size_t line_nb, size_t element_idx)
{
size_t nb_elements_per_line = -1;
nb_elements_per_line = (column->header)->nb_elements_per_line;
return *(((obiint_t*) (column->data)) + (line_nb * nb_elements_per_line) + element_idx);
}
//obiint_t* obi_column_get_line_address_int(OBIDMS_column_p column, size_t nb_elements_per_line, size_t line_nb)
//{
// return (((obiint_t*) (column->data)) + (line_nb * nb_elements_per_line));
//}