framefast::framewriter Class Reference
[Fast frame I/O]

#include <framefast.hh>

List of all members.

Public Types

enum  framepos { framebegin = 0, framebusy, framebreak, frameend }
 frame position More...
typedef std::deque< framebuffer_tframebufferlist
 Set of frame buffers.
typedef std::vector< detector_tdetector_array_t
 Set of detector information.

Public Member Functions

 framewriter (int nFrameLen=1, int nFrame=1, int compress=0, int version=kDefaultFrameVersion)
 ~framewriter ()
framepos status ()
bool setFormat (int nFrameLen=1, int nFrame=1, int compress=0, int version=kDefaultFrameVersion)
int frameLength () const
bool setTime (const Time &time)
bool setDetectorInfo (const detector_t &det)
bool addDetectorInfo (const detector_t &det)
const detector_tgetDetectorInfo (int dnum=0) const
const toc_tgetTOC () const
int nframe () const
Time starttime (int framenum=0) const
Interval duration (int framenum=0) const
Time nexttime () const
bool addData (const adcdata_t &adc, const frvect_t &vect)
bool next ()
bool next (const Time &nextframe)
bool write (basic_frameout *out)
bool getBuffers (framebufferlist &bufs)
int buffers () const
const char * framebuffer (int buffer) const
int bufferlen (int buffer) const
int total () const
void purge ()
void setFilename (const char *filename)
const char * getFilename () const
std::string guessFilename () const
void setFrameNum (int num)
int getFrameNum () const
void setRunNum (int num)
int getRunNum () const

Protected Member Functions

framebuffer_tcurrentBuffer ()
 get the current buffer
bool appendBuffer (const char *dat, int len)
 append data to output buffers
bool beginFile ()
 write frame file header
bool endFile ()
 write frame file trailer (TOC)
bool beginFrame ()
 write frame header
bool endFrame ()
 write frame trailer

Protected Attributes

bool fSwap
 Swap byte order?
int fVersion
 Version.
framepos fFramePos
 Frame position.
Time fTime
 Start time of frame.
Time fNext
 Time of next frame.
int fRunNum
 Run number.
int fFrameNum
 Frame number.
int fFrameLen
 Frame length in seconds.
int fNFrame
 Number of frames per file.
int fCompress
 compression scheme?
int fN
 Current frame counter.
int fTotal
 Total byte count written into the frame buffers so far.
framebufferlist fFrameBuffer
 Data buffer.
detector_array_t fDetector
 Detector information.
toc_t fTOC
 Table of contents.
std::string fFilename
 File name.
ptr_struct fPtr [9]

Classes

class  framebuffer_t
 Frame buffer (data container with smart pointer). More...


Detailed Description

Fast frame writer. brief Fast frame reader.
Author:
Written September 2000 by Daniel Sigg
Version:
1.0

Member Enumeration Documentation

enum framefast::framewriter::framepos

frame position

Enumerator:
framebegin  beginning of frame
framebusy  while writting a frame
framebreak  between frames
frameend  end of frame


Constructor & Destructor Documentation

framefast::framewriter::framewriter ( int  nFrameLen = 1,
int  nFrame = 1,
int  compress = 0,
int  version = kDefaultFrameVersion 
) [explicit]

Constructs a fast frame writer.

Parameters:
nFrameLen frame length in sec
nFrame Number of frames per file
compress Compress data vectors
version Frame specification version brief Default constructor.

framefast::framewriter::~framewriter (  ) 

Destructs a fast frame writer. brief Destructor.


Member Function Documentation

framepos framefast::framewriter::status (  )  [inline]

Returns the status of the frame writer. brief Status of frame writer.

Returns:
status (frame position)

bool framefast::framewriter::setFormat ( int  nFrameLen = 1,
int  nFrame = 1,
int  compress = 0,
int  version = kDefaultFrameVersion 
)

Set the frame format. brief Set the frame format.

Parameters:
nFrame Number of frames per file
nFrameLen Length of each frames (in sec)
compress Compress data vectors
version Frame specification version
Returns:
true if successful

int framefast::framewriter::frameLength (  )  const [inline]

Returns the length of frames. brief Length of frames.

Returns:
Length of frames in sec

bool framefast::framewriter::setTime ( const Time &  time  ) 

Set the time of the next frame. brief Set the frame start time.

Parameters:
time Frame start time
Returns:
true if successful

bool framefast::framewriter::setDetectorInfo ( const detector_t det  ) 

Set the detector information. brief Set the detector information.

Parameters:
det Detector information
Returns:
true if successful

bool framefast::framewriter::addDetectorInfo ( const detector_t det  ) 

