Added the possibility to clone a column, with or without its data

This commit is contained in:
Celine Mercier
2015-08-26 10:29:07 +02:00
parent e6d96d999a
commit 9ad31fddff
4 changed files with 110 additions and 35 deletions

View File

@ -17,6 +17,7 @@
#include <unistd.h>
#include <stdbool.h>
#include <time.h>
#include <stdbool.h>
#include "obidms.h"
#include "obitypes.h"
@ -25,6 +26,7 @@
#include "obidmscolumndir.h"
#define ELEMENTS_NAMES_MAX (2048)
#define INITIAL_LINE_COUNT (1000)
typedef int32_t obiversion_t; /**< Used to store the column version number
@ -49,6 +51,7 @@ typedef struct OBIDMS_column_header {
OBIType_t data_type; /**< type of the data */
time_t creation_date; /**< date of creation of the file */
obiversion_t version; /**< version of the OBIColumn */
obiversion_t cloned_from; /**< version of the OBIColumn from which the column was cloned from (-1 if it does not come from cloning).*/
char name[OBIDMS_MAX_COLNAME+1]; /**< The column name as a NULL
* terminated string.
*/
@ -148,7 +151,7 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
*
* @param dms a pointer on an OBIDMS
* @param column_name the name of the column
* @param version_number the version of the column that should be opened
* @param version_number the version of the column that should be opened (if -1, the latest version number is retrieved)
*
* @return a pointer to the opened column
*
@ -158,6 +161,22 @@ OBIDMS_column_p obi_create_column(OBIDMS_p dms,
OBIDMS_column_p obi_open_column(OBIDMS_p dms, const char* column_name, obiversion_t version_number);
/**
* @brief Clones a column, and returns a pointer to the writable new column.
*
* @param dms a pointer on an OBIDMS
* @param column_name the name of the column to clone
* @param version_number the version of the column that should be cloned (if -1, the latest version number is retrieved)
* @param clone_data whether the data should be copied or not
*
* @return a pointer to the created column
*
* @since August 2015
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
OBIDMS_column_p obi_clone_column(OBIDMS_p dms, const char* column_name, obiversion_t version_number, bool clone_data);
/**
* @brief Closes a column.
*