00001
00002
00003
00004
00005
00006
00007 #ifndef TABLEINFO_H
00008 #define TABLEINFO_H
00009
00010 #include <map>
00011 #include <string>
00012
00013 #include "Constants.h"
00014 #include "DataTypes.h"
00015
00018 class TableInfo
00019 {
00020 public:
00021 enum ErrorCode
00022 {
00023 ColNotFound = -1
00024 };
00025
00027 TableInfo() : numAttributes(0) { }
00028
00030 ~TableInfo() { }
00031
00033 void addName(const std::string& name,
00034 const std::string& form);
00035
00037 void addTag(const std::string& name,
00038 const std::string& tag,
00039 const std::string& value)
00040 { tagMap[name][tag] = value; }
00041
00043 void setTableName(const std::string& aName) { tableName = aName; }
00044
00046 const std::string& readTag(int aAttrNum,
00047 const std::string& aTagName) const;
00048
00050 int getAttNo(const std::string& aName) const;
00051
00053 unsigned getNumAttributes() const { return numAttributes; }
00054
00056 const std::string& getTableName() const { return tableName; }
00057
00059 const std::string& getName(int aAttrNum) const;
00060
00062 const std::string& getFormat(int aAttrNum) const;
00063
00065 const std::string& getUnits(int aAttrNum) const
00066 { return readTag(aAttrNum, TagNames::UNITS); }
00067
00068
00069
00072 const std::string& getDefault(int aAttrNum) const
00073 { return readTag(aAttrNum, TagNames::DEFAULT); }
00074
00077 const std::string& getUsingValue(int aAttrNum) const
00078 { return readTag(aAttrNum, TagNames::GETUSING); }
00079
00082 const std::string& getFitsColumnName(int aAttrNum) const
00083 { return readTag(aAttrNum, TagNames::FITSCOL); }
00084
00087 const std::string& getFitsKeywordName(int aAttrNum) const
00088 { return readTag(aAttrNum, TagNames::FITSKEY); }
00089
00092 const std::string& getDiscrValues(int aAttrNum) const
00093 { return readTag(aAttrNum, TagNames::VALUES); }
00094
00097 const std::string& getRange(int aAttrNum) const
00098 { return readTag(aAttrNum, TagNames::RANGE); }
00099
00101 bool isDetection();
00102
00104 bool isNumeric(int attNo);
00105
00107 bool isTableNumeric();
00108
00109 private:
00110 typedef std::map<std::string, std::string> StrStrMap;
00111
00113 unsigned numAttributes;
00114
00116 std::string tableName;
00117
00119 StringMap attrName;
00120
00122 std::map<std::string, int> columnMap;
00123
00126 StrStrMap formatMap;
00127
00130 std::map<std::string, StrStrMap> tagMap;
00131
00132 static const std::string mcEmptyString;
00133 };
00134
00135 #endif