Functions to get obiblobs through views
This commit is contained in:
@ -25,7 +25,7 @@
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
Obi_blob_p obi_column_get_obiblob_with_elt_idx(OBIDMS_column_p column, index_t line_nb, index_t element_idx)
|
||||
Obi_blob_p obi_column_get_blob_with_elt_idx(OBIDMS_column_p column, index_t line_nb, index_t element_idx)
|
||||
{
|
||||
index_t idx;
|
||||
|
||||
@ -42,12 +42,12 @@ Obi_blob_p obi_column_get_obiblob_with_elt_idx(OBIDMS_column_p column, index_t l
|
||||
}
|
||||
|
||||
|
||||
Obi_blob_p obi_column_get_obiblob_with_elt_name(OBIDMS_column_p column, index_t line_nb, const char* element_name)
|
||||
Obi_blob_p obi_column_get_blob_with_elt_name(OBIDMS_column_p column, index_t line_nb, const char* element_name)
|
||||
{
|
||||
index_t element_idx = obi_column_get_element_index_from_name(column, element_name);
|
||||
if (element_idx == OBIIdx_NA)
|
||||
return OBIBlob_NA;
|
||||
|
||||
return obi_column_get_obiblob_with_elt_idx(column, line_nb, element_idx);
|
||||
return obi_column_get_blob_with_elt_idx(column, line_nb, element_idx);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* @since November 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
Obi_blob_p obi_column_get_obiblob_with_elt_idx(OBIDMS_column_p column, index_t line_nb, index_t element_idx);
|
||||
Obi_blob_p obi_column_get_blob_with_elt_idx(OBIDMS_column_p column, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ Obi_blob_p obi_column_get_obiblob_with_elt_idx(OBIDMS_column_p column, index_t l
|
||||
* @since November 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
Obi_blob_p obi_column_get_obiblob_with_elt_name(OBIDMS_column_p column, index_t line_nb, const char* element_name);
|
||||
Obi_blob_p obi_column_get_blob_with_elt_name(OBIDMS_column_p column, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
#endif /* OBIDMSCOLUMN_BLOB_H_ */
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "obidms.h"
|
||||
#include "obidmscolumn.h"
|
||||
#include "obidmscolumn_idx.h"
|
||||
#include "obidmscolumn_blob.h"
|
||||
#include "obidmscolumn_bool.h"
|
||||
#include "obidmscolumn_char.h"
|
||||
#include "obidmscolumn_float.h"
|
||||
@ -32,6 +33,7 @@
|
||||
#include "obilittlebigman.h"
|
||||
#include "hashtable.h"
|
||||
#include "utils.h"
|
||||
#include "obiblob.h"
|
||||
|
||||
|
||||
#define DEBUG_LEVEL 0 // TODO has to be defined somewhere else (cython compil flag?)
|
||||
@ -2000,6 +2002,44 @@ int obi_save_and_close_view(Obiview_p view)
|
||||
}
|
||||
|
||||
|
||||
/*********** FOR BLOB COLUMNS ***********/
|
||||
|
||||
Obi_blob_p obi_get_blob_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx)
|
||||
{
|
||||
if (prepare_to_get_value_from_column(view, &line_nb) < 0)
|
||||
return OBIBlob_NA;
|
||||
return obi_column_get_blob_with_elt_idx(column_p, line_nb, element_idx);
|
||||
}
|
||||
|
||||
|
||||
Obi_blob_p obi_get_blob_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name)
|
||||
{
|
||||
index_t element_idx = obi_column_get_element_index_from_name(column_p, element_name);
|
||||
if (element_idx == OBIIdx_NA)
|
||||
return OBIBlob_NA;
|
||||
return obi_get_blob_with_elt_idx_and_col_p_in_view(view, column_p, line_nb, element_idx);
|
||||
}
|
||||
|
||||
|
||||
Obi_blob_p obi_get_blob_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx)
|
||||
{
|
||||
OBIDMS_column_p column_p;
|
||||
column_p = obi_view_get_column(view, column_name);
|
||||
if (column_p == NULL)
|
||||
return OBIBlob_NA;
|
||||
return obi_get_blob_with_elt_idx_and_col_p_in_view(view, column_p, line_nb, element_idx);
|
||||
}
|
||||
|
||||
|
||||
Obi_blob_p obi_get_blob_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name)
|
||||
{
|
||||
OBIDMS_column_p column_p;
|
||||
column_p = obi_view_get_column(view, column_name);
|
||||
if (column_p == NULL)
|
||||
return OBIBlob_NA;
|
||||
return obi_get_blob_with_elt_name_and_col_p_in_view(view, column_p, line_nb, element_name);
|
||||
}
|
||||
|
||||
/*********** FOR BOOL COLUMNS ***********/
|
||||
|
||||
int obi_set_bool_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx, obibool_t value)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "obidmscolumn.h"
|
||||
#include "obierrno.h"
|
||||
#include "hashtable.h"
|
||||
#include "obiblob.h"
|
||||
|
||||
|
||||
#define OBIVIEW_NAME_MAX_LENGTH (249) /**< The maximum length of an OBIDMS view name, without the extension.
|
||||
@ -490,6 +491,48 @@ int obi_close_view(Obiview_p view);
|
||||
int obi_save_and_close_view(Obiview_p view);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Recovers an obiblob from an OBIDMS column containing indices referring to obiblobs, in the context of a view.
|
||||
*
|
||||
* @param view A pointer on the opened view.
|
||||
* @param column_p A pointer on the 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.
|
||||
*
|
||||
* @returns The recovered obiblob.
|
||||
* @retval OBIBlob_NA the NA value of the type if an error occurred and obi_errno is set.
|
||||
*
|
||||
* @since November 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
Obi_blob_p obi_get_blob_with_elt_idx_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, index_t element_idx);
|
||||
|
||||
// TODO
|
||||
Obi_blob_p obi_get_blob_with_elt_idx_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, index_t element_idx);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Recovers an obiblob from an OBIDMS column containing indices referring to obiblobs,
|
||||
* using the name of the element in the line, in the context of a view.
|
||||
*
|
||||
* @param view A pointer on the opened view.
|
||||
* @param column_p A pointer on the 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.
|
||||
*
|
||||
* @returns The recovered obiblob.
|
||||
* @retval OBIBlob_NA the NA value of the type if an error occurred and obi_errno is set.
|
||||
*
|
||||
* @since November 2016
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
Obi_blob_p obi_get_blob_with_elt_name_and_col_p_in_view(Obiview_p view, OBIDMS_column_p column_p, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
// TODO
|
||||
Obi_blob_p obi_get_blob_with_elt_name_and_col_name_in_view(Obiview_p view, const char* column_name, index_t line_nb, const char* element_name);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Sets a value in an OBIDMS column containing data with the type OBI_BOOL, using the index of the element in the line,
|
||||
* in the context of a view.
|
||||
|
Reference in New Issue
Block a user