code::DataTable Class Reference

Inheritance diagram for code::DataTable:

code::DataType List of all members.

Detailed Description

A collection of DataColumn objects.

Each row is associated with a SpaceTimeRef. If none of the columns corresponds to one of the four well known field names,

DataTable::latKey, DataTable::lonKey, DataTable::hgtKey, or DataTable::epochKey,

then every row corresponds to the same default SpaceTimeRef. In the return value of DataTable::getSpaceTimeRef(recordNum), the relevant row's data in a well known field (such as that associated with latKey) will override the corresponding component of the default SpaceTimeRef.

If the well known field name, DataTable::rowNameKey, is one of the column keys, then each record may be accessed by its row name.

As a descendant of DataType, DataTable can be processed by an Algorithm.

Author:
Thomas E. Vaughan (original)
Author
jbrogden
Date
2009/06/11 19:02:51


Public Types

typedef std::map< std::string,
SmartPtr< DataColumn > > 
AttrMap
 key-value pairs that describe the data.
 RadialSet
 LatLonGrid
 LatLonHeightGrid
 CartesianGrid2D
 Grid2D
 DataTable
 WindField
 WindFieldLLGVolume
 ElevationVolume
 ContourData
 Other
enum  Type {
  RadialSet, LatLonGrid, LatLonHeightGrid, CartesianGrid2D,
  Grid2D, DataTable, WindField, WindFieldLLGVolume,
  ElevationVolume, ContourData, Other
}

Public Member Functions

SmartPtr< DataColumncolumn (const std::string &name)
 Return the DataColumn corresponding to the given name.
SmartPtr< const DataColumncolumn (const std::string &name) const
 Return a read-only reference to the DataColumn corresponding to the given name.
bool hasColumn (const std::string &name) const
 Check if there is a column with the given name in this table.
int rowOffset (const std::string &rowName) const
 Return the offset of the row with this name.
SmartPtr< DataRowrow (size_t rowOffset) const
 Return the row at the specified offset.
SmartPtr< DataRowrow (const std::string &rowName) const
 Return the row with the specified name.
SmartPtr< DataCellcell (size_t rowOffset, const std::string &columnName) const
 Return the cell at the specified row offset and column name.
SmartPtr< DataCellcell (const std::string &rowName, const std::string &columnName) const
 Return the cell at the specified row name and column name.
SmartPtr< std::vector< std::string > > columnNames () const
 Return the column names.
SmartPtr< std::vector< std::string > > rowNames () const
 Return the row names.
void setRowNameKey (const std::string &rowIdentifier)
 By default, we will look for a column named "RowName" when asked to find columns.
const std::string & getRowNameKey () const
 Unique identifier column for each row of table.
size_t numRows () const
 Return the number of rows.
size_t numCols () const
 Return the number of columns.
bool insertColumn (const DataColumn &newColumn)
 Insert a DataColumn.
bool insertColumn (SmartPtr< DataColumn > newColumn)
 Insert a DataColumn.
bool insertRow (const DataRow &newRow)
 Insert a DataRow.
virtual void invoke (Algorithm &algorithm)
 Allow an Algorithm to process this particular descendant of DataType.
bool modify (const std::string &rowName, const DataCell &cell)
 Modify the contents of a particular DataCell in a particular row.
bool modify (size_t rowOffset, const DataCell &cell)
 Modify the contents of a particular DataCell in a particular row.
bool modify (const std::string &rowName, const DataRow &row)
 Modify the contents of each DataCell in a set of DataCells on a particular row.
bool replaceColumn (const DataColumn &newColumn)
bool modify (size_t rowOffset, const DataRow &row)
 Modify the contents of each DataCell in a set of DataCells on a particular row.
 DataTable (const SpaceTimeRef &tableSpaceTimeRef=SpaceTimeRef(), const StorageType &columns=StorageType())
 Allows you to construct a DataTable with as much data as you currently have.
SmartPtr< TrackforecastTrack (const std::string &rowName) const
 Return the forecast track for the given row name.
SmartPtr< TrackforecastTrack (size_t rowOffset) const
 Return the forecast track for the given row offset.
