Go to the first, previous, next, last section, table of contents.


annopen

int annopen(char *record, DB_Anninfo *aiarray, unsigned int nann)

Return:

0
Success
-3
Failure: unable to open input annotation file
-4
Failure: unable to open output annotation file
-5
Failure: illegal stat (in aiarray) specified for annotation file

This function opens input and output annotation files for a selected record. If record begins with `+', previously opened annotation files are left open, and the record name is taken to be the remainder of record after discarding the `+'. Otherwise, annopen closes any previously opened annotation files, and takes all of record as the record name. aiarray is a pointer to an array of DB_Anninfo structures (see section Annotator Information Structures), one for each annotator to be opened. nann is the number of DB_Anninfo structures in aiarray; nann must be no greater than twice DB_MAXANN (a constant defined in `<ecg/db.h>'), and no more than DB_MAXANN input and DB_MAXANN output annotators may be open at once. The caller must fill in the DB_Anninfo structures to specify the names of the annotators, and to indicate which annotators are to be read, and which are to be written. Input and output annotators may be listed in any order in aiarray. Annotator numbers (for both input and output annotators) are assigned in the order in which the annotators appear in aiarray. For example, this code fragment

...
char *record = "100s";
DB_Anninfo a[3];

a[0].name = "a"; a[0].stat = READ;
a[1].name = "b"; a[1].stat = WRITE;
a[2].name = "c"; a[2].stat = READ;
if (annopen(record, a, 3) < 0)
...

attempts to open three annotation files for record `100s'. Annotator `a' becomes input annotator 0, `b' becomes output annotator 0, and `c' becomes input annotator 1. Thus getann(1, &annot) (see section getann) will read an annotation from annotator `c', and putann(0, &annot) will write an annotation for annotator `b'. Input annotation files will be found if they are located in any of the directories specified by DB (see section The Database Path); output annotators are created in the current directory (but note that, under UNIX at least, it is possible to specify annotator names such as `/here' or `zzz/there' or even `../somewhere/else'; see section Annotation Files, for details of how file names are constructed from annotator and record names). Several of the example programs in chapter 6 illustrate the use of annopen; for example, see section Example 1: An Annotation Filter.

As a special case, if nann is 0, aiarray can be NULL. This can be useful to force open annotation files to be closed without closing open signal files.


Go to the first, previous, next, last section, table of contents.



George B. Moody (george@hstbme.mit.edu)