#include <TableInfo.h>
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, StrStrMap > | tagMap |
Static Private Attributes | |
static const std::string | mcEmptyString |
Class to encapsulate information about a data base table as specified in its corresponding SQL schema
typedef std::map<std::string, std::string> TableInfo::StrStrMap [private] |
enum TableInfo::ErrorCode |
TableInfo::TableInfo | ( | ) | [inline] |
Constructor.
TableInfo::~TableInfo | ( | ) | [inline] |
Destructor.
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 |
Return information about a given attribute name.
References ColNotFound, and columnMap.
Referenced by Provenance< DataType >::build(), SourceTable::calcMergedClass(), Table< DataType >::checkRange(), DataDumper::DataDumper(), DataMethod< DataType >::determineDetectionSourceAndTarget(), DataMethod< DataType >::determineSourceAndTarget(), SourceTable::fillExtinctionValues(), SourceTable::finishOff(), getFrameIDMethod(), getMethod(), SourceTable::insertAstrometricData(), insertExtNum(), SourceTable::insertUserSupplied(), and Table< Numeric >::valueOf().
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 |
Return the format associated with the n'th attribute.
References formatMap, getName(), and mcEmptyString.
Referenced by DataDumper::addDefaultRow(), Table< DataType >::checkData(), DataDumper::dumpAsCsv(), Table< DataType >::varcharTest(), and SourceTable::writeAsBinary().
const std::string & TableInfo::getName | ( | int | aAttrNum | ) | const |
Return the name of the n'th attribute.
References attrName, and mcEmptyString.
Referenced by DataDumper::addDefaultRow(), Table< DataType >::checkData(), Table< DataType >::checkRange(), SourceTable::copyPassband(), getFormat(), SourceTable::insertUserSupplied(), makeTargetList(), readTag(), Table< DataType >::testDump(), Table< DataType >::varcharTest(), and SourceTable::writeAsBinary().
unsigned TableInfo::getNumAttributes | ( | ) | const [inline] |
return the number of attributes in the table
References numAttributes.
Referenced by DataDumper::addDefaultRow(), Provenance< DataType >::build(), Primary< DataType >::build(), Extension< DataType >::build(), insertFitsColumns(), insertFitsExtensionHeader(), insertFitsPrimaryHeader(), SourceTable::insertUserSupplied(), main(), makeTargetList(), and SourceTable::writeAsBinary().
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] |
Return the name of this table.
References tableName.
Referenced by Provenance< DataType >::build(), SourceTable::calcMergedClass(), Table< DataType >::checkData(), Table< DataType >::checkRange(), DataMethod< DataType >::determineSourceAndTarget(), SourceTable::insertAstrometricData(), SourceTable::insertUserSupplied(), isDetection(), select(), Table< DataType >::testDump(), and Table< DataType >::varcharTest().
const std::string& TableInfo::getUnits | ( | int | aAttrNum | ) | const [inline] |
Return the units associated with the n'th attribute.
References readTag(), and TagNames::UNITS.
Referenced by DataMethod< DataType >::determineDetectionSourceAndTarget(), DataMethod< DataType >::determineSourceAndTarget(), SourceTable::insertAstrometricData(), and insertFitsColumns().
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 | ( | ) |
Checks if table is one of the detection tables.
References DetectionTableSubstr::astrometryTableSubstr, getTableName(), DetectionTableSubstr::photometryTableSubstr, and DetectionTableSubstr::rawTableSubstr.
Referenced by Table< DataType >::checkRange().
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] |
StringMap TableInfo::attrName [private] |
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().
StrStrMap TableInfo::formatMap [private] |
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().
unsigned TableInfo::numAttributes [private] |
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] |