code::DataColumn Class Reference

Inheritance diagram for code::DataColumn:

code::DataField List of all members.

Detailed Description

A column of data.

DataTable uses this type in order to arrange its data by column.

Author:
Thomas E. Vaughan (original)
Author
lakshman
Date
2009/06/02 20:17:37


Public Types

typedef std::vector< std::string > StorageType
 Short-hand.

Public Member Functions

DataColumn clone () const
 Make a completely separate copy of the data.
 DataColumn (const DataCell &dataCell)
 Make a DataColumn from a DataCell.
 DataColumn (const std::string &name="SomeColumn", const std::string &unit="dimensionless")
 Make an empty column.
 DataColumn (size_t size, const std::string &name, const std::string &unit="dimensionless")
 Allocate size elements internally.
 DataColumn (const StorageType &data, const std::string &name, const std::string &unit="dimensionless")
 Copy elements to new internal allocation.
 DataColumn (SmartPtr< StorageType > data, const std::string &name, const std::string &unit="dimensionless")
 Refer to storage allocated elsewhere.
 DataColumn (const std::vector< double > &data, const std::string &name, const std::string &unit="dimensionless", const std::string &format="%g")
 Copy data from an array of numbers.
double dimVal (size_t offset) const
 Return numeric value.
SmartPtr< std::vector< double > > dimVals () const
 Return a smart pointer to vector of numeric values.
SmartPtr< std::string > str (size_t offset, const std::string &format="%s") const
 Return string value.
SmartPtr< StorageTypestrings (const std::string &format="%s") const
 Return string values.
SmartPtr< std::string > numericStr (size_t offset, const std::string &unit="dimensionless", const std::string &format="%g") const
 Do numeric conversion, unit conversion, and reformatting back to string.
SmartPtr< StorageTypenumericStrings (const std::string &unit="dimensionless", const std::string &format="%g") const
 Do numeric conversion, unit conversion, and reformatting back to strings.
bool append (double val, const std::string &unit="dimensionless", const std::string &format="%g")
 Append a number to the end of this DataColumn.
bool append (unsigned long val, const std::string &unit="dimensionless")
 Append a number to the end of this DataColumn.
bool append (long val, const std::string &unit="dimensionless")
 Append a number to the end of this DataColumn.
bool append (int val, const std::string &unit="dimensionless")
 Append a number to the end of this DataColumn.
bool modify (size_t offset, double val, const std::string &unit="dimensionless", const std::string &format="%g")
 Store a numeric value at a particular offset in this DataColumn.
void append (const std::string &appendage)
 Append a string to the end of this DataColumn.
bool modify (size_t offset, const std::string &data)
 Store a string value at a particular offset in this DataColumn.
bool append (const DataCell &cell)
 Append a DataCell to the end of this DataColumn.
bool append (const Angle &a)
bool append (const Length &a)
bool modify (size_t offset, const DataCell &cell)
 Store a DataCell value at a particular offset in this DataColumn.
size_t size () const
 Return the number of elements in this column.
SmartPtr< DataCellcell (size_t offset) const
 Return the DataCell at a particular offset in this DataColumn.
const std::string & name () const
 Return field ID.
const std::string & unit () const
 Return default unit specifier.
bool validUnit (const std::string &unit) const
 Return true only if the internal unit can be converted to the specified unit.

Static Public Attributes

static const size_t bufferSize = 4096
 Size of character buffer used internally for sprintf().

Protected Member Functions

double dimValInternal (size_t offset) const
 Without performing a bounds check, return a double.
bool inBounds (size_t offset) const

Protected Attributes

SmartPtr< StorageTypemyData
 Data.
std::string myName
 Field name.
std::string myUnit
 Default unit specifier.

Friends

class DataSlice
bool operator< (const DataField &a, const DataField &b)
 Allows you to sort DataField objects by their name.


Member Typedef Documentation

typedef std::vector< std::string > code::DataColumn::StorageType

Short-hand.


Constructor & Destructor Documentation

code::DataColumn::DataColumn ( const DataCell dataCell  ) 

Make a DataColumn from a DataCell.

code::DataColumn::DataColumn ( const std::string &  name = "SomeColumn",
const std::string &  unit = "dimensionless" 
)

Make an empty column.

code::DataColumn::DataColumn ( size_t  size,
const std::string &  name,
const std::string &  unit = "dimensionless" 
)

Allocate size elements internally.

code::DataColumn::DataColumn ( const StorageType data,
const std::string &  name,
const std::string &  unit = "dimensionless" 
)

Copy elements to new internal allocation.

code::DataColumn::DataColumn ( SmartPtr< StorageType data,
const std::string &  name,
const std::string &  unit = "dimensionless" 
)

Refer to storage allocated elsewhere.