bool setForecastTrack (size_t row, SmartPtr< Track >)
 Define a forecast track for the given row offset.
bool setForecastTrack (const std::string &rowName, SmartPtr< Track >)
 Define a forecast track for the given row name.
SmartPtr< std::vector< SmartPtr<
Track > > > 
forecastTracks ()
 Return all forecast tracks at once.
bool setForecastTracks (SmartPtr< std::vector< SmartPtr< Track > > >)
 Define all forecast tracks at once.
bool hasTracks () const
SmartPtr< TimeHeightTrendDatatimeHeightTrend (const std::string &rowName) const
 Return the time height trend for the given row name.
SmartPtr< TimeHeightTrendDatatimeHeightTrend (size_t rowOffset) const
 Return the time height trend for the given row offset.
bool setTimeHeightTrend (size_t row, SmartPtr< TimeHeightTrendData >)
 Define a time height trend for the given row offset.
bool setTimeHeightTrend (const std::string &rowName, SmartPtr< TimeHeightTrendData >)
 Define a time height trend for the given row name.
SmartPtr< std::vector< SmartPtr<
TimeHeightTrendData > > > 
timeHeightTrends ()
 Return all time height trends at once.
bool setTimeHeightTrends (SmartPtr< std::vector< SmartPtr< TimeHeightTrendData > > >)
 Define all time height trends at once.
bool hasTimeHeightTrends () const
SpaceTimeRef getSpaceTimeRef (size_t rowOffset) const
 Return the SpaceTimeRef that corresponds to a particular row offset.
SpaceTimeRef getSpaceTimeRef (const std::string &rowName) const
 Return the SpaceTimeRef that corresponds to a particular row name.
virtual SpaceTimeRef getSpaceTimeRef () const
 Return the SpaceTimeRef for this DataTable as a whole.
void setSpaceTimeRef (const SpaceTimeRef &ref)
 Set the SpaceTimeRef for this DataTable as a whole.
virtual ~DataTable ()
 Make delete call descendant's destructor.
virtual short getType () const
 Get enum type of this class.
std::string getTypeClassName () const
 returns a string such as RadialSet, LatLonGrid, etc.
void copyDataType (const DataType &dt)
 A convenience function provided for subclasses that implement clone() -- will copy into this data type all the attributes in the type dt.
const std::string & getTypeName () const
 Return the TypeName of this DataType.
void setTypeName (const std::string &)
 Set the TypeName of this DataType.
SmartPtr< DataCellgetAttributeValue (const std::string &key) const
 Return a single value associated with an attribute key corresponding to the function's argument.
bool getAttributeValue (const std::string &key, std::string &setme) const
 Assign `setme' with the attribute corresponding to `key'.
bool getAttributeValue (const std::string &key, double &setme) const
 Assign `setme' with the attribute corresponding to `key'.
void setAttributeValue (const std::string &key, const std::string &value, const std::string &unit="dimensionless")
 Set a single-valued attribute that describes this DataType.
void setAttributeValue (const std::string &key, double value, const std::string &unit="dimensionless", const std::string &format="%g")
 Set a single-valued attribute that describes this DataType.
void setAttribute (const std::string &key, SmartPtr< DataColumn > value)
 Set a multiple-valued attribute that describes this DataType.
SmartPtr< DataColumngetAttribute (const std::string &key) const
 Get the attribute value for a particular key.
const AttrMapgetAttributes () const
 Get the entire map of attributes available for this data type.
virtual double getRawValue (const Location &, bool=false) const
 Gets raw value from data set.
virtual TimeInterval getExpiryInterval () const
 Return 15 minutes as the length of time for which this DataType is valid.
bool hasQuality () const
const DataTypegetQuality () const
void setQuality (SmartPtr< DataType > dt)
void clearAttributes ()

Static Public Attributes

static const char *const latKey
 Well known column name for latitude.
static const char *const lonKey
 Well known column name for longitude.
static const char *const hgtKey
 Well known column name for height.
static const char *const epochKey
 Well known column name for time.
static const char *const rowNameKey
 Well known column name for row name.
static const char *const rowNameUsageKey
 Well known column name for the usage count of the row name.
