sends::chan_entry Class Reference
[Sends Data Classes]

Channel list entry. More...

#include <chan_list.hh>

List of all members.

Public Types

enum  chan_type {
  kUnknown, kOnline, kRawData, kReduced,
  kSecondTrend, kMinuteTrend, kTypeCount
}
enum  data_type {
  kByte1, kInt2, kInt4, kInt8,
  kReal4, kReal8, kComplex8, kComplex16
}
typedef unsigned long source_count
 Source count data type.
typedef unsigned long gps_type
 GPS time data type.

Public Member Functions

 chan_entry (const std::string &name, chan_type type, long access=0, data_type dtype=kReal4, double rate=0, const std::string &source="")
 Channel constructor.
void addSource (const std::string &ftype)
 Add a frame source.
bool available (gps_type t) const
 Test for source availablility.
long getAccess (void) const
 Get channel access level.
data_type dtype (void) const
int data_size (void) const
const std::string & name (void) const
 Get channel name.
source_count getNSource (void) const
 Number of sources.
const std::string & getSource (source_count inx=0) const
 Get source string.
chan_type type (void) const
bool is_source (const std::string &src) const
 Test whether the channel exists in the specified source.
void merge (const chan_entry &ce)
 merge source lists
bool operator< (const chan_entry &ent) const
 Compare two channel entries.
bool operator== (const chan_entry &ent) const
 Compare two channel entries.
bool operator!= (const chan_entry &ent) const
 Compare two channel entries.
double rate (void) const
 Sample rate.

Static Public Member Functions

static data_type getDataCode (const std::string &str)
 Convert string to data type.
static int getDataSize (data_type type)
 Get data type size.
static std::string getDataString (data_type type)
 Convert data type to a string.
static chan_type getTypeCode (const std::string &str)
 Convert string to channel type.
static std::string getTypeString (chan_type type)
 Convert channel type to a string.


Detailed Description

Channel list entry.

The channel list entry contains the channel name, data type, access code and a list of frame types that include the channel. The channel name and channel type are both needed to provide a unique identification of the channel because in some cases, the same channel name is used for both raw and decimated (RDS) data or for minute and second trends. The frame types are used to construct the frame names, e.g. "<site>-<type>-<gps>-<dt>.gwf". The initial implementation (2008.01.22) assumes that the frame lists do not change in time. It may become necessary to add a valid time range to each source data entry to reliably guide the channel source selection.

Author:
John Zweizig
Version:
1.1; Last modified 2008.01.29

Member Typedef Documentation

typedef unsigned long sends::chan_entry::source_count

Source count data type.

Data type used to represent the number of entries in the source list.

typedef unsigned long sends::chan_entry::gps_type

GPS time data type.

Data type used to reprepresent gps times.


Member Enumeration Documentation

Enumerate channel types.

Enumerate channel types.


Constructor & Destructor Documentation

sends::chan_entry::chan_entry ( const std::string &  name,
chan_type  type,
long  access = 0,
data_type  dtype = kReal4,
double  rate = 0,
const std::string &  source = "" 
)

Channel constructor.

Construct a channel entry.

Parameters:
name Full channel name.
type Type of channel
access Minumum level required to access this channel.
dtype Data type code.
rate Sample rate.
source Type code of frame containing the channel.


Member Function Documentation

void sends::chan_entry::addSource ( const std::string &  ftype  ) 

Add a frame source.

Add a new source frame-type string. The source type string contains the site identifier and the frame type, separated by a hyphen, e.g. "H-R".

Parameters:
ftype Source type string.

bool sends::chan_entry::available ( gps_type  t  )  const

Test for source availablility.

Test whether the channel type isavailable at the specified time.

Parameters:
t Test time. @

long sends::chan_entry::getAccess ( void   )  const [inline]

Get channel access level.

Get the access level required to reference this channel.

Returns:
Access level required for this channel.

