GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> GRBP / V1-0-4 > attstream / rhel6-64


Interface   Data Structures   File List   Data Fields   Globals  

ATT_stream.h File Reference

ATT stream Utilities, Interface. More...


Typedefs

typedef enum _ATT_STREAM_TYPE_K ATT_STREAM_TYPE_K
 Standard typedef for _enum ATT_STREAM_TYPE_K.
typedef enum _ATT_STREAM_TYPE_K ATT_streamType
 Typedef for _enum ATT_STREAM_TYPE_K, used in procedure calls.
typedef enum _ATT_STREAM_UNIT_K ATT_STREAM_UNIT_K
 Typedef for enum _ATT_STREAM_UNIT_K.
typedef enum _ATT_STREAM_UNIT_K ATT_streamUnit
 Typedef for enum _ATT_streamUnit.

Enumerations

enum  _ATT_STREAM_TYPE_K {
  ATT_STREAM_TYPE_K_FILE = 0,
  ATT_STREAM_TYPE_K_DATA = 1,
  ATT_STREAM_TYPE_K_FILESEG = 2
}
enum  _ATT_STREAM_UNIT_K {
  ATT_STREAM_UNIT_K_PKTS = 0,
  ATT_STREAM_UNIT_K_EVTS = 1
}
 Enumeration of how to treat the input stream, as packets or events. More...
enum  _ATT_STREAM_PKT_SIZE_K_MAX {
  ATT_STREAM_PKT_SIZE_K_MAX = -1,
  ATT_STREAM_PKT_SIZE_K_DEF = 0
}
 Enumerates the sentinal values used when specifying a packet size. More...

Functions

ATT_streamATT_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_dgmATT_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_attitudeATT_streamAttNext (ATT_stream *stream)
 Returns a pointer to the next attitude record or NULL if exhausted.
ATT_streamATT_streamCreate (ATT_streamType type, const char *name, int rsvd_mbz)
 Creates a file to receive the ATT data packets.
int ATT_streamDbgWrite (ATT_stream *stream, const ATT_dgm *dgm)
int ATT_streamClose (ATT_stream *stream)
 Closes the file after it has been read.
int ATT_streamFree (ATT_stream *stream)
 Frees the memory associated with the contents of the file.

Variables

enum _ATT_STREAM_PKT_SIZE_K_MAX ATT_STREAM_PKT_SIZE_K


Detailed Description

ATT stream Utilities, Interface.

Author:
JJRussell - russell@slac.stanford.edu
    CVS $Id: ATT_stream.h,v 1.1 2007/07/05 22:14:45 russell Exp $

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

Enumeration Type Documentation

Enumerates the sentinal values used when specifying a packet size.

Enumerator:
ATT_STREAM_PKT_SIZE_K_MAX  Typedef of struct _ATT_STREAM_PKT_SIZE_K.

Use the maximum packet size

ATT_STREAM_PKT_SIZE_K_DEF  Use the default packet size set in the stream handle

Enumerator:
ATT_STREAM_TYPE_K_FILE  Stream type is a file
ATT_STREAM_TYPE_K_DATA  Stream type is a data section
ATT_STREAM_TYPE_K_FILESEG  Stream type is a segmented file

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

Enumerator:
ATT_STREAM_UNIT_K_PKTS  Treat the stream as a stream of packets
ATT_STREAM_UNIT_K_EVTS  Treat the stream as a stream of events


Function Documentation

const ATT_attitude * ATT_streamAttNext ( ATT_stream stream  ) 

Returns a pointer to the next attitude record or NULL if exhausted.

Returns:
a pointer to the next attitude record or NULL if exhausted
Parameters:
stream The attitude stream

References ATT_streamLocate(), _ATT_stream::bdy, _ATT_streamBody::in, _ATT_istreamBody::lst_att, and _ATT_istreamBody::nxt_att.

int ATT_streamClose ( ATT_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 ATT_streamFree().

References _ATT_streamHeader::close, _ATT_stream::hdr, _streamCloseCbp::prm, and _streamCloseCbp::rtn.

ATT_stream * ATT_streamCreate ( ATT_streamType  type,
const char *  name,
int  rsvd_mbz 
)

Creates a file to receive the ATT data packets.

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

References ATT_STREAM_DIR_K_WRITE, ATT_STREAM_TYPE_K_DATA, ATT_STREAM_TYPE_K_FILE, _ATT_stream::bdy, _ATT_streamHeader::close, _ATT_streamHeader::dir, _ATT_ostreamBody::file, _ATT_streamHeader::free, _ATT_stream::hdr, mem_alloc(), _ATT_ostreamBody::name, _ATT_streamBody::out, _streamCloseCbp::prm, _streamCloseCbp::rtn, and _ATT_streamHeader::type.

int ATT_streamFree ( ATT_stream stream  ) 

Frees the memory associated with the contents of the file.

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

References _ATT_streamHeader::free, _ATT_stream::hdr, and mem_free().

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.

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

References ATT__dgmNext(), _ATT_ctbbdy::attitude, _ATT_ctb::bdy, _ATT_stream::bdy, _ATT_dgm::ctb, _ATT_istreamBody::cur_dgm, dgm_swap(), _ATT_streamBody::in, _ATT_istreamBody::lst_att, _ATT_istreamBody::lst_dgm, and _ATT_istreamBody::nxt_att.

Referenced by ATT_streamAttNext().

ATT_stream * ATT_streamOpen ( ATT_streamType  type,
const void *  name,
int  segment 
)

Opens a ATT file or data for reading.

Parameters:
type The type of stream to open
  • ATT_STREAM_TYPE_K_FILE
  • ATT_STREAM_TYPE_K_FILESEG
  • ATT_STREAM_TYPE_K_DATA If ATT_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 ATT_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 ATT file or the address of data section to open
segment Interpretation is dependent on type. If type is
  • ATT_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).
  • ATT_STREAM_TYPE_K_DATA, then is ignored
Returns:
If successful, the file handle else, NULL

References ATT_STREAM_TYPE_K_DATA, ATT_STREAM_TYPE_K_FILE, ATT_STREAM_TYPE_K_FILESEG, fileOpen(), and map().

int ATT_streamRead ( ATT_stream stream  ) 

Reads the ATT 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

References ATT_STREAM_TYPE_K_FILE, _ATT_stream::bdy, _ATT_istreamBody::buf, _ATT_istreamBody::cur_dgm, fileRead(), _ATT_stream::hdr, _ATT_streamBody::in, _ATT_istreamBody::lst_dgm, _ATT_istreamBody::seg_size, and _ATT_streamHeader::type.


Generated on Tue Nov 29 17:07:24 2011 by  doxygen 1.5.8