code::DataColumn::DataColumn ( const std::vector< double > &  data,
const std::string &  name,
const std::string &  unit = "dimensionless",
const std::string &  format = "%g" 
)

Copy data from an array of numbers.


Member Function Documentation

bool code::DataColumn::append ( const Length a  ) 

bool code::DataColumn::append ( const Angle a  ) 

bool code::DataColumn::append ( const DataCell cell  ) 

Append a DataCell to the end of this DataColumn.

Return false on failed unit conversion. Return false on name mismatch. Otherwise, return true.

void code::DataColumn::append ( const std::string &  appendage  ) 

Append a string to the end of this DataColumn.

bool code::DataColumn::append ( int  val,
const std::string &  unit = "dimensionless" 
)

Append a number to the end of this DataColumn.

Return false on failed unit conversion; otherwise, return true.

bool code::DataColumn::append ( long  val,
const std::string &  unit = "dimensionless" 
)

Append a number to the end of this DataColumn.

Return false on failed unit conversion; otherwise, return true.

bool code::DataColumn::append ( unsigned long  val,
const std::string &  unit = "dimensionless" 
)

Append a number to the end of this DataColumn.

Return false on failed unit conversion; otherwise, return true.

bool code::DataColumn::append ( double  val,
const std::string &  unit = "dimensionless",
const std::string &  format = "%g" 
)

Append a number to the end of this DataColumn.

Return false on failed unit conversion; otherwise, return true.

SmartPtr< DataCell > code::DataColumn::cell ( size_t  offset  )  const

Return the DataCell at a particular offset in this DataColumn.

Return NULL pointer on illegal offset.

DataColumn code::DataColumn::clone (  )  const

Make a completely separate copy of the data.

Reimplemented from code::DataField.

double code::DataColumn::dimVal ( size_t  offset  )  const

Return numeric value.

MissingData flag is returned for an out-of-bounds offset.

double code::DataColumn::dimValInternal ( size_t  offset  )  const [protected]

Without performing a bounds check, return a double.

SmartPtr< std::vector< double > > code::DataColumn::dimVals (  )  const

Return a smart pointer to vector of numeric values.

bool code::DataColumn::inBounds ( size_t  offset  )  const [protected]

bool code::DataColumn::modify ( size_t  offset,
const DataCell cell 
)

Store a DataCell value at a particular offset in this DataColumn.

Return false on illegal offset. Return false on failed unit conversion. Return false on name mismatch. Otherwise, return true.

bool code::DataColumn::modify ( size_t  offset,
const std::string &  data 
)

Store a string value at a particular offset in this DataColumn.

Return false on illegal offset; otherwise, return true.

bool code::DataColumn::modify ( size_t  offset,
double  val,
const std::string &  unit = "dimensionless",
const std::string &  format = "%g" 
)

Store a numeric value at a particular offset in this DataColumn.

Return false on failed unit conversion or illegal offset; otherwise, return true.

const std::string& code::DataField::name (  )  const [inline, inherited]

Return field ID.

SmartPtr< std::string > code::DataColumn::numericStr ( size_t  offset,
const std::string &  unit = "dimensionless",
const std::string &  format = "%g" 
) const

Do numeric conversion, unit conversion, and reformatting back to string.

A null SmartPtr is returned for an out-of-bounds offset or an illegal conversion.

SmartPtr< StorageType > code::DataColumn::numericStrings ( const std::string &  unit = "dimensionless",
const std::string &  format = "%g" 
) const

Do numeric conversion, unit conversion, and reformatting back to strings.

For an illegal unit conversion, a NULL SmartPtr is returned.

size_t code::DataColumn::size (  )  const [inline]

Return the number of elements in this column.

SmartPtr< std::string > code::DataColumn::str ( size_t  offset,
const std::string &  format = "%s" 
) const

Return string value.

A null SmartPtr is returned for an out-of-bounds offset.

SmartPtr< StorageType > code::DataColumn::strings ( const std::string &  format = "%s"  )  const

Return string values.

const std::string& code::DataField::unit (  )  const [inline, inherited]

Return default unit specifier.

bool code::DataField::validUnit ( const std::string &  unit  )  const [inherited]

Return true only if the internal unit can be converted to the specified unit.


Friends And Related Function Documentation

friend class DataSlice [friend]

bool operator< ( const DataField a,
const DataField b 
) [friend, inherited]

Allows you to sort DataField objects by their name.


Member Data Documentation

const size_t code::DataField::bufferSize = 4096 [static, inherited]

Size of character buffer used internally for sprintf().

SmartPtr< StorageType > code::DataColumn::myData [protected]

Data.

std::string code::DataField::myName [protected, inherited]

Field name.

std::string code::DataField::myUnit [protected, inherited]

Default unit specifier.


Generated on Fri May 4 13:40:11 2012 for WDSS-IIw2 by  doxygen 1.4.7