obidmscolumn_char.c 1.21 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
/****************************************************************************
 * OBIDMS_column_char functions                                              *
 ****************************************************************************/

/**
 * @file obidsmcolumn_char.c
 * @author Celine Mercier
 * @date August 10th 2015
 * @brief Functions handling OBIColumns containing data with the OBIType OBI_CHAR.
 */


#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_char(OBIDMS_column_p column, size_t line_nb, size_t element_idx, obichar_t* value)
{
	// when/where check if can write?
	*(((obichar_t*) (column->data)) + (line_nb * ((column->header)->nb_elements_per_line)) + element_idx) = value[0];
	return 0;
}


obichar_t* obi_column_get_char(OBIDMS_column_p column, size_t line_nb, size_t element_idx)
{
	return ((obichar_t*) (column->data)) + (line_nb * ((column->header)->nb_elements_per_line)) + element_idx;
}