GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > GRBP / V1-0-1

Constituent: grbstream     Tag: mv2304


Interface   Data Structures   File List   Data Fields   Globals  

GRB_stream.h File Reference

GRB stream Utilities, Interface. More...

This graph shows which files directly or indirectly include this file:


Typedefs

typedef enum _GRB_STREAM_TYPE_K GRB_STREAM_TYPE_K
 Standard typedef for _enum GRB_STREAM_TYPE_K.
typedef enum _GRB_STREAM_TYPE_K GRB_streamType
 Typedef for _enum GRB_STREAM_TYPE_K, used in procedure calls.
typedef enum _GRB_STREAM_UNIT_K GRB_STREAM_UNIT_K
 Typedef for enum _GRB_STREAM_UNIT_K.
typedef enum _GRB_STREAM_UNIT_K GRB_streamUnit
 Typedef for enum _GRB_streamUnit.

Enumerations

enum  _GRB_STREAM_TYPE_K {
  GRB_STREAM_TYPE_K_FILE = 0,
  GRB_STREAM_TYPE_K_DATA = 1,
  GRB_STREAM_TYPE_K_FILESEG = 2
}
enum  _GRB_STREAM_UNIT_K {
  GRB_STREAM_UNIT_K_PKTS = 0,
  GRB_STREAM_UNIT_K_EVTS = 1
}
 Enumeration of how to treat the input stream, as packets or events. More...
enum  _GRB_STREAM_PKT_SIZE_K_MAX {
  GRB_STREAM_PKT_SIZE_K_MAX = -1,
  GRB_STREAM_PKT_SIZE_K_DEF = 0
}
 Enumerates the sentinal values used when specifying a packet size. More...

Functions

GRB_streamGRB_streamOpen (GRB_streamType type, const void *name, int segment)
 Opens a GRB file or data for reading.
int GRB_streamRead (GRB_stream *stream)
 Reads the GRB file associated with the event stream handle istream.
const GRB_pktHdr * GRB_streamLocate (GRB_stream *stream, int advance)
 Returns a pointer to the current packet and, optionally, advances the current packet to the next packet.
GRB_streamGRB_streamCreate (GRB_streamType type, const char *name, int rsvd_mbz)
 Creates a file to receive the GRB data packets.
int GRB_streamPktWrite (GRB_stream *stream, const GRB_pktHdr *pkt)
 Writes the specified packet to the output file.
int GRB_streamClose (GRB_stream *stream)
 Closes the file after it has been read.
int GRB_streamFree (GRB_stream *stream)
 Frees the memory associated with the contents of the file.

Variables

enum _GRB_STREAM_PKT_SIZE_K_MAX GRB_STREAM_PKT_SIZE_K

Detailed Description

GRB stream Utilities, Interface.

Author:
JJRussell - russell@slac.stanford.edu
    CVS $Id: GRB_stream.h,v 1.1.1.1 2007/06/18 00:42:58 russell Exp $

Routines for reading/writing files/data sections in Event Builder format.

Enumeration Type Documentation

enum _GRB_STREAM_PKT_SIZE_K_MAX
 

Enumerates the sentinal values used when specifying a packet size.

Enumerator:
GRB_STREAM_PKT_SIZE_K_MAX  Typedef of struct _GRB_STREAM_PKT_SIZE_K.

Use the maximum packet size

GRB_STREAM_PKT_SIZE_K_DEF  Use the default packet size set in the stream handle

enum _GRB_STREAM_TYPE_K
 

Enumerator:
GRB_STREAM_TYPE_K_FILE  Stream type is a file
GRB_STREAM_TYPE_K_DATA  Stream type is a data section
GRB_STREAM_TYPE_K_FILESEG  Stream type is a segmented file

enum _GRB_STREAM_UNIT_K
 

Enumeration of how to treat the input stream, as packets or events.

Enumerator:
GRB_STREAM_UNIT_K_PKTS  Treat the stream as a stream of packets
GRB_STREAM_UNIT_K_EVTS  Treat the stream as a stream of events


Function Documentation

int GRB_streamClose GRB_stream stream  ) 
 

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 GRB_streamFree().

GRB_stream* GRB_streamCreate GRB_streamType  type,
const char *  name,
int  rsvd_mbz
 

Creates a file to receive the GRB data packets.

Returns:
The stream handle
Parameters:
type The type of stream to open GRB_STREAM_TYPE_K_FILE or GRB_STREAM_TYPE_K_DATA
name The name of the section or file to create
rsvd_mbz Reserved, must be 0

int GRB_streamFree GRB_stream stream  ) 
 

Frees the memory associated with the contents of the file.

Parameters:
stream The event builder stream handle
After calling GRB_streamFree, the contents and the GRB stream handle are no longer valid.

const GRB_pktHdr* GRB_streamLocate GRB_stream stream,
int  advance
 

Returns a pointer to the current packet and, optionally, advances the current packet to the next packet.

Returns:
Pointer to the current packet or NULL if at EOF
Parameters:
stream The stream handle
advance If non-zero, advance to the internal next packet pointer to the next packet. This is the normal way one would serially read a file of packets

GRB_stream* GRB_streamOpen GRB_streamType  type,
const void *  name,
int  segment
 

Opens a GRB file or data for reading.

Parameters:
type The type of stream to open
  • GRB_STREAM_TYPE_K_FILE
  • GRB_STREAM_TYPE_K_FILESEG
  • GRB_STREAM_TYPE_K_DATA If GRB_STREAM_TYPE_K_FILE is opened, the segment size argument determines whether to the file is processed as a whole or in segments. This option can be specified for at most one stream in an application. It is meant to mimic the single stream properties of the LCB event stream. Specifying GRB_STREAM_TYPE_K_FILESEG always forces the file to processed in segments. (Of course if the file size is smaller than segment, then there is only one segment. This option should always be specified when processing more than one stream, the classic example would be a compare application.
name The name of the GRB file or the address of data section to open
segment Interpretation is dependent on type. If type is
  • GRB_STREAM_TYPE_K_FILE, then this is the largest portion of the file that will be buffered on a read.
    • If this is specified as 0, then a default upper bound of ~32Mbytes will be imposed. This was select purely to avoid long delays (as the whole file is being read in) on very large files. This can be annoying, particularly when working interactively and processing only the first few events.
    • If this is specified as -1, then the there is no segmenting, and the entire file is processed at once.
    • If a value < 64Kbytes is used, the segment size will be set to 64Kbytes. (The segment size must be large enough to hold one maximally sized event).
  • GRB_STREAM_TYPE_K_DATA, then is ignored
Returns:
If successful, the file handle else, NULL

int GRB_streamPktWrite GRB_stream stream,
const GRB_pktHdr *  pkt
 

Writes the specified packet to the output file.

Returns:
Status
Parameters:
stream The output stream handle
pkt The packet to write
It is assumed that the data portion of the packet is in BIG ENDIAN. The packet header is assumed to be in the local representation. If the local endianness is not BIG ENDIAN, the packet header will be byte-swapped to be 32-bit big-endian.

int GRB_streamRead GRB_stream stream  ) 
 

Reads the GRB file associated with the event stream handle istream.

Parameters:
stream A previously opened event builder stream handle
Return values:
0,if successful
-1,if not


Generated on Tue Sep 2 01:25:38 2008 by  doxygen 1.4.4