Columns: implemented handling of JSON formatted comments
This commit is contained in:
@ -38,7 +38,7 @@
|
||||
*/
|
||||
#define MAXIMUM_LINE_COUNT (1000000000) /**< The maximum line count for the data of a column (1E9). //TODO
|
||||
*/
|
||||
#define COMMENTS_MAX_LENGTH (2048) /**< The maximum length for comments.
|
||||
#define COMMENTS_MAX_LENGTH (4096) /**< The maximum length for comments.
|
||||
*/
|
||||
#define FORMATTED_ELT_NAMES_SEPARATOR '\0' /**< The separator between elements names once formatted to be stored in columns.
|
||||
*/
|
||||
@ -256,7 +256,7 @@ size_t obi_calculate_header_size(index_t nb_elements_per_line, int64_t elts_name
|
||||
* If NULL or "", the indexer name is set as the column name.
|
||||
* @param associated_column_name The name of the associated column if there is one (otherwise NULL or "").
|
||||
* @param associated_column_version The version of the associated column if there is one (otherwise -1).
|
||||
* @param comments Optional comments associated with the column (NULL or "" if no comments associated).
|
||||
* @param comments Optional comments associated with the column in JSON format (NULL, "" or "{}" if no comments associated).
|
||||
*
|
||||
* @returns A pointer on the newly created column structure.
|
||||
* @retval NULL if an error occurred.
|
||||
@ -372,6 +372,43 @@ int obi_truncate_column(OBIDMS_column_p column);
|
||||
int obi_enlarge_column(OBIDMS_column_p column);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Writes comments to a column file.
|
||||
*
|
||||
* @warning This overwrites any other previous comments.
|
||||
*
|
||||
* @param column A pointer on an OBIDMS column.
|
||||
* @param comments A character string containing the comments.
|
||||
*
|
||||
* @retval 0 if the operation was successfully completed.
|
||||
* @retval -1 if an error occurred.
|
||||
*
|
||||
* @since August 2018
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_write_comments(OBIDMS_column_p column, const char* comments);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Adds comments to a column file.
|
||||
*
|
||||
* This reads the comments in the JSON format and adds the key value pair.
|
||||
* If the key already exists, the value format is turned to array and the new value is appended
|
||||
* if it is not already in the array.
|
||||
*
|
||||
* @param column A pointer on an OBIDMS column.
|
||||
* @param key The key.
|
||||
* @param value The value associated with the key.
|
||||
*
|
||||
* @retval 0 if the operation was successfully completed.
|
||||
* @retval -1 if an error occurred.
|
||||
*
|
||||
* @since August 2018
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int obi_column_add_comment(OBIDMS_column_p column, const char* key, const char* value);
|
||||
|
||||
|
||||
/*
|
||||
* @brief Sets the data in a column to the specified value.
|
||||
*
|
||||
|
Reference in New Issue
Block a user