[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

setannstr, setanndesc, and setecgstr

 
int setannstr(int code, char *string)
int setanndesc(int code, char *string)
int setecgstr(int code, char *string)
Return:

0
Success
-1
Failure: illegal code

These functions modify translation tables used by functions that convert between annotation codes and strings. setannstr modifies the table shared by annstr and strann; setanndesc modifies the table used by anndesc; and setecgstr modifies the table shared by ecgstr and strecg. They may be used to redefine strings for defined annotation codes as well as to define strings for undefined annotation codes. For example, setannstr(NORMAL, "\\267") redefines the string for normal beats as a PostScript bullet, `*' (NORMAL is defined in `<wfdb/ecgcodes.h>'). These functions do not copy their string arguments, which must therefore be kept valid by the caller.

An important difference between setannstr (or setanndesc) and setecgstr is that annopen and wfdbinit insert modification labels in any output annotation files that are created after invoking setannstr or setanndesc; setecgstr does not have this side effect. By using setannstr before annopen, a WFDB application may create annotation files with self-contained code tables, which can be read properly by other WFDB applications without the need to inform them explicitly about non-standard codes. For this scheme to work as intended, all custom code mnemonics and descriptions must be defined before the output annotation files are opened.

By passing a negative value as code to setannstr or setanndesc, the translation for -code can be modified without triggering the generation of a modification label. This feature can be useful for programs that use alternate sets of mnemonics or descriptions for speakers of different languages.

Note that it is possible, though not desirable, to define identical strings for two or more codes; the behavior of strann and strecg in such cases is implementation-dependent. (setannstr and setanndesc were first introduced in WFDB library version 5.3.)

The next three functions convert between "standard time format" strings and times in units of sample intervals. Normally they should be invoked after isigopen, wfdbinit, or sampfreq, any of which will determine the duration of a sample interval and the base time from a header file, or after defining these quantities using setsampfreq and setbasetime. If this is not done, or if these time-conversion functions are used after wfdbquit, they will perform conversions in units of seconds (i.e., the sample interval is taken to be one second in such cases).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

George B. Moody (george@mit.edu)