uint8_indexer.h 2.41 KB
Newer Older
1
/****************************************************************************
2
 * uint8 indexer header file	                                            *
3 4 5
 ****************************************************************************/

/**
6
 * @file uint8_indexer.h
7
 * @author Celine Mercier
8 9
 * @date May 4th 2016
 * @brief Header file for the functions handling the indexing of uint8 arrays.
10 11 12
 */


13 14
#ifndef UINT8_INDEXER_H_
#define UINT8_INDEXER_H_
15 16 17 18 19 20 21 22 23 24 25 26


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

#include "obidms.h"
#include "obitypes.h"
#include "obiblob.h"
#include "obiblob_indexer.h"


/**
27
 * @brief Converts an uint8 array to a blob.
28 29 30
 *
 * @warning The blob must be freed by the caller.
 *
31 32
 * @param value The uint8 array to convert.
 * @param value_length The length of the uint8 array to convert.
33
 *
34
 * @returns A pointer on the blob created.
35 36
 * @retval NULL if an error occurred.
 *
37
 * @since May 2016
38 39
 * @author Celine Mercier (celine.mercier@metabarcoding.org)
 */
40
Obi_blob_p obi_uint8_to_blob(const uint8_t* value, int value_length);
41 42 43


/**
44 45 46
 * @brief Converts a blob to an uint8 array.
 *
 * @warning The array returned is mapped.
47 48 49
 *
 * @param value_b The blob to convert.
 *
50
 * @returns A pointer on the uint8 array contained in the blob.
51 52
 * @retval NULL if an error occurred.
 *
53
 * @since May 2016
54 55
 * @author Celine Mercier (celine.mercier@metabarcoding.org)
 */
56
const uint8_t* obi_blob_to_uint8(Obi_blob_p value_b);
57 58 59


/**
60
 * @brief Stores an uint8 array in an indexer and returns the index.
61 62
 *
 * @param indexer The indexer structure.
63 64
 * @param value The uint8 array to index.
 * @param value_length The length of the uint8 array to index.
65
 *
66
 * @returns The index referring to the stored uint8 array in the indexer.
67
 *
68
 * @since May 2016
69 70
 * @author Celine Mercier (celine.mercier@metabarcoding.org)
 */
71
index_t obi_index_uint8(Obi_indexer_p indexer, const uint8_t* value, int value_length);
72 73 74


/**
75
 * @brief Retrieves an uint8 array from an indexer.
76
 *
77
 * @warning The array returned is mapped.
78 79
 *
 * @param indexer The indexer structure.
80 81
 * @param idx The index referring to the uint8 array to retrieve in the indexer.
 * @param value_length A pointer on an integer to store the length of the array retrieved.
82
 *
83
 * @returns A pointer on the uint8 array.
84
 *
85
 * @since May 2016
86 87
 * @author Celine Mercier (celine.mercier@metabarcoding.org)
 */
88
const uint8_t* obi_retrieve_uint8(Obi_indexer_p indexer, index_t idx, int* value_length);
89 90


91
#endif /* UINT8_INDEXER_H_ */
92