takane
Validators for ArtifactDB file formats
Loading...
Searching...
No Matches
takane::csv_data_frame Namespace Reference

Definitions for CSV data frames. More...

Classes

struct  Parameters
 Parameters for validating the CSV data frame. More...
 

Functions

template<class Reader >
CsvContents validate (Reader &reader, const Parameters &params, CsvFieldCreator *creator=NULL)
 
CsvContents validate (const char *path, const Parameters &params, CsvFieldCreator *creator=NULL)
 

Detailed Description

Definitions for CSV data frames.

Function Documentation

◆ validate() [1/2]

CsvContents takane::csv_data_frame::validate ( const char * path,
const Parameters & params,
CsvFieldCreator * creator = NULL )
inline

Overload of csv_data_frame::validate() that accepts a file path.

Parameters
pathPath to the CSV file.
paramsValidation parameters.
creatorFactory to create objects for holding the contents of each CSV field. Defaults to a pointer to a DummyFieldCreator instance.
Returns
Contents of the loaded CSV.

◆ validate() [2/2]

template<class Reader >
CsvContents takane::csv_data_frame::validate ( Reader & reader,
const Parameters & params,
CsvFieldCreator * creator = NULL )

Checks if a CSV data frame is correctly formatted. An error is raised if the file does not meet the specifications.

Template Parameters
ReaderA byteme reader class.
Parameters
readerA stream of bytes from the CSV file.
paramsValidation parameters.
creatorFactory to create objects for holding the contents of each CSV field. Defaults to a pointer to a DummyFieldCreator instance.
Returns
Contents of the loaded CSV. Whether the fields member actually contains the CSV data depends on creator. Each entry of the fields member corresponds to an entry of params.columns, which an additional field at the start if params.has_row_names = true.