Commit 31cf27d6 by Celine Mercier

Added indexer function that returns the name of the indexer

parent baba2d74
......@@ -2217,3 +2217,8 @@ index_t obi_avl_group_add(OBIDMS_avl_group_p avl_group, Obi_blob_p value)
}
const char* obi_avl_group_get_name(OBIDMS_avl_group_p avl_group)
{
return avl_group->name;
}
......@@ -410,5 +410,18 @@ Obi_blob_p obi_avl_group_get(OBIDMS_avl_group_p avl_group, index_t idx);
index_t obi_avl_group_add(OBIDMS_avl_group_p avl_group, Obi_blob_p value);
/**
* @brief Recovers the name of an AVL group.
*
* @param avl_group A pointer on the AVL group structure.
*
* @returns A pointer on the name of the AVL group.
*
* @since April 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
const char* obi_avl_group_get_name(OBIDMS_avl_group_p avl_group);
#endif /* OBIAVL_H_ */
......@@ -36,6 +36,8 @@ inline index_t obi_indexer_add(Obi_indexer_p indexer, Obi_blob_p value);
inline Obi_blob_p obi_indexer_get(Obi_indexer_p indexer, index_t idx);
inline const char* obi_indexer_get_name(Obi_indexer_p indexer);
char* obi_build_indexer_name(const char* column_name, obiversion_t column_version)
{
......
......@@ -160,6 +160,22 @@ inline Obi_blob_p obi_indexer_get(Obi_indexer_p indexer, index_t idx)
/**
* @brief Recovers the name of an indexer.
*
* @param indexer A pointer on the indexer.
*
* @returns A pointer on the name of the indexer.
*
* @since April 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
inline const char* obi_indexer_get_name(Obi_indexer_p indexer)
{
return obi_avl_group_get_name(indexer);
}
/**
* @brief Builds an indexer name in the form columnname_columnversion_indexer.
*
* @warning The returned pointer has to be freed by the caller.
......
......@@ -551,7 +551,7 @@ Obi_indexer_p obi_dms_get_indexer_from_list(OBIDMS_p dms, const char* indexer_na
for (i=0; i < (indexers_list->nb_opened_indexers); i++)
{
if (!strcmp(((indexers_list->indexers)[i])->name, indexer_name)) // TODO get_name function indexer
if (!strcmp(obi_indexer_get_name((indexers_list->indexers)[i]), indexer_name))
{ // Found the indexer already opened, return it
return (indexers_list->indexers)[i];
}
......@@ -577,7 +577,7 @@ int obi_dms_unlist_indexer(OBIDMS_p dms, Obi_indexer_p indexer)
for (i=0; i < indexers_list->nb_opened_indexers; i++)
{
if (!strcmp(((indexers_list->indexers)[i])->name, indexer->name)) // TODO get_name function indexer
if (!strcmp(obi_indexer_get_name((indexers_list->indexers)[i]), indexer->name))
{ // Found the indexer. Rearrange list
(indexers_list->nb_opened_indexers)--;
(indexers_list->indexers)[i] = (indexers_list->indexers)[indexers_list->nb_opened_indexers];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment