Provides routines to read data from an open stream and store it in LAL data structures.
This header provides prototypes for routines that construct LAL data structures using the data from a file (or other I/O) stream. The routines do not provide a system-level interface to create files and open or close file streams; they simply assume that they have been passed an open, readable stream. Nonetheless, because they involve I/O stream manipulation, these routines are placed in the lalsupport
library rather than in lal
proper.
The routines in Module StreamVectorInput.c and Module StreamVectorSequenceInput.c are compartmentalized in such a way that they can easily be converted if the LAL specification later changes the way in which I/O streams are handled. In partucular, the only file I/O commands used are fgets()
and feof()
. Thus the upgrade would involve only the following global changes:
FILE *
with the name of the LAL I/O stream pointer type. fgets()
and feof()
with equivalent LAL functions. In particular, there is no need to translate routines such as fscanf()
; one should simply read data into a LAL CHARVector
and then use sscanf()
to format the input. This is the approach used in the numerical input routines in Module StreamVectorInput.c and Module StreamVectorSequenceInput.c.
The routines in Module StreamSequenceInput.c are less robust but much more efficient: they use fscanf()
to parse the input stream directly. They are intended primarily for test programs that may need to read large datafiles of undetermined length. The routines in Module StreamSeriesInput.c also parse the input stream directly using fscanf()
, to avoid potentially crippling computational overhead.
Modules | |
Module StreamVectorInput.c | |
Reads data from a single line in an input stream. | |
Module StreamVectorSequenceInput.c | |
Reads the entire contents of an input stream into a vector sequence. | |
Module StreamSequenceInput.c | |
Converts an input stream into a data sequence. | |
Module StreamSeriesInput.c | |
Converts an input stream into a time or frequency series. | |
Files | |
file | StreamInputTest.c |
Reads a sequence or vector sequence from a file. | |
file | StreamSeriesInputTest.c |
Reads a time or frequency series from a file, and writes it to another file. | |
Error Codes | |
#define | STREAMINPUTH_ENUL 1 |
Unexpected null pointer in arguments. More... | |
#define | STREAMINPUTH_EOUT 2 |
Output handle points to a non-null pointer. More... | |
#define | STREAMINPUTH_EMEM 3 |
Memory allocation error. More... | |
#define | STREAMINPUTH_ELEN 4 |
No numbers were read. More... | |
#define | STREAMINPUTH_ESLEN 5 |
Not enough numbers read to fill sequence. More... | |
#define | STREAMINPUTH_EVLEN 6 |
Could not determine complex vectorLength. More... | |
#define | STREAMINPUTH_EDLEN 7 |
Dimension lengths inconsistent or not given. More... | |
#define | STREAMINPUTH_EDIM 8 |
Inconsistent or non-positive arrayDim value. More... | |
#define | STREAMINPUTH_EFMT 9 |
Badly formatted number. More... | |
#define | STREAMINPUTH_EBUF 10 |
BUFFSIZE not a multiple of largest complex type size. More... | |
#define STREAMINPUTH_ENUL 1 |
Unexpected null pointer in arguments.
Definition at line 80 of file StreamInput.h.
#define STREAMINPUTH_EOUT 2 |
Output handle points to a non-null pointer.
Definition at line 81 of file StreamInput.h.
#define STREAMINPUTH_EMEM 3 |
Memory allocation error.
Definition at line 82 of file StreamInput.h.
#define STREAMINPUTH_ELEN 4 |
No numbers were read.
Definition at line 83 of file StreamInput.h.
#define STREAMINPUTH_ESLEN 5 |
Not enough numbers read to fill sequence.
Definition at line 84 of file StreamInput.h.
#define STREAMINPUTH_EVLEN 6 |
Could not determine complex vectorLength.
Definition at line 85 of file StreamInput.h.
#define STREAMINPUTH_EDLEN 7 |
Dimension lengths inconsistent or not given.
Definition at line 86 of file StreamInput.h.
#define STREAMINPUTH_EDIM 8 |
Inconsistent or non-positive arrayDim value.
Definition at line 87 of file StreamInput.h.
#define STREAMINPUTH_EFMT 9 |
Badly formatted number.
Definition at line 88 of file StreamInput.h.
#define STREAMINPUTH_EBUF 10 |
BUFFSIZE not a multiple of largest complex type size.
Definition at line 89 of file StreamInput.h.