sends::segment Class Reference
[Sends Data Classes]

Data segment descriptor. More...

#include <segment.hh>

List of all members.

Public Types

typedef unsigned long gps_type
typedef unsigned long count_type
typedef chan_list::chan_index chan_index

Public Member Functions

 segment (void)
 Constructor.
 ~segment (void)
 Segment destructor.
bool canUse (int bufclass) const
 Test usable.
chan_index chan (void) const
 Get channel index.
unsigned long dataIndex (gps_type gps) const
 Calculate data position.
std::ostream & dump (std::ostream &out) const
 Dump segment status.
bool empty (void) const
 Test empty.
void extend (const void *data, count_type inx, count_type length)
 Extend data.
void fill_lock (void)
 Lock the segment for filling.
void fill_unlock (void)
 Unlock the fill mutex.
bool full (void) const
 Test full.
int getBufClass (void) const
 Get buffer class.
gps_type getEndGPS (void) const
 Get end time.
gps_type getMaxGPS (void) const
 Get max time.
gps_type getReserveGPS (void) const
 Get sreserve time.
gps_type getStartGPS (void) const
 Get start time.
count_type getUseCount (void) const
 Get use count.
bool in_segment (gps_type gps) const
 Test if time is in this segment.
bool inUse (void) const
 Test if the segment is in use.
bool operator< (const segment &seg) const
 compare time order of two segments.
double rate (void) const
 Sample rate.
const char * refData (gps_type gps) const
 Return pointer to specified data.
char * refData (gps_type gps)
 Return pointer to specified data.
void release (void)
 Release and clear the segment.
bool reserve (gps_type start, gps_type stop)
 Extend reserved buffer space.
void set_buffer (buffer *bufpt, int btype)
 Set the buffer.
void set_segment (chan_index chan, double rate, int len, gps_type start)
 Set up a buffer.
void use (void)
 Use the segment.
void unuse (void)
 Unuse the segment.

Static Public Member Functions

static std::ostream & dump_header (std::ostream &out)
 Dump status header.


Detailed Description

Data segment descriptor.

The segments class contains all the information about an existing (or soon to exist) segment of channel data.

Author:
J.Zweizig
Version:
1.0; Last modified December 31, 2007

Member Typedef Documentation

typedef unsigned long sends::segment::gps_type

Data type used for start and stop times.

typedef unsigned long sends::segment::count_type

Data type used for use count.

Copy channel index from the chan_list class. The channel index is used as a to indicate whic channel the segment data are from.


Constructor & Destructor Documentation

sends::segment::segment ( void   ) 

Constructor.

Construct a segment descriptor.

sends::segment::~segment ( void   ) 

Segment destructor.

Destroy a segment descriptor.


Member Function Documentation

bool sends::segment::canUse ( int  bufclass  )  const [inline]

Test usable.

Test whether the segment can be taken for a buffer class specified. The sement must be unused (mUseCount == 0) and have the sppropriate buffer class. A search buffer class of -1 selects a segment with no allocated buffer.

Parameters:
bufclass Class of buffer being searched for.
Returns:
True if segment can be used.

segment::chan_index sends::segment::chan ( void   )  const [inline]

Get channel index.

Get the channel index for the channel being stored by this segment descriptor.

Returns:
Index of channel whose data are contained in segment.

unsigned long sends::segment::dataIndex ( gps_type  gps  )  const

Calculate data position.

Get the index of the specified time in the data buffer.

Parameters:
gps Time to be calculated.
Returns:
Index to specified data.

std::ostream& sends::segment::dump ( std::ostream &  out  )  const

Dump segment status.

Dump the status of the segment.

Parameters:
out Output stream reference.
Returns:
Output stream reference.

static std::ostream& sends::segment::dump_header ( std::ostream &  out  )  [static]

Dump status header.

Dump the segment status header.

Parameters:
out Output stream reference.
Returns:
Output stream reference.

bool sends::segment::empty ( void   )  const [inline]

Test empty.

Test whether the segment buffer is undefined or empty.

Returns:
True if the segment buffer is empty.

void sends::segment::extend ( const void *  data,
count_type  inx,
count_type  length 
)

Extend data.

The specified data are appended to thos already in the data buffer.

Parameters:
data Data to be appended to the segment.
inx Index of data to be added to the segment.
length Length of data words to be added to the segment.

void sends::segment::fill_lock ( void   ) 

Lock the segment for filling.

Lock the segment to add data. The data position and currently existing data (as defined by the start and stop times) remain available for read access. No manipulation of the stop time, or the reserved data time should occurr without fist issuing a fill_lock request.

void sends::segment::fill_unlock ( void   ) 

Unlock the fill mutex.

Unlock the segment for filling.

bool sends::segment::full ( void   )  const [inline]

Test full.

Test whether the segment buffer is full.

Returns:
True if full.

int sends::segment::getBufClass ( void   )  const [inline]

Get buffer class.

Return the buffer class code of the buffer allocated for this segment. If no buffer is allocated, the class code is set to -1.

Returns:
Buffer class code.

segment::gps_type sends::segment::getEndGPS ( void   )  const [inline]

Get end time.

Get data end time.

Returns:
Data end time.

segment::gps_type sends::segment::getMaxGPS ( void   )  const [inline]

Get max time.

Get buffer full time.

Returns:
Buffer max time.

segment::gps_type sends::segment::getReserveGPS ( void   )  const [inline]

Get sreserve time.

Get data reserve time.

Returns:
Data reserve time.

segment::gps_type sends::segment::getStartGPS ( void   )  const [inline]

Get start time.

Get data Start time.

Returns:
Data start time.

segment::count_type sends::segment::getUseCount ( void   )  const [inline]

Get use count.

Get the current use count. The getUseCount method is not implicitly sychronized using a mutex so unless the caller issues a read-lock the count may be modified at any time after it is used.

Returns:
Use count.

bool sends::segment::in_segment ( gps_type  gps  )  const [inline]

Test if time is in this segment.

Test whether the specified time is within the range covered by this segment.

Parameters:
gps Time to be tested.
Returns:
True if specified time is in the segment time range.

bool sends::segment::inUse ( void   )  const [inline]

Test if the segment is in use.

Test whether this segment is in use, i.e. if the use count is non-zero.

Returns:
True if the segment is in use.

bool sends::segment::operator< ( const segment seg  )  const [inline]

compare time order of two segments.

Compare the times of two segment objects. The l.h.s. segment is less if its stop time is before or equal to the start time of the r.h.s. segment.

Parameters:
seg Segment to be compared to this.
Returns:
True if this segment is before the argument segment.

References mStart.

double sends::segment::rate ( void   )  const [inline]

Sample rate.

Return the sample rate in Hz.

Returns:
Sample rate in Hz.

const char* sends::segment::refData ( gps_type  gps  )  const

Return pointer to specified data.

Return a constant pointer to the data item at the specified GPS time.

Parameters:
gps Gps time of requested data.
Returns:
Consant pointer to data sample at specified time.

char* sends::segment::refData ( gps_type  gps  ) 

Return pointer to specified data.

Return a pointer to the data item at the specified GPS time.

Parameters:
gps Gps time of requested data.
Returns:
Pointer to data sample at specified time.

void sends::segment::release ( void   ) 

Release and clear the segment.

Release the buffer and clear the segment.

bool sends::segment::reserve ( gps_type  start,
gps_type  stop 
)

Extend reserved buffer space.

Extend buffer space to the specified time by incrementing the reserved pointer.

Parameters:
start start of reserved interval.
stop Time at end of buffer space.

void sends::segment::set_buffer ( buffer bufpt,
int  btype 
)

Set the buffer.

Set the buffer to one of the specified type from the pool manager provided.

Parameters:
bufpt Buffer address.
btype Buffer type code.
Returns:
Writeable reference to the specified segment.

void sends::segment::set_segment ( chan_index  chan,
double  rate,
int  len,
gps_type  start 
)

Set up a buffer.

Set the buffer content information to as appropriate for the specified channel and start-time.

Parameters:
chan Index of channel to be assigned to the segment.
rate Channel sample rate
len Channel data word length
start Start time of segment

void sends::segment::use ( void   ) 

Use the segment.

Increment the use count for this segment.

void sends::segment::unuse ( void   ) 

Unuse the segment.

Decrement the use count for this segment.


The documentation for this class was generated from the following file:

Generated on Tue Jun 10 12:18:12 2008 for SENDS by  doxygen 1.5.5