Files
obitools3/src/obidmscolumn_idx.c

47 lines
1.1 KiB
C
Raw Normal View History

2016-02-18 10:38:51 +01:00
/****************************************************************************
* OBIDMS_column_idx functions *
****************************************************************************/
/**
* @file obidsmcolumn_idx.c
* @author Celine Mercier
* @date February 14th 2016
* @brief Functions handling OBIColumns containing data with the index_t type.
*/
#include <stdlib.h>
#include <stdio.h>
#include "obidmscolumn.h"
#include "obitypes.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_index(OBIDMS_column_p column, index_t line_nb, index_t value)
{
if (obi_column_prepare_to_set_value(column, line_nb) < 0)
return -1;
2016-02-18 10:38:51 +01:00
// Set the value
*(((index_t*) (column->data)) + line_nb) = value;
return 0;
}
index_t obi_column_get_index(OBIDMS_column_p column, index_t line_nb)
{
if (obi_column_prepare_to_get_value(column, line_nb) < 0)
2016-02-18 10:38:51 +01:00
return OBIIdx_NA;
return *(((index_t*) (column->data)) + line_nb);
}