data_type sends::chan_entry::dtype ( void   )  const [inline]

Get the data type code.

int sends::chan_entry::data_size ( void   )  const [inline]

Get the data type code.

References getDataSize().

static data_type sends::chan_entry::getDataCode ( const std::string &  str  )  [static]

Convert string to data type.

Convert from a data type string to the data_type code.

Parameters:
str Data type string.
Exceptions:
runtime_error if string is unknown.
Returns:
Associated data_type code.

static int sends::chan_entry::getDataSize ( data_type  type  )  [static]

Get data type size.

Get size in bytes of specified data element.

Parameters:
type Data type code.
Returns:
Size in bytes.

Referenced by data_size().

static std::string sends::chan_entry::getDataString ( data_type  type  )  [static]

Convert data type to a string.

Convert a data_type code to a descriptive string.

Parameters:
type Data type to be converted.
Returns:
String describing data type.

const std::string& sends::chan_entry::name ( void   )  const [inline]

Get channel name.

Get a constant reference to the channel name string.

Returns:
const reference to string containing the channel name.

chan_entry::source_count sends::chan_entry::getNSource ( void   )  const [inline]

Number of sources.

Get the number of source frame-types.

Returns:
Number of entries in the source list.

const std::string & sends::chan_entry::getSource ( source_count  inx = 0  )  const [inline]

Get source string.

Get a constant reference to the i'th source frame type string.

Parameters:
inx Index into the source list.
Returns:
Constant reference to string containing the source type.

chan_type sends::chan_entry::type ( void   )  const [inline]

Get the channel type code.

Returns:
Channel type code.

static chan_type sends::chan_entry::getTypeCode ( const std::string &  str  )  [static]

Convert string to channel type.

Convert from a channel type string to the chan_type code.

Parameters:
str Channel type string.
Exceptions:
runtime_error if string is unknown.
Returns:
Associated chan_type code.

static std::string sends::chan_entry::getTypeString ( chan_type  type  )  [static]

Convert channel type to a string.

Convert a chan_type code to a descriptive string.

Parameters:
type Channel type to be converted.
Returns:
String describing channel type.

bool sends::chan_entry::is_source ( const std::string &  src  )  const

Test whether the channel exists in the specified source.

See if channel is available in the named frame type. Note that if the variation of the channel content of the frame types with time is to be supported, this function will have to add a time argument.

Parameters:
src Source name to be tested.
Returns:
True if the channel exists in the specified source.

void sends::chan_entry::merge ( const chan_entry ce  ) 

merge source lists

Merge source list from the argument entry into this entry. This method is implemented by looping over the entries in the argument list and using the addSource method to add in sources one at a time. Although this is hideously inefficient, I expect that the source list will never become more than 2-3 entries long and will only be modified at start-time.

Parameters:
ce Channelentry containing list to be merged.

bool sends::chan_entry::operator< ( const chan_entry ent  )  const [inline]

Compare two channel entries.

The channel name and type fields are compared between two channel entries. The name field is given greater significance than the type field. The result is true if this entry name is less i.e. (name<ent.name || (name==ent.name && type<ent.type)).

Parameters:
ent Channel entry to be compared with this.
Returns:
True if this entry is less.

References mName, and mType.

bool sends::chan_entry::operator== ( const chan_entry ent  )  const [inline]

Compare two channel entries.

The channel name and type fields are compared to between two channel entries and the result is true the entries are equal.

Parameters:
ent Channel entry to be compared with this.
Returns:
True if the entries are equal.

References mName, and mType.

bool sends::chan_entry::operator!= ( const chan_entry ent  )  const [inline]

Compare two channel entries.

The channel name and type fields are compared to between two channel entries and the result is true if the entries are not equal.

Parameters:
ent Channel entry to be compared with this.
Returns:
True if the entries are not equal.

References mName, and mType.

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

Sample rate.

Return the channel sample rate.

Returns:
Sample rate in Hz.


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