static const char *const timeFirstDetectionKey
 Well known column name for the time of the first detection of the row name.
static const char *const rankKey
 Well known column name for rank.
static const std::string IsTableData
static const std::string Unit
static const std::string ColorMap
static const std::string ExpiryInterval

Protected Types

typedef std::map< std::string,
DataColumn
StorageType
 Convenience.
typedef StorageType::const_iterator const_iterator
 Convenience.
typedef StorageType::iterator iterator
 Convenience.

Protected Member Functions

const_iterator begin () const
 Beginning of myColumns.
const_iterator end () const
 End of myColumns.
iterator begin ()
 Beginning of myColumns.
iterator end ()
 End of myColumns.
void initRowOffsets ()
virtual void deep_copy (const DataType &source)

Protected Attributes

StorageType myColumns
 Data are stored by column.
SpaceTimeRef myEvent
 Space-time point most closely associated with this DataTable object as a whole.
std::map< std::string, size_t > myRowOffsets
 Mapping from row name to row offset.
SmartPtr< std::vector< SmartPtr<
Track > > > 
myForecastTracks
 A forecast track for each row.
SmartPtr< std::vector< SmartPtr<
TimeHeightTrendData > > > 
myTimeHeightTrends
 A time-height-trend for each row.
std::string myRowNameKey


Member Typedef Documentation

typedef std::map< std::string, SmartPtr<DataColumn> > code::DataType::AttrMap [inherited]

key-value pairs that describe the data.

typedef StorageType::const_iterator code::DataTable::const_iterator [protected]

Convenience.

typedef StorageType::iterator code::DataTable::iterator [protected]

Convenience.

typedef std::map< std::string, DataColumn > code::DataTable::StorageType [protected]

Convenience.


Member Enumeration Documentation

enum code::DataType::Type [inherited]

Enumerator:
RadialSet 
LatLonGrid 
LatLonHeightGrid 
CartesianGrid2D 
Grid2D 
DataTable 
WindField 
WindFieldLLGVolume 
ElevationVolume 
ContourData 
Other 


Constructor & Destructor Documentation

code::DataTable::DataTable ( const SpaceTimeRef tableSpaceTimeRef = SpaceTimeRef(),
const StorageType columns = StorageType() 
)

Allows you to construct a DataTable with as much data as you currently have.

You can add more data with insertColumn and insertRow.

Parameters:
tableSpaceTimeRef The SpaceTimeRef for the table as a whole
columns All the columns in the table filled with data

virtual code::DataTable::~DataTable (  )  [virtual]

Make delete call descendant's destructor.


Member Function Documentation

iterator code::DataTable::begin (  )  [inline, protected]

Beginning of myColumns.

const_iterator code::DataTable::begin (  )  const [inline, protected]

Beginning of myColumns.

SmartPtr< DataCell > code::DataTable::cell ( const std::string &  rowName,
const std::string &  columnName 
) const

Return the cell at the specified row name and column name.

SmartPtr< DataCell > code::DataTable::cell ( size_t  rowOffset,
const std::string &  columnName 
) const

Return the cell at the specified row offset and column name.

void code::DataType::clearAttributes (  )  [inline, inherited]

SmartPtr< const DataColumn > code::DataTable::column ( const std::string &  name  )  const

Return a read-only reference to the DataColumn corresponding to the given name.

Return a null SmartPtr<const DataColumn> if no such name exists.

SmartPtr< DataColumn > code::DataTable::column ( const std::string &  name  ) 

Return the DataColumn corresponding to the given name.

Return a null SmartPtr<DataColumn> if no such name exists.

SmartPtr< std::vector< std::string > > code::DataTable::columnNames (  )  const

Return the column names.

void code::DataType::copyDataType ( const DataType dt  )  [inherited]

A convenience function provided for subclasses that implement clone() -- will copy into this data type all the attributes in the type dt.

Attributes with the same name will be over-written, other attributes will remain unchanged.

virtual void code::DataType::deep_copy ( const DataType source  )  [inline, protected, virtual, inherited]

iterator code::DataTable::end (  )  [inline, protected]

End of myColumns.

