TaskParameters 8.1.12
Compiled `c` library for task parameter data structures and functions.
Loading...
Searching...
No Matches
Parameter Files

Handling of parameter file read and write operations + parameters.txt file structure.
More...

Functions

const char * findMostRecentParameters (const char *subject, char *searchFolder)
 Function to find the most recent parameters filename for a given subject.
 
void parseParameterFile (const char *filename, TaskParameters *params)
 Parses a parameter file and populates a TaskParameters struct.
 
void writeParameterFile (const char *filename, const TaskParameters *params)
 Writes task parameters to a parameter file.
 

Detailed Description

Handling of parameter file read and write operations + parameters.txt file structure.

All parameter files are UTF-8-encoded tab-separated-value (.tsv) files.
To generate an example parameter text file, you should compile and run bin\gen_params.exe and view how it is read using bin\test_params.exe to ensure that the parameter format is working as expected.
As of 2024-02-24, the following structure is expected in the `

Function Documentation

◆ findMostRecentParameters()

const char * findMostRecentParameters ( const char * subject,
char * searchFolder )

Function to find the most recent parameters filename for a given subject.

If no parameter .tsv file exists within searchFolder, return NULL instead. Parameter files are expected to have the name convention: Subject_YYYY_MM_DD_Tag_Index.tsv Therefore, first all files for Subject are found. Next, only files from the most recent date (YYYY-MM-DD) are considered. Finally, use the file with the largest Index value. The returned name should be the full filename (including path).

Parameters
subjectThe subject for which to find the most recent parameters file.
searchFolderThe folder in which to search for the parameters files.
Returns
The full filename of the most recent parameters file, or NULL if none found.

◆ parseParameterFile()

void parseParameterFile ( const char * filename,
TaskParameters * params )

Parses a parameter file and populates a TaskParameters struct.

Parameters
filenameThe name of the parameter file.
paramsPointer to the TaskParameters struct to populate.

◆ writeParameterFile()

void writeParameterFile ( const char * filename,
const TaskParameters * params )

Writes task parameters to a parameter file.

This function writes the given task parameters to a parameter file with the specified filename.

Parameters
filenameThe name of the parameter file to write.
paramsPointer to the TaskParameters struct containing the parameters to write.