code::DataCell Class Reference

Inheritance diagram for code::DataCell:

code::DataField List of all members.

Detailed Description

A cell of data.

DataRow uses this type for internal storage.

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


Public Member Functions

 DataCell (const std::string &data="", const std::string &name="SomeCell", const std::string &unit="dimensionless")
 Build from string data.
 DataCell (double data, const std::string &name, const std::string &unit="dimensionless", const std::string &format="%g")
 Build from numeric data.
double value () const
 Return numeric value.
double value (const std::string &units) const
 Return numeric value in the specified units.
std::string str (const std::string &format="%s") const
 Return string value.
SmartPtr< std::string > numericStr (const std::string &unit="dimensionless", const std::string &format="%g") const
 Do numeric conversion, unit conversion, and reformatting back to string.
DataColumn column () const
 Return a DataColumn whose only element is value stored by this DataCell.
bool modify (const W2Unit &val, const std::string &format="%g")
 Store a numeric value in this DataCell.
void modify (const std::string &data)
 Store a string value in this DataCell.
DataField clone () const
 Return a completely separate copy of this field.
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 Attributes

std::string myData
 Internal storage.
std::string myName
 Field name.
std::string myUnit
 Default unit specifier.

Friends

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


Constructor & Destructor Documentation

code::DataCell::DataCell ( const std::string &  data = "",
const std::string &  name = "SomeCell",
const std::string &  unit = "dimensionless" 
)

Build from string data.

By default make an empty string.

code::DataCell::DataCell ( double  data,
const std::string &  name,
const std::string &  unit = "dimensionless",
const std::string &  format = "%g" 
)

Build from numeric data.


Member Function Documentation

DataField code::DataField::clone (  )  const [inline, inherited]

Return a completely separate copy of this field.

Reimplemented in code::DataColumn.

DataColumn code::DataCell::column (  )  const

Return a DataColumn whose only element is value stored by this DataCell.

void code::DataCell::modify ( const std::string &  data  )  [inline]

Store a string value in this DataCell.

bool code::DataCell::modify ( const W2Unit val,
const std::string &  format = "%g" 
)

Store a numeric value in this DataCell.

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

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

Return field ID.

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

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

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

std::string code::DataCell::str ( const std::string &  format = "%s"  )  const

Return string value.

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.

double code::DataCell::value ( const std::string &  units  )  const

Return numeric value in the specified units.

double code::DataCell::value (  )  const

Return numeric value.


Friends And Related Function Documentation

friend class DataColumn [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().

std::string code::DataCell::myData [protected]

Internal storage.

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