XDF_SET_CONF(3)
π xdf_set_conf, xdf_get_conf π
okay bestie, so this is a page from the xdffileio library manual β yes the whole library, we're going full main character here. Sit down, grab a strawberry π, because we're about to set and get the configuration of an xDF file and it's gonna be iconic.
β¨ NAME β¨
xdf_set_conf, xdf_get_conf β set or get the configuration of xDF file
β¨ SYNOPSIS β¨
#include <xdfio.h>
int xdf_set_conf(struct xdf* xdf, enum xdffield field, ...);
int xdf_get_conf(const struct xdf* xdf, enum xdffield field, ...);
β¨ DESCRIPTION β¨
So xdf_set_conf() sets the configuration (usually one of the field file header, iykyk) of a xDF file that's referenced by xdf, and it does it according to the variable list of arguments. That list is literally just successive couples β each couple groups one variable of type enum xdffield (which defines the feature you're setting) together with a value whose type depends on the field type that came before it. And bestie, the list must finish by XDF_NOF. No exceptions. Periodt.
Then xdf_get_conf() gets the configuration of the channel referenced by xdf, same vibe, according to the variable list of argument. The variable list is the same list terminated by XDF_NOF as for xdf_set_conf(), except β plot twist π«’ β the second part of the couple is not the value itself but a pointer to the value.
Both functions process the argument list from left to right. Which means: if some particular field request provokes an error, none of the field requests on its right get processed. Zero. Nada. And the order of processing is also important for field requests that influence the value of other fields (like XDF_F_REC_NSAMPLE or XDF_F_SAMPLING_FREQ) β they're lowkey entangled, it's giving codependent π
.
The functions accept two types of field value:
- First up: file configuration fields (
XDF_F_*), which set different aspects of the general configuration of the file. - Second: the channel configuration fields (
XDF_CF_*). When used inxdf_set_conf(), those fields set the default values that will be used for the creation of the next channel (seexdf_add_channel(3)). The list of channel configuration fields and their meaning are specified in the documentation ofxdf_set_chconf(3).
If the file is opened for writing, each field is initialized to sensible or non-informative values in the case of an optional field, or incorrect values in the case of a "must be set" field (that's only XDF_F_REC_NSAMPLE or XDF_F_SAMPLING_FREQ). The default values are specified in squared brackets in the list. π
Here's the list of file configuration field values. The type of value expected is provided in the parenthesis (that's the expected type of the value for xdf_set_conf(), or a pointer to this type for xdf_get_conf()). And if a list of data formats is specified in curly brackets, it means the field is supported only in those formats β no list means all formats support the field, no gatekeeping here π:
XDF_F_REC_DURATION(double)[1]β Specify the duration of one record. The value should be positive.XDF_F_REC_NSAMPLE(int)[0]β Specify the number of time points contained in each record. The value should be positive. Setting the number of sample per record modifies the sampling frequency (fieldXDF_SAMPLING_FREQ).XDF_F_SAMPLING_FREQ(int)[0]β Get or set the sampling frequency of the recording. Setting the sampling frequency modifies the number of sample per record (fieldXDF_F_REC_NSAMPLE).XDF_F_NCHANNEL(int)(get function only) β Get the number of channel in the file.XDF_F_NEVTTYPE(int)(get function only) β Get the number of different event types.XDF_F_NEVENT(int)(get function only) β Get the number of events.XDF_F_FILEFMT(int)(get function only) β Get the file format type (one of the value defined by the enumerationxdffiletypeother thanXDF_ANY).XDF_F_RECTIME(double)[current time]{EDF BDF GDF}β Date and time of recording. It is expressed as number of seconds elapsed since the Epoch,1970-01-01 00:00:00 +0000(UTC). This number is the convertion to double of the value returned by the functiontime(3)of the standard C library. On file creation, this field is initialized to the current time.XDF_F_SUBJ_DESC(const char*)[""]{EDF BDF GDF}β Specify the string describing the subject.XDF_F_SESS_DESC(const char*)[""]{EDF BDF GDF}β Specify the string describing the session of recording.XDF_F_ADDICTION(unsigned int)[0]{GDF}XDF_F_BIRTHDAY(double)[0]{GDF}β Birthday of the patient using the same format as specified for fieldXDF_F_RECTIME.XDF_F_HEIGHT(double)[0]{GDF}β Height of the subject in centimeters.XDF_F_WEIGHT(double)[0]{GDF}β Weight of the subject in kilograms.XDF_F_GENDER(unsigned int)[0]{GDF}β Sex of the subject. Use1for male,2for female and0if unknown.XDF_F_HANDNESS(unsigned int)[0]{GDF}β Handness of the subject. Use0if unknown,1if right,2if left and3if ambidextrious.XDF_F_VISUAL_IMP(unsigned int)[0]{GDF}β Visual impairment. Use0if unknown,1if no impairment,2if impaired and3if impaired but corrected.XDF_F_HEART_IMP(unsigned int)[0]{GDF}β Heart impairment. Use0if unknown,1if no impairment,2if impaired and3if the subject wear a pacemaker.XDF_F_LOCATION(double[3])[0,0,0]{GDF}β Location of the recording. The first 2 component specify the latitude and longitude in degrees, the third specifies the altitude in meters.XDF_F_ICD_CLASS(char[6])[0x000000000000]{GDF}β Patient classification according to the International Statistical Classification of Diseases and Related Health Problems (ICD).XDF_F_HEADSIZE(double[3])[0,0,0]{GDF}β Size of the subject's head (circumference, distance nasion β inion, left to right mastoid) expressed in millimeters.XDF_F_REF_POS(double[3])[0,0,0]{GDF}β X, Y, Z coordinates of the reference electrode.XDF_F_GND_POS(double[3])[0,0,0]{GDF}β X, Y, Z coordinates of the ground electrode.
β¨ RETURN VALUE β¨
The two functions returns 0 in case of success. Otherwise -1 is returned and errno is set appropriately. Slay when it works, sigh when it doesn't π.
β¨ ERROR β¨
EINVALβxdfisNULLorfieldis not a proper value of the enumerationxdffieldaccepted by the function (for exampleXDF_F_NCHANNELandxdf_set_conf()).EPERMβ The request submitted toxdf_set_conf()is not allowed for this type of xDF file or is not supported with the modeXDF_READ.
β¨ EXAMPLES β¨
Example of usage of xdf_set_conf() and xdf_get_conf():
/* Assume xdfr and xdfw reference 2 XDF files opened respectively
* for reading and for writing */
const char *subjstr, *sessstr;
xdf_get_conf(xdfr, XDF_F_SUBJ_DESC, &subjstr,
XDF_F_SESS_DESC, &sessstr,
XDF_NOF);
printf("subject: %s\nrecording: %s\n", subjstr, sessstr);
xdf_set_conf(xdfw, XDF_F_SUBJ_DESC, subjstr,
XDF_F_SESS_DESC, sessstr,
XDF_NOF);
β¨ SEE ALSO β¨
xdf_copy_conf(3), xdf_set_chconf(3), xdf_add_channel(3)
and that's the whole page bestie, we ate and left no crumbs π
β¨ this lil masterpiece comes to you from EPFL, dated 2010, and it lives under the name XDF_SET_CONF(3) in the xdffileio library manual. go forth and configure, you got this π«Άππ
π¦ where this page comes from
- debian bookworm: libxdffileio-dev 0.3-4 Β· LGPL-3.0-or-later
- debian trixie: libxdffileio-dev 0.3-4+b2 Β· LGPL-3.0-or-later
- fedora 43: xdffileio-devel 0.3-23.fc43 Β· LGPL-3.0-or-later
- fedora 43: xdffileio-devel 0.3-23.fc43 Β· LGPL-3.0-or-later
- fedora 44: xdffileio-devel 0.3-24.fc44 Β· LGPL-3.0-or-later
- fedora 44: xdffileio-devel 0.3-24.fc44 Β· LGPL-3.0-or-later
- ubuntu jammy: libxdffileio-dev 0.3-4 Β· LGPL-3.0-or-later
- ubuntu noble: libxdffileio-dev 0.3-4ubuntu3 Β· LGPL-3.0-or-later
- ubuntu questing: libxdffileio-dev 0.3-4ubuntu3
- ubuntu resolute: libxdffileio-dev 0.3-4ubuntu4 Β· LGPL-3.0-or-later
- ubuntu stonking: libxdffileio-dev 0.3-4ubuntu4 Β· LGPL-3.0-or-later
- Copyright 2010 (c) EPFL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms