Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xdf_read(3) [debian man page]

XDF_READ(3)						     xdffileio library manual						       XDF_READ(3)

NAME
xdf_read - Read samples from a xDF file SYNOPSIS
#include <xdfio.h> int xdf_read(struct xdf* xdf, unsigned int ns, ...); DESCRIPTION
xdf_read() reads ns samples from the xDF file referenced by xdf. This file should have been opened with mode XDF_READ and xdf_pre- pare_arrays(3) should have been successfully called on it. xdf_read() will fail otherwise). The data to be read will be transferred into arrays specified by pointers provided in the variable list of arguments of the function. The function expects the same number of arrays as specified by previous call to xdf_define_arrays(3). The internal organisation of the data in the arrays should have been specified previously with calls to xdf_set_chconf(3). In addition, it is important to note that none of the arrays should overlap. RETURN VALUE
The function returns the number of the samples successfully read from the xDF file in case of success. The number of samples read can be smaller than the number requested in the end of the file is reached. In case of error, -1 is returned and errno is set appropriately. ERRORS
EINVAL xdf is NULL EPERM No successfull call to xdf_prepare_transfer(3) have been done on xdf or it has been opened using the mode XDF_WRITE. EINTR The call was interrupted by a signal before any data was written; see signal(7). EIO A low-level I/O error occurred while reading from the inode. ESTALE Stale file handle. This error can occur for NFS and for other file systems EXAMPLE
/* Assume xdf references a xDF file opened for reading whose channels source their data in 2 arrays of float whose strides are the length of respectively 4 and 6 float values, i.e. 16 and 24 bytes (in most platforms)*/ #define NS 3 float array1[NS][4], array2[NS][6]; unsigned int strides = {4*sizeof(float), 6*sizeof(float)}; unsigned int i; xdf_define_arrays(xdf, 2, strides); if (xdf_prepare_transfer(xdf)) return 1; for (i=0; i<45; i+=NS) { /* Write the values to the file */ if (xdf_write(xdf, NS, array1, array2)) return 1; /* Use the values contained in array1 and array2*/ ... } xdf_close(xdf); SEE ALSO
xdf_set_chconf(3), xdf_define_arrays(3), xdf_prepare_transfer(3) EPFL
2010 XDF_READ(3)

Check Out this Related Man Page

XDF_SET_CHCONF(3)					     xdffileio library manual						 XDF_SET_CHCONF(3)

NAME
xdf_set_chconf, xdf_get_chconf - set or get the configuration of a channel descriptor handle SYNOPSIS
#include <xdfio.h> int xdf_set_chconf(struct xdfch* ch, enum xdffield field, ...); int xdf_get_chconf(const struct xdfch* ch, enum xdffield field, ...); DESCRIPTION
xdf_set_chconf() sets the configuration of the channel referenced by ch according to the variable list of argument. This list is composed of successive couple grouping one variable of type enum xdffield defining the feature to be set and a value whose type depends on the pre- vious field type. The list must finish by XDF_NOF. xdf_get_chconf() gets the configuration of the channel referenced by ch according to the variable list of argument. The variable list is the same list terminated by XDF_NOF as for xdf_set_chconf() excepting that the second part of the couple is not that value but a pointer to the value. Both functions process the argument list from left to right. This means that if a particular field request provokes an error, none of the field requests on its right will be processed. The order of processing is also important for field requests that influences the value of other fields (like XDF_CF_STOTYPE). Here is the list of admissible value. The expected type of value is provided in the parenthesis (the expected type of the value for xdf_set_chconf(), or a pointer to this type for xdf_get_chconf()). The default value of each field is provided in squared brackets (however these defaults can be overridden by a call to xdf_set_conf(3) if the file is open for writing. If the file is opened for reading, the default are meaningful only for the fields XDF_CF_ARR*). If a list of data formats is specified in curl brackets, it means that the field is supported only in those formats (no list means that all formats support the field): XDF_CF_ARRINDEX (int) [0] Specify the array from/to which the channel value should be transfered. If the mode of the file is XDF_READ and the value is nega- tive, the channel will not be read. If the mode is XDF_WRITE and the value is negative, the function will fail. XDF_CF_ARROFFSET (int) [0 for channel 0, packed channels for the rest] Specify the offset in the array from/to which the channel value should be transfered. XDF_CF_ARRDIGITAL (int) [0 if writing, 1 if reading] Indicate that the data in the array from/to which the channel value should be transfered is provided in digital unit. This means in practice that no scaling is performed during the transfer from/to the disk (non zero indicate no scaling). XDF_CF_ARRTYPE (enum xdftype) [same as XDF_CF_STOTYPE] specify the type in the channel should casted to/from when accessed in the array. XDF_CF_PMIN (double) [min of XDF_CF_ARRTYPE] Set/get the minimal value that a physical value can get. Cannot be set if XDF_READ. XDF_CF_PMAX (double) [max of XDF_CF_ARRTYPE] Set/get the maximal value that a physical value can get. Cannot be set if XDF_READ. XDF_CF_STOTYPE (enum xdftype) [any datatype supported by file type] Specify the type stored in the file of the channel value. If the XDF file has been opened in XDF_READ, this field cannot be set. If this field is successfully set, it will set as well the digital minimum (XDF_CF_DMIN) and the digital maximum (XDF_CF_MAX) to the minimum and maximum values allowed by the data type. XDF_CF_DMIN (double) [min of XDF_CF_STOTYPE] Set/get the minimal value that a digital value can get. Cannot be set if XDF_READ. This is also automatically set by XDF_CF_STOTYPE. XDF_CF_DMAX (double) [min of XDF_CF_STOTYPE] Set/get the maximal value that a digital value can get. Cannot be set if XDF_READ. This is also automatically set by XDF_CF_STOTYPE. XDF_CF_LABEL (const char*) [""] Set/get the label of the channel. Cannot be set if XDF_READ. XDF_CF_UNIT (const char*) [""] {EDF BDF GDF} Set/get the unit of the channel. Cannot be set if XDF_READ. XDF_CF_TRANSDUCTER (const char*) [""] {EDF BDF GDF} Set/get the type of sensor used for this channel. Cannot be set if XDF_READ. XDF_CF_PREFILTERING (const char*) [""] {EDF BDF GDF} Set/get the information about the filters already applied on channel data. Cannot be set if XDF_READ. XDF_CF_ELECPOS (double[3]) [0,0,0] {GDF} Position of the sensor/electrode expressed in X,Y,Z components Cannot be set if XDF_READ. XDF_CF_IMPEDANCE (double) [0] {GDF} Impedance of the sensor/electrode. Cannot be set if XDF_READ. RETURN VALUE
The two functions returns 0 in case of success. Otherwise -1 is returned and errno is set appropriately. ERROR
EINVAL ch is NULL or field is not a proper value of the enumeration xdffield EPERM The request submitted to xdf_set_chconf() is not allowed for this channel or is forbidden for file opened with the mode XDF_READ. EDOM The value set in xdf_set_chconf() as digital or physical min/max (fields XDF_CF_{D/P}{MIN/MAX}) goes beyond the limits of respec- tively the stored or array data type. EXAMPLES
Example of usage of xdf_set_chconf(): /* Assume xdf referenced an XDF file opened for writing */ unsigned int iarray = 2, offset = 0; const char label[] = "Channel EEG"; hchxdf ch = xdf_add_channel(xdf); xdf_set_chconf(ch, XDF_CF_ARRINDEX, iarray, XDF_CF_ARROFFSET, offset, XDF_CF_LABEL, label, XDF_NOF); Example of usage of xdf_get_chconf(): /* Assume xdf referenced an XDF file opened for reading */ unsigned int iarray, offset; const char label[128]; hchxdf ch = xdf_get_channel(xdf, 1); xdf_get_chconf(ch, XDF_CF_ARRINDEX, &iarray, XDF_CF_ARROFFSET, &offset, XDF_CF_LABEL, &label, XDF_NOF); printf("iarray = %u ", iarray); printf("offset = %u ", offset); printf("label = %s ", label); SEE ALSO
xdf_copy_chconf(3) EPFL
2010 XDF_SET_CHCONF(3)
Man Page