2015-05-22 17:54:34 +02:00
|
|
|
/**
|
|
|
|
* @file obitypes.h
|
|
|
|
* @author Celine Mercier
|
|
|
|
* @date 18 May 2015
|
|
|
|
* @brief Header file for the OBITypes.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OBITYPES_H_
|
|
|
|
#define OBITYPES_H_
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2015-05-23 16:50:49 +03:00
|
|
|
#include <unistd.h>
|
2015-05-26 10:38:56 +02:00
|
|
|
#include <stdint.h>
|
2015-05-22 17:54:34 +02:00
|
|
|
|
2015-06-10 15:19:02 +02:00
|
|
|
|
2015-05-22 17:54:34 +02:00
|
|
|
#define OBIInt_NA (INT32_MIN)
|
|
|
|
#define OBIFloat_NA (NAN)
|
|
|
|
#define OBIIdx_NA (SIZE_MAX)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief enum for the boolean OBIType.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
FALSE = 0,
|
|
|
|
TRUE = 1,
|
|
|
|
OBIBool_NA = 2
|
|
|
|
} OBIBool_t, *OBIBool_p; /**< a boolean true/false value */
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2015-06-10 15:19:02 +02:00
|
|
|
* @brief enum OBITypes for the data type of the OBIDMS columns.
|
2015-05-22 17:54:34 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef enum OBIType {
|
|
|
|
OBI_VOID = 0, /**< data type not specified */
|
2015-05-23 16:50:49 +03:00
|
|
|
OBI_INT, /**< a signed integer value (C type : int32_t) */
|
|
|
|
OBI_FLOAT, /**< a floating value (C type : double) */
|
|
|
|
OBI_CHAR, /**< a character (C type : char) */
|
|
|
|
OBI_IDX /**< an index in a data structure (C type : size_t) */
|
2015-05-22 17:54:34 +02:00
|
|
|
} OBIType_t, *OBIType_p;
|
|
|
|
|
|
|
|
typedef int32_t obiint_t;
|
|
|
|
typedef double obifloat_t;
|
|
|
|
typedef char obichar_t;
|
|
|
|
typedef size_t obiidx_t;
|
|
|
|
|
2015-05-23 16:50:49 +03:00
|
|
|
/**
|
|
|
|
* @brief returns the memory size in bytes of an OBIType
|
|
|
|
*
|
|
|
|
* @param type the OBIType code used as query
|
|
|
|
*
|
|
|
|
* @return the size in bytes of the type
|
|
|
|
* @retval 0 on error (unknown type)
|
|
|
|
*
|
|
|
|
* @since May 2015
|
|
|
|
* @author Eric Coissac (eric.coissac@metabarcoding.org)
|
|
|
|
*/
|
|
|
|
size_t obi_sizeof(OBIType_t type);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief returns the size requested to store an array of OBIType
|
|
|
|
*
|
2015-06-10 15:19:02 +02:00
|
|
|
* The returned size is large enough to store an array of size nbelement
|
2015-05-23 16:50:49 +03:00
|
|
|
* but rounded at a multiple of the memory page size.
|
|
|
|
*
|
|
|
|
* @param type the OBIType code used as query
|
2015-06-10 15:19:02 +02:00
|
|
|
* @param nbelement the number of elements to be stored
|
2015-05-23 16:50:49 +03:00
|
|
|
*
|
2015-06-10 15:19:02 +02:00
|
|
|
* @return the size in bytes of the array
|
2015-05-23 16:50:49 +03:00
|
|
|
* @retval 0 on error (unknown type)
|
|
|
|
*
|
|
|
|
* @since May 2015
|
|
|
|
* @author Eric Coissac (eric.coissac@metabarcoding.org)
|
|
|
|
*/
|
2015-07-20 16:08:50 +02:00
|
|
|
size_t obi_array_sizeof(OBIType_t type, size_t nbelements, size_t nb_elements_per_line);
|
2015-05-22 17:54:34 +02:00
|
|
|
|
|
|
|
#endif /* OBITYPES_H_ */
|