Add a detector information. brief Add a detector information.

Parameters:
det Detector information
Returns:
true if successful

const detector_t* framefast::framewriter::getDetectorInfo ( int  dnum = 0  )  const [inline]

Get the detector information. brief Get the detector information.

Parameters:
dnum Detector number
Returns:
pointer to detector information if successful

const toc_t* framefast::framewriter::getTOC (  )  const [inline]

Get the table of contents. brief Get the table of contents.

Returns:
pointer to TOC information if successful

int framefast::framewriter::nframe (  )  const

Gets the number of frames in the file. brief Number of frames.

Returns:
Number of frames

Time framefast::framewriter::starttime ( int  framenum = 0  )  const

Gets the start time of a frame. brief Start time of a frame.

Parameters:
framenum Frame number
Returns:
Start time

Interval framefast::framewriter::duration ( int  framenum = 0  )  const

Gets the duration of a frame. brief Duration of a frame.

Parameters:
framenum Frame number
Returns:
Duration

Time framefast::framewriter::nexttime (  )  const

Gets the time of the next frame (in the next file) brief time of next frame.

Returns:
Next time

bool framefast::framewriter::addData ( const adcdata_t adc,
const frvect_t vect 
)

Add an ADC data vector to the frame. brief Add ADC data.

Parameters:
adc ADC structure
vect Vector structure containing the data
Returns:
true if successful

bool framefast::framewriter::next (  ) 

Moves to the next frame. This will write the current frame into a memory buffer and add it to the frame buffers. During the first call the frame file header gets written first, whereas during the last call the table of contents and the end-of-file marker is appended. The time is increased by the frame length. brief Move to the next frame.

Returns:
true if successful

bool framefast::framewriter::next ( const Time &  nextframe  ) 

Moves to the next frame. This will write the current frame into a memory buffer and add it to the frame buffers. During the first call the frame file header gets written first, whereas during the last call the table of contents and the end-of-file marker is appended. The argument specifies for the start time of the next frame. brief Move to the next frame.

Parameters:
nextframe Start time of next frame
Returns:
true if successful

bool framefast::framewriter::write ( basic_frameout out  ) 

Writes the frame buffers to an output. This will purge the buffers from the frame writer. brief Write a frame.

Returns:
true if successful

bool framefast::framewriter::getBuffers ( framebufferlist bufs  )  [inline]

Get the frame buffers. This will automatically purge the buffers from the frame writer and transfer ownership of the buffers to the caller. brief Get the frame buffers.

Returns:
true if successful

int framefast::framewriter::buffers (  )  const [inline]

Get the number of frame buffers already written. brief Get the number of buffers.

Returns:
Number of buffers

const char* framefast::framewriter::framebuffer ( int  buffer  )  const [inline]

Get a pointer to the frame buffer. brief Get the buffer pointer.

Parameters:
buffer Buffer number
Returns:
Buffer size

int framefast::framewriter::bufferlen ( int  buffer  )  const [inline]

Get the length of the frame buffer. brief Get the frame buffer length.

Parameters:
buffer Buffer number
Returns:
Buffer size

int framefast::framewriter::total (  )  const [inline]

Get the total number of bytes written so far. brief Total frame size.

Returns:
Number of bytes written

void framefast::framewriter::purge (  )  [inline]

Purge the current frame buffers. brief Purge frame buffers.

void framefast::framewriter::setFilename ( const char *  filename  )  [inline]

Set the output file name. brief Set filename.

Parameters:
filename Name of file

const char* framefast::framewriter::getFilename (  )  const [inline]

Get the output file name. brief Get filename.

Returns:
Name of file

std::string framefast::framewriter::guessFilename (  )  const

Guess the basic filename from the detector information and the GPS time (doesn't include directory nor extension). brief Guess filename.

Returns:
Filename

void framefast::framewriter::setFrameNum ( int  num  )  [inline]

Set the frame number. brief Set the frame number.

Parameters:
num frame number

int framefast::framewriter::getFrameNum (  )  const [inline]

Get the frame number. brief Get frame number.

Returns:
frame number

void framefast::framewriter::setRunNum ( int  num  )  [inline]

Set the run number. brief Set the run number.

Parameters:
num run number

int framefast::framewriter::getRunNum (  )  const [inline]

Get the run number. brief Get run number.

Returns:
run number


Member Data Documentation

ptr_struct framefast::framewriter::fPtr[9] [protected]

Pointers to Frame header, detector info, history info, raw data, ADC data, data vector, End of frame, TOC, End of file


The documentation for this class was generated from the following file:
Generated on Sun Mar 8 19:21:14 2009 for dmt by  doxygen 1.5.4