const_iterator code::DataTable::end (  )  const [inline, protected]

End of myColumns.

SmartPtr< Track > code::DataTable::forecastTrack ( size_t  rowOffset  )  const

Return the forecast track for the given row offset.

SmartPtr< Track > code::DataTable::forecastTrack ( const std::string &  rowName  )  const

Return the forecast track for the given row name.

SmartPtr< std::vector< SmartPtr< Track > > > code::DataTable::forecastTracks (  ) 

Return all forecast tracks at once.

SmartPtr< DataColumn > code::DataType::getAttribute ( const std::string &  key  )  const [inherited]

Get the attribute value for a particular key.

Parameters:
key attribute key
Returns:
value attribute value in unit-safe manner, or an invalid SmartPtr on error.
See also:
getAttributeValue()

getAttributes() if you don't know the attribute key.

const AttrMap& code::DataType::getAttributes (  )  const [inline, inherited]

Get the entire map of attributes available for this data type.

See also:
getAttribute for a more selective get.

getAttributeValue for a convenient get.

bool code::DataType::getAttributeValue ( const std::string &  key,
double &  setme 
) const [inherited]

Assign `setme' with the attribute corresponding to `key'.

Returns:
true on success; false if no such attribute exists

bool code::DataType::getAttributeValue ( const std::string &  key,
std::string &  setme 
) const [inherited]

Assign `setme' with the attribute corresponding to `key'.

Returns:
true on success; false if no such attribute exists

SmartPtr< DataCell > code::DataType::getAttributeValue ( const std::string &  key  )  const [inherited]

Return a single value associated with an attribute key corresponding to the function's argument.

If no such attribute key exists, then return the NULL SmartPtr. In case multiple values are associated with the key, only the first item is returned.

See also:
getAttribute() to get all values.

virtual TimeInterval code::DataType::getExpiryInterval (  )  const [virtual, inherited]

Return 15 minutes as the length of time for which this DataType is valid.

Override this function in the descendant of DataType as appropriate.

Reimplemented in code::DEM.

const DataType& code::DataType::getQuality (  )  const [inline, inherited]

virtual double code::DataType::getRawValue ( const Location ,
bool  = false 
) const [inline, virtual, inherited]

Gets raw value from data set.

Reimplemented in code::CartesianGrid2D, code::CartesianGrid3D, code::ElevationVolume, code::LatLonGrid, code::LatLonHeightGrid, code::RadialSet, code::SparseGrid, and code::WindFieldLLGVolume.

const std::string& code::DataTable::getRowNameKey (  )  const [inline]

Unique identifier column for each row of table.

virtual SpaceTimeRef code::DataTable::getSpaceTimeRef (  )  const [virtual]

Return the SpaceTimeRef for this DataTable as a whole.

Implements code::DataType.

SpaceTimeRef code::DataTable::getSpaceTimeRef ( const std::string &  rowName  )  const

Return the SpaceTimeRef that corresponds to a particular row name.

Return the default SpaceTimeRef if no such record offset exists.

SpaceTimeRef code::DataTable::getSpaceTimeRef ( size_t  rowOffset  )  const

Return the SpaceTimeRef that corresponds to a particular row offset.

Return the default SpaceTimeRef if no such record offset exists.

virtual short code::DataTable::getType (  )  const [inline, virtual]

Get enum type of this class.

Reimplemented from code::DataType.

std::string code::DataType::getTypeClassName (  )  const [inherited]

returns a string such as RadialSet, LatLonGrid, etc.

See the enum Type for all the possible options. Subclasses need only to over-ride getType()

const std::string& code::DataType::getTypeName (  )  const [inherited]

Return the TypeName of this DataType.

bool code::DataTable::hasColumn ( const std::string &  name  )  const

Check if there is a column with the given name in this table.

bool code::DataType::hasQuality (  )  const [inline, inherited]

bool code::DataTable::hasTimeHeightTrends (  )  const

bool code::DataTable::hasTracks (  )  const

void code::DataTable::initRowOffsets (  )  [protected]

bool code::DataTable::insertColumn ( SmartPtr< DataColumn newColumn  ) 

