LALFrame  3.0.4.1-b72065a
stream.c File Reference

Prototypes

int usage (const char *program)
 
int parseargs (int argc, char **argv)
 
void output_INT2 (LALFrStream *stream, const char *channame, LIGOTimeGPS *start, LIGOTimeGPS *end)
 
void output_INT4 (LALFrStream *stream, const char *channame, LIGOTimeGPS *start, LIGOTimeGPS *end)
 
void output_INT8 (LALFrStream *stream, const char *channame, LIGOTimeGPS *start, LIGOTimeGPS *end)
 
void output_UINT2 (LALFrStream *stream, const char *channame, LIGOTimeGPS *start, LIGOTimeGPS *end)
 
void output_UINT4 (LALFrStream *stream, const char *channame, LIGOTimeGPS *start, LIGOTimeGPS *end)
 
void output_UINT8 (LALFrStream *stream, const char *channame, LIGOTimeGPS *start, LIGOTimeGPS *end)
 
void output_REAL4 (LALFrStream *stream, const char *channame, LIGOTimeGPS *start, LIGOTimeGPS *end)
 
void output_REAL8 (LALFrStream *stream, const char *channame, LIGOTimeGPS *start, LIGOTimeGPS *end)
 
void output_COMPLEX8 (LALFrStream *stream, const char *channame, LIGOTimeGPS *start, LIGOTimeGPS *end)
 
void output_COMPLEX16 (LALFrStream *stream, const char *channame, LIGOTimeGPS *start, LIGOTimeGPS *end)
 
int main (int argc, char *argv[])
 

Go to the source code of this file.

Macros

#define FS   "\t" /* field separator */
 
#define RS   "\n" /* record separator */
 
#define MAXDUR   16.0 /* max segment duration (s) */
 
#define MAXLEN   16384 /* max number of points in buffer */
 
#define DEFINE_OUTPUT_FUNCTION(laltype, format, ...)
 

Variables

LALCachecache
 
char * channel
 
double t0
 
double dt
 

Macro Definition Documentation

◆ FS

#define FS   "\t" /* field separator */

Definition at line 101 of file stream.c.

◆ RS

#define RS   "\n" /* record separator */

Definition at line 102 of file stream.c.

◆ MAXDUR

#define MAXDUR   16.0 /* max segment duration (s) */

Definition at line 103 of file stream.c.

◆ MAXLEN

#define MAXLEN   16384 /* max number of points in buffer */

Definition at line 104 of file stream.c.

◆ DEFINE_OUTPUT_FUNCTION

#define DEFINE_OUTPUT_FUNCTION (   laltype,
  format,
  ... 
)
Value:
void output_ ## laltype (LALFrStream *stream, const char *channame, LIGOTimeGPS *start, LIGOTimeGPS *end) \
{ \
double remaining; \
laltype ## TimeSeries *series; \
/* create zero-length time series */ \
series = XLALCreate ## laltype ## TimeSeries(channame, start, 0.0, 0.0, &lalDimensionlessUnit, 0); \
XLALFrStreamGet ## laltype ## TimeSeriesMetadata(series, stream); \
while ((remaining = XLALGPSDiff(end, start)) > series->deltaT) { \
size_t length; \
size_t i; \
remaining = (remaining > MAXDUR ? MAXDUR : remaining); \
length = (size_t)floor(remaining / series->deltaT); \
length = (length > MAXLEN ? MAXLEN : length); \
if (series->data->length != length) \
XLALResize ## laltype ## TimeSeries(series, 0, length); \
XLALFrStreamGet ## laltype ## TimeSeries(series, stream); \
for (i = 0; i < series->data->length; ++i) { \
char tstr[32]; \
laltype value = series->data->data[i]; \
LIGOTimeGPS t = series->epoch; \
XLALGPSAdd(&t, i * series->deltaT); \
fprintf(stdout, "%s", XLALGPSToStr(tstr, &t)); \
fputs(FS, stdout); \
fprintf(stdout, format, __VA_ARGS__); \
fputs(RS, stdout); \
} \
XLALGPSAdd(start, series->data->length * series->deltaT); \
} \
XLALDestroy ## laltype ## TimeSeries(series); \
}
char * XLALGPSToStr(char *s, const LIGOTimeGPS *t)
const LALUnit lalDimensionlessUnit
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
#define FS
Definition: stream.c:101
#define MAXDUR
Definition: stream.c:103
#define MAXLEN
Definition: stream.c:104
#define RS
Definition: stream.c:102
This structure details the state of the frame stream.
Definition: LALFrStream.h:95

Definition at line 303 of file stream.c.

Function Documentation

◆ usage()

int usage ( const char *  program)

Definition at line 290 of file stream.c.

◆ parseargs()

int parseargs ( int  argc,
char **  argv 
)

Definition at line 213 of file stream.c.

◆ output_INT2()

void output_INT2 ( LALFrStream stream,
const char *  channame,
LIGOTimeGPS start,
LIGOTimeGPS end 
)

◆ output_INT4()

void output_INT4 ( LALFrStream stream,
const char *  channame,
LIGOTimeGPS start,
LIGOTimeGPS end 
)

◆ output_INT8()

void output_INT8 ( LALFrStream stream,
const char *  channame,
LIGOTimeGPS start,
LIGOTimeGPS end 
)

◆ output_UINT2()

void output_UINT2 ( LALFrStream stream,
const char *  channame,
LIGOTimeGPS start,
LIGOTimeGPS end 
)

◆ output_UINT4()

void output_UINT4 ( LALFrStream stream,
const char *  channame,
LIGOTimeGPS start,
LIGOTimeGPS end 
)

◆ output_UINT8()

void output_UINT8 ( LALFrStream stream,
const char *  channame,
LIGOTimeGPS start,
LIGOTimeGPS end 
)

◆ output_REAL4()

void output_REAL4 ( LALFrStream stream,
const char *  channame,
LIGOTimeGPS start,
LIGOTimeGPS end 
)

◆ output_REAL8()

void output_REAL8 ( LALFrStream stream,
const char *  channame,
LIGOTimeGPS start,
LIGOTimeGPS end 
)

◆ output_COMPLEX8()

void output_COMPLEX8 ( LALFrStream stream,
const char *  channame,
LIGOTimeGPS start,
LIGOTimeGPS end 
)

◆ output_COMPLEX16()

void output_COMPLEX16 ( LALFrStream stream,
const char *  channame,
LIGOTimeGPS start,
LIGOTimeGPS end 
)

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 135 of file stream.c.

Variable Documentation

◆ cache

LALCache* cache

Definition at line 107 of file stream.c.

◆ channel

char* channel

Definition at line 108 of file stream.c.

◆ t0

double t0

Definition at line 109 of file stream.c.

◆ dt

double dt

Definition at line 110 of file stream.c.