Commit 767d9c78 by Celine Mercier

Reordered view functions for better coherence

parent 2566377e
......@@ -292,35 +292,6 @@ Obiview_p obi_open_view(OBIDMS_p dms, const char* view_name);
/**
* @brief Opens the structure containing all the informations written in the view file.
*
* @param dms A pointer on the OBIDMS to which the view file belongs.
*
* @returns A pointer on the view informations structure.
* @retval NULL if an error occurred.
*
* @since February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
Obiviews_infos_all_p obi_read_view_infos(OBIDMS_p dms);
/**
* @brief Closes the structure containing all the informations written in the view file.
*
* @param views A pointer on the view informations structure.
*
* @returns A value indicating the success of the operation.
* @retval 0 if the operation was successfully completed.
* @retval -1 if an error occurred.
*
* @since February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_close_view_infos(Obiviews_infos_all_p views);
/**
* @brief Adds a column to a view.
*
* @warning The view must be writable.
......@@ -356,6 +327,24 @@ int obi_view_add_column(Obiview_p view,
/**
* @brief Clones a column in the context of a view.
*
* Clones with the right line selection and replaces the cloned columns with the new ones in the view.
* If there is a line selection, all columns have to be cloned, otherwise only the column of interest is cloned.
*
* @param view A pointer on the view.
* @param column_name The name of the column in the view that should be cloned.
*
* @returns A pointer on the new column.
* @retval NULL if an error occurred.
*
* @since February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
OBIDMS_column_p obi_view_clone_column(Obiview_p view, const char* column_name);
/**
* @brief Deletes a column from a view.
*
* @warning The view must be writable.
......@@ -374,6 +363,38 @@ int obi_view_delete_column(Obiview_p view, const char* column_name);
/**
* @brief Gets the pointer on a column from its name in a view.
*
* @param view A pointer on the view.
* @param column_name The name of the column in the view.
*
* @returns A pointer on the column.
* @retval NULL if an error occurred.
*
* @since February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
OBIDMS_column_p obi_view_get_column(Obiview_p view, const char* column_name);
/**
* @brief Gets the pointer on the pointer on a column from its name in a view.
*
* Note: This is used to replace old cloned columns with new ones in views in layers above the C layer.
*
* @param view A pointer on the view.
* @param column_name The name of the column in the view.
*
* @returns A pointer on the pointer on the column.
* @retval NULL if an error occurred.
*
* @since February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
OBIDMS_column_p* obi_view_get_pointer_on_column_in_view(Obiview_p view, const char* column_name);
/**
* @brief Selects a line in the context of a view.
*
* If no line selection exists for the view, it will be created.
......@@ -439,61 +460,43 @@ int obi_view_update_lines(Obiview_p view, index_t line_count);
/**
* @brief Clones a column in the context of a view.
*
* Clones with the right line selection and replaces the cloned columns with the new ones in the view.
* If there is a line selection, all columns have to be cloned, otherwise only the column of interest is cloned.
*
* @param view A pointer on the view.
* @param column_name The name of the column in the view that should be cloned.
* @brief Saves a view, writing it in the view file.
*
* @returns A pointer on the new column.
* @retval NULL if an error occurred.
* The view is written at the end of the view file, following the latest written view.
*
* @since February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
OBIDMS_column_p obi_view_clone_column(Obiview_p view, const char* column_name);
/**
* @brief Gets the pointer on a column from its name in a view.
* @warning The view must be writable.
*
* @param view A pointer on the view.
* @param column_name The name of the column in the view.
*
* @returns A pointer on the column.
* @retval NULL if an error occurred.
* @returns A value indicating the success of the operation.
* @retval 0 if the operation was successfully completed.
* @retval -1 if an error occurred.
*
* @since February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
OBIDMS_column_p obi_view_get_column(Obiview_p view, const char* column_name);
int obi_save_view(Obiview_p view);
/**
* @brief Gets the pointer on the pointer on a column from its name in a view.
* @brief Closes an opened view.
*
* Note: This is used to replace old cloned columns with new ones in views in layers above the C layer.
* @warning Use obi_save_and_close_view() to automatically save the view if it's not already saved in the view file.
*
* @param view A pointer on the view.
* @param column_name The name of the column in the view.
*
* @returns A pointer on the pointer on the column.
* @retval NULL if an error occurred.
* @returns A value indicating the success of the operation.
* @retval 0 if the operation was successfully completed.
* @retval -1 if an error occurred.
*
* @since February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
OBIDMS_column_p* obi_view_get_pointer_on_column_in_view(Obiview_p view, const char* column_name);
int obi_close_view(Obiview_p view);
/**
* @brief Saves a view, writing it in the view file.
*
* The view is written at the end of the view file, following the latest written view.
*
* @warning The view must be writable.
* @brief Closes an opened view, and saves it if it is not read-only (meaning it is not already saved in the view file).
*
* @param view A pointer on the view.
*
......@@ -504,30 +507,27 @@ OBIDMS_column_p* obi_view_get_pointer_on_column_in_view(Obiview_p view, const ch
* @since February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_save_view(Obiview_p view);
int obi_save_and_close_view(Obiview_p view);
/**
* @brief Closes an opened view.
*
* @warning Use obi_save_and_close_view() to automatically save the view if it's not already saved in the view file.
* @brief Opens the structure containing all the informations written in the view file.
*
* @param view A pointer on the view.
* @param dms A pointer on the OBIDMS to which the view file belongs.
*
* @returns A value indicating the success of the operation.
* @retval 0 if the operation was successfully completed.
* @retval -1 if an error occurred.
* @returns A pointer on the view informations structure.
* @retval NULL if an error occurred.
*
* @since February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_close_view(Obiview_p view);
Obiviews_infos_all_p obi_read_view_infos(OBIDMS_p dms);
/**
* @brief Closes an opened view, and saves it if it is not read-only (meaning it is not already saved in the view file).
* @brief Closes the structure containing all the informations written in the view file.
*
* @param view A pointer on the view.
* @param views A pointer on the view informations structure.
*
* @returns A value indicating the success of the operation.
* @retval 0 if the operation was successfully completed.
......@@ -536,7 +536,7 @@ int obi_close_view(Obiview_p view);
* @since February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_save_and_close_view(Obiview_p view);
int obi_close_view_infos(Obiviews_infos_all_p views);
// TODO in following functions would it be better to use column names instead of column pointers?
......
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