Insert a DataColumn.

If the DataColumn to be inserted does not correspond to the data already in this DataTable, or if the DataColumn is the wrong size, then do not insert it; issue a warning; and return false.

Otherwise, return true.

bool code::DataTable::insertColumn ( const DataColumn newColumn  ) 

Insert a DataColumn.

If the DataColumn to be inserted does not correspond to the data already in this DataTable, or if the DataColumn is the wrong size, then do not insert it; issue a warning; and return false.

Otherwise, return true.

bool code::DataTable::insertRow ( const DataRow newRow  ) 

Insert a DataRow.

If the DataRow to be inserted does not correspond to the first data to be inserted, or if the DataRow is the wrong size, then do not insert it; issue a warning; and return false.

Otherwise, return true.

virtual void code::DataTable::invoke ( Algorithm algorithm  )  [virtual]

Allow an Algorithm to process this particular descendant of DataType.

Reimplemented from code::DataType.

bool code::DataTable::modify ( size_t  rowOffset,
const DataRow row 
)

Modify the contents of each DataCell in a set of DataCells on a particular row.

The name of every DataCell in the input DataRow must match a column name in this DataTable. If even one DataCell name fails to match a DataColumn in this DataTable, then perform no action, and return false; otherwise, return true.

Parameters:
rowOffset The offset of the row in which DataCells are to be modified.
row Object containing new DataCells.

bool code::DataTable::modify ( const std::string &  rowName,
const DataRow row 
)

Modify the contents of each DataCell in a set of DataCells on a particular row.

The name of every DataCell in the input DataRow must match a column name in this DataTable. If even one DataCell name fails to match a DataColumn in this DataTable, then perform no action, and return false; otherwise, return true.

Parameters:
rowName The name of the row in which DataCells are to be modified.
row Object containing new DataCells.

bool code::DataTable::modify ( size_t  rowOffset,
const DataCell cell 
)

Modify the contents of a particular DataCell in a particular row.

If the name of the new cell does not match any column name, then perform no action, and return false; otherwise, return true.

Parameters:
rowOffset The offset of the row in which a DataCell is to be modified.
cell Object specifying the column name and the new data.

bool code::DataTable::modify ( const std::string &  rowName,
const DataCell cell 
)

Modify the contents of a particular DataCell in a particular row.

If the name of the new cell does not match any column name, then perform no action, and return false; otherwise, return true.

Parameters:
rowName The name of the row in which a DataCell is to be modified.
cell Object specifying the column name and the new data.

size_t code::DataTable::numCols (  )  const [inline]

Return the number of columns.

size_t code::DataTable::numRows (  )  const

Return the number of rows.

bool code::DataTable::replaceColumn ( const DataColumn newColumn  ) 

SmartPtr< DataRow > code::DataTable::row ( const std::string &  rowName  )  const

Return the row with the specified name.

Return a null SmartPtr<DataRow> if the row name does not exist.

SmartPtr< DataRow > code::DataTable::row ( size_t  rowOffset  )  const

Return the row at the specified offset.

Return a null SmartPtr<DataRow> if the offset is out of bounds.

SmartPtr< std::vector< std::string > > code::DataTable::rowNames (  )  const

Return the row names.

Return a null SmartPtr<> if there is no column whose name corresponds to rowNameKey.

int code::DataTable::rowOffset ( const std::string &  rowName  )  const

Return the offset of the row with this name.

Returns:
a negative number if there is no row with this name.
Since the row-offset methods are much more efficient, it is preferred that you obtain the row offset and use the row-offset form of those methods.

void code::DataType::setAttribute ( const std::string &  key,
SmartPtr< DataColumn value 
) [inherited]

Set a multiple-valued attribute that describes this DataType.

If value is 0 (i.e. invalid), this attribute will be removed from the map.

void code::DataType::setAttributeValue ( const std::string &  key,
double  value,
const std::string &  unit = "dimensionless",
const std::string &  format = "%g" 
) [inherited]

Set a single-valued attribute that describes this DataType.

This is a convenience function that allows you to set a dimensionless number as the value of an attribute.

If the attribute key does not already exist, then it will be constructed.

