GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > GRBP / V1-0-0
Constituent: attstream     Tag: mv2304
#include "GRBP/io/ATT_stream.h"
#include "GRBP/io/ATT_dgm.h"
#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>
Include dependency graph for ATT_stream.c:
Data Structures | |
struct | _streamCloseCbp |
Structure to bind the close callback routine with a parameter. More... | |
struct | _ATT_streamHeader |
Standard header for both input and output streams. More... | |
struct | _ATT_istreamBody |
Internal structure used to control the input access to an ATT file or data section. More... | |
struct | _ATT_ostreamBody |
Context for an output event/packet stream. More... | |
union | _ATT_streamBody |
Union of all the stream types. More... | |
union | _ATT_stream |
Standard ATT stream handle. More... | |
Typedefs | |
typedef enum _ATT_STREAM_DIR_K | ATT_STREAM_DIR_K |
Typedef for enum _ATT_STREAM_DIR_K. | |
typedef enum _ATT_STREAM_DIR_K | ATT_streamDir |
Typedef for enum _ATT_STREAM_DIR_K. | |
typedef enum _ATT_STREAM_BOUNDS_K | ATT_STREAM_BOUNDS_K |
Typedef for enum _ATT_STREAM_BOUNDS_K. | |
typedef int(* | streamClose )(void *file) |
Generic stream close function signature. | |
typedef _streamCloseCbp | streamCloseCbp |
Typedef for struct _streamCloseCbp. | |
typedef _ATT_streamHeader | ATT_streamHeader |
Typedef for struct _ATT_streamHeader. | |
typedef _ATT_istreamBody | ATT_istreamBody |
Typedef for struct _ATT_streamFileBody. | |
typedef _ATT_ostreamBody | ATT_ostreamBody |
Typedef for struct _ATT_ostreamBody. | |
typedef _ATT_streamBody | ATT_streamBody |
Typedef for union _ATT_streamBody. | |
typedef _ATT_stream | ATT_stream |
Typedef for struct _ATT_stream. | |
Enumerations | |
enum | _ATT_STREAM_DIR_K { ATT_STREAM_DIR_K_READ = 0, ATT_STREAM_DIR_K_WRITE = 1 } |
Enumeration of the IO direction, i.e. read or write. More... | |
enum | _ATT_STREAM_BOUNDS_K { ATT_STREAM_BOUNDS_K_MAXDGM = 1 << 16, ATT_STREAM_BOUNDS_K_LOWER = ATT_STREAM_BOUNDS_K_MAXDGM, ATT_STREAM_BOUNDS_K_UPPER = 1 << 25, ATT_STREAM_BOUNDS_K_OVERFLOW = ATT_STREAM_BOUNDS_K_MAXDGM } |
Upper and lower bounds on the segment size. More... | |
Functions | |
static ATT_stream * | fileOpen (ATT_streamType type, const char *fileName, int segment_size) |
Opens a ATT file for reading. | |
static int | fileRead (ATT_stream *stream, unsigned int *ptr, size_t nbytes) |
Reads the specified number of bytes. | |
static ATT_stream * | map (unsigned int *grb_data) |
Prepares an in memory data structure to be read. | |
static void * | mem_alloc (unsigned int nbytes) |
Wraps the 'real' allocator. | |
static void | mem_free (void *ptr) |
Wraps the 'real' deallocator. | |
static __inline void | dgm_swap (ATT_dgm *dgm) |
Byte-swap the datagram. | |
static __inline void | swap32_lclXbigN (unsigned int *w, int n) |
ATT_stream * | ATT_streamOpen (ATT_streamType type, const void *name, int segment) |
Opens a ATT file or data for reading. | |
int | ATT_streamRead (ATT_stream *stream) |
Reads the ATT file associated with the event stream handle istream. | |
const ATT_dgm * | ATT_streamLocate (ATT_stream *stream, int advance) |
Returns a pointer to the current packet and, optionally, advances the current packet to the next packet. | |
const ATT_attitude * | ATT_streamAttNext (ATT_stream *stream) |
Returns a pointer to the next attitude record or NULL if exhausted. | |
int | ATT_streamClose (ATT_stream *stream) |
Closes the file after it has been read. | |
ATT_stream * | ATT_streamCreate (ATT_streamType type, const char *name, int rsvd_mbz) |
Creates a file to receive the ATT data packets. | |
int | ATT_streamFree (ATT_stream *stream) |
Frees the memory associated with the contents of the file. | |
int | ATT_streamDgmWrite (ATT_stream *stream, const ATT_dgm *dgm) |
Writes the specified packet to the output file. |
CVS $Id: ATT_stream.c,v 1.2 2007/08/02 17:25:01 russell Exp $
|
Typedef for enum _ATT_STREAM_BOUNDS_K. The lower bound must be constrained to be at least the size of the largest event. 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 event, 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 events. 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. The overflow region is provided as an area where discontigious events may be reassembled into a contigious block of memory. As such, it must be at least the size of a maximally sized event. |
|
|
Enumeration of the IO direction, i.e. read or write.
|
|
Returns a pointer to the next attitude record or NULL if exhausted.
|
|
Closes the file after it has been read. This function only closes the file after its contents have been read into memory. To free the memory associated with the contents of the file, the user must call ATT_streamFree(). |
|
Creates a file to receive the ATT data packets.
|
|
Writes the specified packet to the output file.
|
|
Frees the memory associated with the contents of the file.
|
|
Returns a pointer to the current packet and, optionally, advances the current packet to the next packet.
|
|
Opens a ATT file or data for reading.
|
|
Reads the ATT file associated with the event stream handle istream.
|
|
Byte-swap the datagram.
|
|
Opens a ATT file for reading.
|
|
Reads the specified number of bytes.
|
|
Prepares an in memory data structure to be read.
|
|
Wraps the 'real' allocator.
|
|
Wraps the 'real' deallocator.
|