obierrno.h 6.18 KB
Newer Older
1 2 3 4 5 6 7 8 9
/****************************************************************************
 * Header file for obi errnos                                               *
 ****************************************************************************/

/**
 * @file obierrno.h
 * @author Eric Coissac (eric.coissac@metabarcoding.org)
 * @date 23 May 2015
 * @brief Header file for obi errnos.
10 11
 */

12

13 14 15
#ifndef OBIERRNO_H_
#define OBIERRNO_H_

16

17 18 19
/**
 * @brief The declaration of the external variable `obi_errno`.
 *
20
 * `obi_errno` is an equivalent of `errno` for the system level error,
21
 * but for errors generated by the C layer of the OBITools3 framework.
22
 *
23
 * @TODO We have to look into defining this variable as thread specific.
24 25 26
 */
extern int obi_errno;

27

28
/**
29
 * @brief Sets the global `obi_errno` variable with
30 31 32
 *        the specified `err` code
 *
 * This function is defined as a macro to reduce the risk
33 34
 * of increasing the problem by generating another error by calling
 * another function.
35
 *
36
 * @param err The error code as an integer value.
37 38 39 40 41 42
 *
 * @since May 2015
 * @author Eric Coissac (eric.coissac@metabarcoding.org)
 */
#define obi_set_errno(err) (obi_errno = (err))

43 44 45 46 47 48 49

/**
 * @defgroup OBIDMSErrors OBIDMS related error codes
 *
 * Error codes set in errno following an error related
 * to the manipulation of an OBIDMS.
 *
50 51
 * @TODO
 *
52 53
 * @{
 */
54 55 56 57 58 59 60 61 62 63 64 65 66 67
#define OBIDMS_EXIST_ERROR     		(1) 	/**< Trying to create an OBIDMS with a name
                                    		 *   that corresponds to an existing one
                                    		 */
#define OBIDMS_NOT_EXIST_ERROR 		(2) 	/**< Trying to open a non-existing OBIDMS
                                    		 */
#define OBIDMS_LONG_NAME_ERROR 		(3) 	/**< The specified OBIDMS name is too long
                                    		 */
#define OBIDMS_MEMORY_ERROR    		(4) 	/**< A memory error occurred during allocation while handling
											 *   an OBIDMS
                                    		 */
#define OBIDMS_UNKNOWN_ERROR   		(5) 	/**< Undetermined error while handling an OBIDMS
                                    		 */
#define OBIDMS_ACCESS_ERROR    		(6) 	/**< Permission error trying to access the database
                                    		 */
68 69 70
#define OBIDMS_BAD_ENDIAN_ERROR   	(7) 	/**< The opened database does not correspond
                                    		 *   to the endianness of the platform.
                                    		 */
71

72
#define OBICOLDIR_EXIST_ERROR     	(8) 	/**< Trying to create an OBIDMS column directory with a name
73 74
                                    		 *   that corresponds to an existing one
                                    		 */
75
#define OBICOLDIR_NOT_EXIST_ERROR 	(9) 	/**< Trying to open a non-existing OBIDMS column directory
76
                                    		 */
77
#define OBICOLDIR_LONG_NAME_ERROR 	(10) 	/**< The specified OBIDMS column directory name is too long
78
                                    		 */
79
#define OBICOLDIR_MEMORY_ERROR    	(11) 	/**< A memory error occurred during allocation while handling
80 81
											 *	 an OBIDMS column directory
                                    	 	 */
82
#define OBICOLDIR_UNKNOWN_ERROR   	(12) 	/**< Undetermined error while handling an OBIDMS column directory
83
                                    	 	 */
84
#define OBICOLDIR_ACCESS_ERROR    	(13) 	/**< Permission error trying to access an OBIDSM column directory
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
                                    		 */

#define OBICOL_EXIST_ERROR     		(14) 	/**< Trying to create an OBIDMS column with a name
                                    		 *   that corresponds to an existing one
                                    		 */
#define OBICOL_NOT_EXIST_ERROR  	(15) 	/**< Trying to open a non-existing OBIDMS column directory
                                    		 */
#define OBICOL_LONG_NAME_ERROR 	    (16) 	/**< The specified OBIDMS column directory name is too long
                                    		 */
#define OBICOL_MEMORY_ERROR    		(17) 	/**< A memory error occurred during allocation while handling
											 *	 an OBIDMS column directory
                                    	 	 */
#define OBICOL_UNKNOWN_ERROR   		(18) 	/**< Undetermined error while handling an OBIDMS column directory
                                    	 	 */
#define OBICOL_ACCESS_ERROR    		(19) 	/**< Permission error trying to access an OBIDSM column directory
                                    		 */
Celine Mercier committed
101
#define OBI_AVL_ERROR				(20)    /** Error while handling an AVL tree	// TODO delete and just keep OBI_INDEXER_ERROR?
102
											 */
Celine Mercier committed
103 104
#define OBIVIEW_ERROR				(21)    /** Error while handling an OBIView
											 */
105 106
#define OBI_TAXONOMY_ERROR			(22)    /** Error while handling binary taxonomy files
 	 	 	 	 	 	 	 	 	 	 	 */
107 108 109 110 111 112
#define OBI_MALLOC_ERROR			(23)    /** Error while allocating memory
 	 	 	 	 	 	 	 	 	 	 	 */
#define OBI_ENCODE_ERROR			(24)    /** Error while encoding a value
 	 	 	 	 	 	 	 	 	 	 	 */
#define OBI_DECODE_ERROR			(25)    /** Error while decoding a value
 	 	 	 	 	 	 	 	 	 	 	 */
Celine Mercier committed
113
#define OBI_UTILS_ERROR				(26)    /** Error in an utils function
114
	 	 	 	 	 	 	 	 	 	 	 */
Celine Mercier committed
115 116
#define OBI_INDEXER_ERROR			(27)    /** Error handling a blob indexer
											 */
Celine Mercier committed
117
#define OBI_READ_ONLY_INDEXER_ERROR (28)    /** Error trying to modify a read-only blob indexer
118 119
											 */
#define OBI_ALIGN_ERROR				(29)    /** Error while aligning sequences
120
 	 	 	 	 	 	 	 	 	 	 	 */
121 122 123 124
#define OBI_LINE_IDX_ERROR          (30)    /** Error setting or getting a value at a forbidden line index (greater than the line count of the view or the column)
											 */
#define OBI_ELT_IDX_ERROR           (31)    /** Error setting or getting a value at a non-existent element index or with a non-existent element name
											 */
125 126
#define OBI_CLEAN_ERROR				(32)    /** Error while cleaning sequences
 	 	 	 	 	 	 	 	 	 	 	 */
Celine Mercier committed
127 128
#define OBI_ECOPCR_ERROR    		(33)    /** Error while performing an in silico PCR
 	 	 	 	 	 	 	 	 	 	 	 */
129 130
#define OBI_JSON_ERROR       		(34)    /** Error related to JSON operations.
 	 	 	 	 	 	 	 	 	 	 	 */
131 132
#define OBIVIEW_ALREADY_EXISTS_ERROR (35)   /** Tried to create a new view with a name already existing in the DMS.
											 */
133 134
#define OBI_ECOTAG_ERROR (36)   			/** Tried to create a new view with a name already existing in the DMS.
											 */
135 136
/**@}*/

137
#endif /* OBIERRNO_H_ */