TableInfo Class Reference

#include <TableInfo.h>

Collaboration diagram for TableInfo:
Collaboration graph
[legend]

List of all members.

Public Types

enum  ErrorCode { ColNotFound = -1 }

Public Member Functions

 TableInfo ()
 Constructor.
 ~TableInfo ()
 Destructor.
void addName (const std::string &name, const std::string &form)
 Set attribute properties.
void addTag (const std::string &name, const std::string &tag, const std::string &value)
 Set a --/ tag and its value for the given attribute name.
void setTableName (const std::string &aName)
 Set the name of this table.
const std::string & readTag (int aAttrNum, const std::string &aTagName) const
 Read the value associated with given tagname.
int getAttNo (const std::string &aName) const
 Return information about a given attribute name.
unsigned getNumAttributes () const
 return the number of attributes in the table
const std::string & getTableName () const
 Return the name of this table.
const std::string & getName (int aAttrNum) const
 Return the name of the n'th attribute.
const std::string & getFormat (int aAttrNum) const
 Return the format associated with the n'th attribute.
const std::string & getUnits (int aAttrNum) const
 Return the units associated with the n'th attribute.
const std::string & getDefault (int aAttrNum) const
const std::string & getUsingValue (int aAttrNum) const
const std::string & getFitsColumnName (int aAttrNum) const
const std::string & getFitsKeywordName (int aAttrNum) const
const std::string & getDiscrValues (int aAttrNum) const
const std::string & getRange (int aAttrNum) const
bool isDetection ()
 Checks if table is one of the detection tables.
bool isNumeric (int attNo)
 Asks if the format of the given attribute is numeric type.
bool isTableNumeric ()
 Sames as above but for the whole table.

Private Types

typedef std::map< std::string,
std::string > 
StrStrMap

Private Attributes

unsigned numAttributes
 Number of attributes.
std::string tableName
 Name associated with this table.
StringMap attrName
 Maps column number to attribute name, ie name = attrName[attNo].
std::map< std::string, int > columnMap
 Maps attribute name to column number, col# = columnMap[name].
StrStrMap formatMap
std::map< std::string, StrStrMaptagMap

Static Private Attributes

static const std::string mcEmptyString

Detailed Description

Class to encapsulate information about a data base table as specified in its corresponding SQL schema


Member Typedef Documentation

typedef std::map<std::string, std::string> TableInfo::StrStrMap [private]

Member Enumeration Documentation

Enumerator:
ColNotFound 

Constructor & Destructor Documentation

TableInfo::TableInfo (  )  [inline]

Constructor.

TableInfo::~TableInfo (  )  [inline]

Destructor.


Member Function Documentation

void TableInfo::addName ( const std::string &  name,
const std::string &  form 
)

Set attribute properties.

References attrName, columnMap, formatMap, and numAttributes.

Referenced by SqlParser::extractTable().

void TableInfo::addTag ( const std::string &  name,
const std::string &  tag,
const std::string &  value 
) [inline]

Set a --/ tag and its value for the given attribute name.

References tagMap.

Referenced by SqlParser::extractTable().

int TableInfo::getAttNo ( const std::string &  aName  )  const
const std::string& TableInfo::getDefault ( int  aAttrNum  )  const [inline]

Is a default value associated with this attribute and if so, what is its value

References TagNames::DEFAULT, and readTag().

Referenced by DataDumper::addDefaultRow(), and Table< DataType >::checkData().

const std::string& TableInfo::getDiscrValues ( int  aAttrNum  )  const [inline]

Is there a set of discrete values associated with this attribute and if so, what are the values

References readTag(), and TagNames::VALUES.

Referenced by Table< DataType >::checkRange().

const std::string& TableInfo::getFitsColumnName ( int  aAttrNum  )  const [inline]

Is there a source FITS column name associated with this attribute and if so what is the column name

References TagNames::FITSCOL, and readTag().

Referenced by insertFitsColumns(), and makeTargetList().

const std::string& TableInfo::getFitsKeywordName ( int  aAttrNum  )  const [inline]

Is there a source FITS keyword name associated with this attribute and if so, what is the keyword name

References TagNames::FITSKEY, and readTag().

Referenced by insertFitsExtensionHeader(), insertFitsPrimaryHeader(), and makeTargetList().

const std::string & TableInfo::getFormat ( int  aAttrNum  )  const
const std::string & TableInfo::getName ( int  aAttrNum  )  const
unsigned TableInfo::getNumAttributes (  )  const [inline]
const std::string& TableInfo::getRange ( int  aAttrNum  )  const [inline]

Is there a logical range associated with this attribute and if so, what is the range

References TagNames::RANGE, and readTag().

Referenced by Table< DataType >::checkRange().

const std::string& TableInfo::getTableName (  )  const [inline]
const std::string& TableInfo::getUnits ( int  aAttrNum  )  const [inline]
const std::string& TableInfo::getUsingValue ( int  aAttrNum  )  const [inline]

Is there a source --/Q tage associated with this attribute and if so, what is its value

References TagNames::GETUSING, and readTag().

Referenced by DataMethod< DataType >::determineDetectionSourceAndTarget(), DataMethod< DataType >::determineSourceAndTarget(), getFrameIDMethod(), getMethod(), and makeTargetList().

bool TableInfo::isDetection (  ) 
bool TableInfo::isNumeric ( int  attNo  ) 

Asks if the format of the given attribute is numeric type.

References attrName, and formatMap.

Referenced by isTableNumeric().

bool TableInfo::isTableNumeric (  ) 

Sames as above but for the whole table.

References isNumeric(), and numAttributes.

Referenced by getMethod().

const std::string & TableInfo::readTag ( int  aAttrNum,
const std::string &  aTagName 
) const

Read the value associated with given tagname.

References getName(), mcEmptyString, and tagMap.

Referenced by getDefault(), getDiscrValues(), getFitsColumnName(), getFitsKeywordName(), getMethod(), getRange(), getUnits(), and getUsingValue().

void TableInfo::setTableName ( const std::string &  aName  )  [inline]

Set the name of this table.

References tableName.

Referenced by SqlParser::extractTable().


Member Data Documentation

Maps column number to attribute name, ie name = attrName[attNo].

Referenced by addName(), getName(), and isNumeric().

std::map<std::string, int> TableInfo::columnMap [private]

Maps attribute name to column number, col# = columnMap[name].

Referenced by addName(), and getAttNo().

Maps attribute name to SQL format identifier, ie fmt = formatMap[name]

Referenced by addName(), getFormat(), and isNumeric().

const std::string TableInfo::mcEmptyString [static, private]

Referenced by getFormat(), getName(), and readTag().

Number of attributes.

Referenced by addName(), getNumAttributes(), and isTableNumeric().

std::string TableInfo::tableName [private]

Name associated with this table.

Referenced by getTableName(), and setTableName().

std::map<std::string, StrStrMap> TableInfo::tagMap [private]

Maps attribute name to each --/ style tag, eg tagMap["htmID"]["Q"]

Referenced by addTag(), and readTag().


The documentation for this class was generated from the following files:
Generated on Mon Oct 4 10:39:40 2010 for WfcamSrc by  doxygen 1.6.3