98#ifndef HAVE_GETHOSTNAME_PROTOTYPE
107#include <lal/LALStdio.h>
108#include <lal/LALStdlib.h>
109#include <lal/LALString.h>
110#include <lal/LALCache.h>
111#include <lal/LALFrameIO.h>
112#include <lal/LALFrStream.h>
117static int XLALFrStreamFileClose(
LALFrStream * stream)
132 XLALFrStreamFileClose(stream);
143 XLALFrStreamFileClose(stream);
174 XLALFrStreamFileClose(stream);
208 if (XLALFrStreamFileOpen(stream, i) < 0) {
218 XLALFrStreamFileClose(stream);
231 if (XLALFrStreamFileOpen(stream, 0) < 0) {
355 return stream->
state;
413 XLALFrStreamFileClose(stream);
415 if (XLALFrStreamFileOpen(stream, 0) < 0)
440 const INT8 tacc = (
INT8) floor(0.1 * 1e9 / 16384.0);
452 stream->
state &= ~LAL_FR_STREAM_GAP;
455 pos2 = pos1 = stream->
pos;
463 if (XLALFrStreamFileOpen(stream, stream->
fnum) < 0)
468 if (stream->
pos < nFrame) {
477 if (stream->
pos >= nFrame) {
478 XLALFrStreamFileClose(stream);
489 if (XLALFrStreamFileOpen(stream, stream->
fnum) < 0)
500 if (llabs((
long long)(texp - tact)) > tacc) {
504 1e-9 * texp, 1e-9 * tact);
509 1e-9 * texp, pos1, url1);
511 1e-9 * tact, pos2, url2);
548 XLALFrStreamFileClose(stream);
595 if (XLALFrStreamFileOpen(stream, stream->
fnum) < 0)
603 for (stream->
pos = 0; stream->
pos < (
int)nFrame; ++stream->
pos) {
618 if (stream->
pos < (
int)nFrame)
622 XLALFrStreamFileClose(stream);
689 XLALFrStreamFileClose(stream);
690 if (XLALFrStreamFileOpen(stream, stream->
cache->
length - 1) < 0)
701 "Invalid whence value: use SEEK_SET, SEEK_CUR, or SEEK_END");
740 position->
pos = stream->
pos;
764 if (stream->
fnum != position->
fnum) {
765 XLALFrStreamFileClose(stream);
766 if (position->
fnum >= stream->
fnum) {
771 if (XLALFrStreamFileOpen(stream, position->
fnum) < 0)
775 stream->
pos = position->
pos;
LALCacheEntry * XLALCacheEntrySeek(const LALCache *cache, double t)
void XLALDestroyCache(LALCache *cache)
LALCache * XLALCacheGlob(const char *dirstr, const char *fnptrn)
int XLALCacheUniq(LALCache *cache)
LALCache * XLALCacheDuplicate(const LALCache *cache)
int XLALCacheSort(LALCache *cache)
int XLALFrStreamSeek(LALFrStream *stream, const LIGOTimeGPS *epoch)
Seeks a LALFrStream stream to data at a given time.
int XLALFrStreamSeekO(LALFrStream *stream, double dt, int whence)
Seeks a LALFrStream stream by a time offset.
int XLALFrStreamState(LALFrStream *stream)
Gets the current state of a LALFrStream.
int XLALFrStreamTell(LIGOTimeGPS *epoch, LALFrStream *stream)
Tells the current time of the current position of a LALFrStream stream.
int XLALFrStreamClose(LALFrStream *stream)
Closes a LALFrStream.
int XLALFrStreamGetMode(LALFrStream *stream)
Returns the current operating mode of a LALFrStream.
int XLALFrStreamEnd(LALFrStream *stream)
Checks to see if a LALFrStream is at the end of the stream.
LALFrStream * XLALFrStreamCacheOpen(LALCache *cache)
Opens a LALFrStream associated with a LALCache.
int XLALFrStreamRewind(LALFrStream *stream)
Rewinds a LALFrStream stream.
int XLALFrStreamGetpos(LALFrStreamPos *position, LALFrStream *stream)
Gets the current position of a LALFrStream stream.
int XLALFrStreamNext(LALFrStream *stream)
Advance a LALFrStream stream to the beginning of the next frame.
LALFrStream * XLALFrStreamOpen(const char *dirname, const char *pattern)
Opens a LALFrStream for specified frame files.
int XLALFrStreamSetMode(LALFrStream *stream, int mode)
Change the operating mode of a LALFrStream.
int gethostname(char *name, int len)
int XLALFrStreamSetpos(LALFrStream *stream, const LALFrStreamPos *position)
Sets the current position of a LALFrStream stream.
int XLALFrStreamClearErr(LALFrStream *stream)
Resets the state of a LALFrStream.
int XLALFrStreamError(LALFrStream *stream)
Checks to see if a LALFrStream has encountered an error.
@ LAL_FR_STREAM_CHECKSUM_MODE
ensure that file checksums are OK
@ LAL_FR_STREAM_DEFAULT_MODE
ignore time/gaps but report warnings & info
@ LAL_FR_STREAM_IGNOREGAP_MODE
ignore gaps in data
@ LAL_FR_STREAM_TIMEWARN_MODE
display warning for invalid time requests
@ LAL_FR_STREAM_IGNORETIME_MODE
ignore invalid times requested
@ LAL_FR_STREAM_GAPINFO_MODE
display info for gaps in data
@ LAL_FR_STREAM_GAP
gap in frame stream
@ LAL_FR_STREAM_OK
nominal
@ LAL_FR_STREAM_URL
error opening frame URL
@ LAL_FR_STREAM_ERR
error in frame stream
@ LAL_FR_STREAM_END
end of frame stream
double XLALFrFileQueryDt(const LALFrFile *frfile, size_t pos)
Query a frame file for the duration of a particular frame.
int XLALFrFileCksumValid(LALFrFile *frfile)
Use checksum to determine if a frame file is valid.
size_t XLALFrFileQueryNFrame(const LALFrFile *frfile)
Query a frame file for the number of frames contained in the file.
LIGOTimeGPS * XLALFrFileQueryGTime(LIGOTimeGPS *start, const LALFrFile *frfile, size_t pos)
Query a frame file for the start time of a particular frame.
LALFrFile * XLALFrFileOpenURL(const char *url)
Open frame file for reading and return a LALFrFile structure.
int XLALFrFileClose(LALFrFile *frfile)
Close a frame file described by a LALFrFile structure.
#define XLAL_PRINT_INFO(...)
#define XLAL_ERROR_NULL(...)
#define XLAL_PRINT_WARNING(...)
#define XLAL_PRINT_ERROR(...)
LIGOTimeGPS * XLALGPSAdd(LIGOTimeGPS *epoch, REAL8 dt)
int XLALGPSCmp(const LIGOTimeGPS *t0, const LIGOTimeGPS *t1)
REAL8 XLALGPSGetREAL8(const LIGOTimeGPS *epoch)
REAL8 XLALGPSDiff(const LIGOTimeGPS *t1, const LIGOTimeGPS *t0)
INT8 XLALGPSToINT8NS(const LIGOTimeGPS *epoch)
This structure details the state of the frame stream.
This structure contains a record of the state of a frame stream; this record can be used to restore t...
UINT4 fnum
the file number of a list of frame files that was open when the record was made
LIGOTimeGPS epoch
the GPS time of the open frame when the record was made
INT4 pos
the position within the frame file that was open when the record was made