obidmscolumn_char.h 3.51 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/****************************************************************************
 * OBIDMS_column_char header file                                            *
 ****************************************************************************/

/**
 * @file obidsmcolumn_char.h
 * @author Celine Mercier
 * @date August 10th 2015
 * @brief Header file for the functions handling OBIColumns containing data with the OBIType OBI_CHAR.
 */


#include <stdlib.h>
#include <stdio.h>

#include "obidmscolumn.h"
#include "obitypes.h"


/**
21
 * @brief Sets a value in an OBIDMS column containing data with the type OBI_CHAR, using the index of the element in the line.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
 *
 * @param column a pointer as returned by obi_create_column()
 * @warning Pointers returned by obi_open_column() don't allow writing.
 *
 * @param line_nb the number of the line where the value should be set
 *
 * @param element_idx the index of the element that should be set in the line
 *
 * @param value the value that should be set
 *
 * @return an integer value indicating the success of the operation.
 *
 * @retvalue 0 on success
 * @retvalue -1 on failure and the `obi_errno` variable is set.
 *
37
 * @since July 2015
38 39
 * @author Celine Mercier (celine.mercier@metabarcoding.org)
 */
40
int obi_column_set_char_with_elt_idx(OBIDMS_column_p column, size_t line_nb, size_t element_idx, obichar_t* value);
41 42 43 44 45 46 47 48 49 50 51 52 53


/**
 * @brief Recovers a value in an OBIDMS column containing data with the type OBI_CHAR.
 *
 * @param column a pointer as returned by obi_create_column()
 *
 * @param line_nb the number of the line where the value should be recovered
 *
 * @param element_idx the index of the element that should be recovered in the line
 *
 * @return the recovered value
 *
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
 * @since July 2015
 * @author Celine Mercier (celine.mercier@metabarcoding.org)
 */
obichar_t* obi_column_get_char_with_elt_idx(OBIDMS_column_p column, size_t line_nb, size_t element_idx);


/**
 * @brief Sets a value in an OBIDMS column containing data with the type OBI_CHAR, using the name of the element in the line.
 *
 * @param column a pointer as returned by obi_create_column()
 * @warning Pointers returned by obi_open_column() don't allow writing.
 *
 * @param line_nb the number of the line where the value should be set
 *
 * @param element_name the name of the element that should be set in the line
 * If empty, it is checked that there is only one element per line
 *
 * @param value the value that should be set
 *
 * @return an integer value indicating the success of the operation.
 *
 * @retvalue 0 on success
 * @retvalue -1 on failure and the `obi_errno` variable is set.
 *
78 79 80
 * @since August 2015
 * @author Celine Mercier (celine.mercier@metabarcoding.org)
 */
81 82
int obi_column_set_char_with_elt_name(OBIDMS_column_p column, size_t line_nb, char* element_name, obichar_t* value);

83

84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
/**
 * @brief Recovers a value in an OBIDMS column containing data with the type OBI_CHAR, using the name of the element in the line.
 *
 * @param column a pointer as returned by obi_create_column()
 *
 * @param line_nb the number of the line where the value should be recovered
 *
 * @param element_name the name of the element that should be recovered in the line
 * If empty, it is checked that there is only one element per line
 *
 * @return the recovered value
 * @retvalue NULL on failure and the `obi_errno` variable is set. TODO an other value should be chosen maybe
 *
 * @since August 2015
 * @author Celine Mercier (celine.mercier@metabarcoding.org)
 */
obichar_t* obi_column_get_char_with_elt_name(OBIDMS_column_p column, size_t line_nb, char* element_name);
101