GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QLSM / V2-0-1 > qlsm / rhel5-64
#include <QLSM/QLSM_istream.h>
#include <QSD/CCSDS_istream.h>
#include <QSD/CCSDS_apidDsc.h>
#include <QSD/CCSDS_telemetry.h>
#include <LSF/LSF.h>
#include <PBI/BSWP.ih>
#include <PBI/Endianness.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
Classes | |
struct | _QLSM_istream |
Standard header for both input and output streams. More... | |
Typedefs | |
typedef enum _QLSM_ISTREAM_BOUNDS_K | QLSM_ISTREAM_BOUNDS_K |
Typedef for enum _QLSM_ISTREAM_BOUNDS_K. | |
typedef struct _QLSM_istream | QLSM_istream |
Enumerations | |
enum | _QLSM_ISTREAM_BOUNDS_K { QLSM_ISTREAM_BOUNDS_K_MAXPKT = 1 << 16, QLSM_ISTREAM_BOUNDS_K_LOWER = QLSM_ISTREAM_BOUNDS_K_MAXPKT, QLSM_ISTREAM_BOUNDS_K_UPPER = 1 << 25, QLSM_ISTREAM_BOUNDS_K_OVERFLOW = QLSM_ISTREAM_BOUNDS_K_MAXPKT } |
Upper and lower bounds on the segment size. More... | |
Functions | |
static void * | mem_alloc (unsigned int nbytes) |
Wraps the 'real' allocator. | |
static void | mem_free (void *ptr) |
Wraps the 'real' deallocator. | |
static int | get_datagram (QLSM_istream *istream) |
Gets the next datagram into the buffer. | |
int | QLSM_istreamSizeof (void) |
Returns the size, in bytes, of QLSM_istream handle. | |
QLSM_istream * | QLSM_istreamNew (void) |
Allocates a QLSM_istream handle. | |
int | QLSM_istreamClose (QLSM_istream *stream) |
Closes the stream. | |
int | QLSM_istreamConstruct (QLSM_istream *istream, CCSDS_istream *ccsds) |
Opens a QLSM file or data for reading. | |
int | QLSM_istreamFileOpen (QLSM_istream *istream, const char *filename, unsigned int options, unsigned char *buf, unsigned int buf_size) |
Convenience routine to construct a QLSM_istreamFileOpen to read from the specified name file filename. | |
int | QLSM_istreamRead (QLSM_istream *istream, QLSM_istreamDsc *dsc, unsigned int filter) |
Reads the next object in the QLSM stream. | |
int | QLSM_istreamDelete (QLSM_istream *istream) |
Deletes the QLSM_istream. |
CVS $Id: QLSM_istream.c,v 1.2 2011/03/30 21:53:58 russell Exp $
Typedef for enum _QLSM_ISTREAM_BOUNDS_K.
The lower bound must be constrained to be at least the size of the largest contribution
The upper bound is really only a default used and can be easily overridden. The upper bound must be at least the size of a maximally sized contribution, but really is set by purely practical considerations. Since this is unit of a read, on very large files, there can be a considerable delay if this read is very large. This is annoying, particularly in the case where one working interactively and just processing the first few records. So this size is set to be something that is large enough to be accommodate most files, but small enough to keep the read latency to something tolerable on human timescales.
Upper and lower bounds on the segment size.
static int get_datagram | ( | QLSM_istream * | istream | ) | [static] |
Gets the next datagram into the buffer.
istream | The QLSM_stream handle |
DO we want recovery here
References _QLSM_istream::apidDsc, _QLSM_istream::ccsds, and _QLSM_istream::pkt.
Referenced by QLSM_istreamRead().
static void * mem_alloc | ( | unsigned int | nbytes | ) | [static] |
Wraps the 'real' allocator.
nbytes | The number of bytes |
Referenced by QLSM_istreamNew().
static void mem_free | ( | void * | ptr | ) | [static] |
Wraps the 'real' deallocator.
ptr | Pointer to the memory to free |
Referenced by QLSM_istreamDelete().
int QLSM_istreamClose | ( | QLSM_istream * | stream | ) |
Closes the stream.
This function only closes the file.To free the memory associated with the contents of the file, the user must call QLSM_istreamFree().
int QLSM_istreamConstruct | ( | QLSM_istream * | istream, | |
CCSDS_istream * | ccsds | |||
) |
Opens a QLSM file or data for reading.
0,success | ||
!= | 0, failure |
istream | The stream handle to construct | |
ccsds | A previously construct CCSDS_istream |
References _QLSM_istream::apidDsc, _QLSM_istream::buffer, _QLSM_istream::ccsds, _QLSM_istream::cur, _QLSM_istream::dgm_left32, and _QLSM_istream::pkt_left.
Referenced by QLSM_istreamFileOpen().
int QLSM_istreamDelete | ( | QLSM_istream * | istream | ) |
Deletes the QLSM_istream.
istream | The event builder stream handle |
References mem_free().
int QLSM_istreamFileOpen | ( | QLSM_istream * | istream, | |
const char * | filename, | |||
unsigned int | options, | |||
unsigned char * | buf, | |||
unsigned int | buf_size | |||
) |
Convenience routine to construct a QLSM_istreamFileOpen to read from the specified name file filename.
0,If | successful | |
-1,If | could not allocate a new stream (i.e. out of memory) | |
-2,If | the file does not exist |
istream | The target CCSDS_istream | |
filename | The name of the file to open | |
options | Bit list of options, currently unused, specify as 0 | |
buf | Optional parameter specifying the FILE's input read buffer | |
buf_size | Optional parameter specifying the size of buf |
References _QLSM_istream::ccsds, and QLSM_istreamConstruct().
int QLSM_istreamRead | ( | QLSM_istream * | istream, | |
QLSM_istreamDsc * | dsc, | |||
unsigned int | filter | |||
) |
Reads the next object in the QLSM stream.
0,if | successful | |
-1,if | not |
istream | A previously opened event builder stream handle | |
dsc | If successful, filled in with a description of the read object. This includes its
| |
filter | A bit mask of the object(s) the user wishes to have returned. |
References _QLSM_istream::apidDsc, _QLSM_istream::cur, _QLSM_istreamDsc::dat, _QLSM_istream::dgm_left32, get_datagram(), _QLSM_istreamDsc::len32, _QLSM_istream::pkt_left, _QLSM_istreamDsc::type, and _QLSM_istreamDsc::version.
int QLSM_istreamSizeof | ( | void | ) |
Returns the size, in bytes, of QLSM_istream handle.