See also:
setAttribute() to set multiple values for an attribute.

void code::DataType::setAttributeValue ( const std::string &  key,
const std::string &  value,
const std::string &  unit = "dimensionless" 
) [inherited]

Set a single-valued attribute that describes this DataType.

This is a convenience function that allows you to set a text string as the value of an attribute.

If the attribute key does not already exist, then it will be constructed. The empty string may NOT be used as a value for the attribute; this function will return immediately if the value is the empty string.

See also:
setAttribute() to set multiple values for an attribute.

bool code::DataTable::setForecastTrack ( const std::string &  rowName,
SmartPtr< Track  
)

Define a forecast track for the given row name.

bool code::DataTable::setForecastTrack ( size_t  row,
SmartPtr< Track  
)

Define a forecast track for the given row offset.

bool code::DataTable::setForecastTracks ( SmartPtr< std::vector< SmartPtr< Track > > >   ) 

Define all forecast tracks at once.

void code::DataType::setQuality ( SmartPtr< DataType dt  )  [inline, inherited]

void code::DataTable::setRowNameKey ( const std::string &  rowIdentifier  ) 

By default, we will look for a column named "RowName" when asked to find columns.

You can change that to look for a column named "STID" by passing in STID here.

void code::DataTable::setSpaceTimeRef ( const SpaceTimeRef ref  ) 

Set the SpaceTimeRef for this DataTable as a whole.

bool code::DataTable::setTimeHeightTrend ( const std::string &  rowName,
SmartPtr< TimeHeightTrendData  
)

Define a time height trend for the given row name.

bool code::DataTable::setTimeHeightTrend ( size_t  row,
SmartPtr< TimeHeightTrendData  
)

Define a time height trend for the given row offset.

bool code::DataTable::setTimeHeightTrends ( SmartPtr< std::vector< SmartPtr< TimeHeightTrendData > > >   ) 

Define all time height trends at once.

void code::DataType::setTypeName ( const std::string &   )  [inherited]

Set the TypeName of this DataType.

SmartPtr< TimeHeightTrendData > code::DataTable::timeHeightTrend ( size_t  rowOffset  )  const

Return the time height trend for the given row offset.

SmartPtr< TimeHeightTrendData > code::DataTable::timeHeightTrend ( const std::string &  rowName  )  const

Return the time height trend for the given row name.

SmartPtr< std::vector< SmartPtr< TimeHeightTrendData > > > code::DataTable::timeHeightTrends (  ) 

Return all time height trends at once.


Member Data Documentation

const std::string code::DataType::ColorMap [static, inherited]

const char* const code::DataTable::epochKey [static]

Well known column name for time.

const std::string code::DataType::ExpiryInterval [static, inherited]

const char* const code::DataTable::hgtKey [static]

Well known column name for height.

const std::string code::DataType::IsTableData [static, inherited]

const char* const code::DataTable::latKey [static]

Well known column name for latitude.

const char* const code::DataTable::lonKey [static]

Well known column name for longitude.

StorageType code::DataTable::myColumns [protected]

Data are stored by column.

SpaceTimeRef code::DataTable::myEvent [protected]

Space-time point most closely associated with this DataTable object as a whole.

SmartPtr< std::vector< SmartPtr< Track > > > code::DataTable::myForecastTracks [protected]

A forecast track for each row.

std::string code::DataTable::myRowNameKey [protected]

std::map< std::string, size_t > code::DataTable::myRowOffsets [protected]

Mapping from row name to row offset.

SmartPtr< std::vector< SmartPtr<TimeHeightTrendData> > > code::DataTable::myTimeHeightTrends [protected]

A time-height-trend for each row.

const char* const code::DataTable::rankKey [static]

Well known column name for rank.

const char* const code::DataTable::rowNameKey [static]

Well known column name for row name.

const char* const code::DataTable::rowNameUsageKey [static]

Well known column name for the usage count of the row name.

(WILL SOON BE OBSOLETE).

const char* const code::DataTable::timeFirstDetectionKey [static]

Well known column name for the time of the first detection of the row name.

const std::string code::DataType::Unit [static, inherited]


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