$treeview $search $mathjax $extrastylesheet
otsdaq
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #include "otsdaq-core/TableCore/TableViewColumnInfo.h" 00002 00003 #include "otsdaq-core/Macros/CoutMacros.h" 00004 #include "otsdaq-core/Macros/StringMacros.h" 00005 00006 #include <iostream> 00007 #include <sstream> 00008 #include <stdexcept> 00009 00010 #include "otsdaq-core/TableCore/TableView.h" 00011 00012 using namespace ots; 00013 00014 // NOTE: Do NOT put '-' in static const TYPEs because it will mess up javascript handling 00015 // in the web gui 00016 const std::string TableViewColumnInfo::TYPE_UID = "UID"; 00017 00018 const std::string TableViewColumnInfo::TYPE_DATA = "Data"; 00019 const std::string TableViewColumnInfo::TYPE_UNIQUE_DATA = "UniqueData"; 00020 const std::string TableViewColumnInfo::TYPE_UNIQUE_GROUP_DATA = "UniqueGroupData"; 00021 const std::string TableViewColumnInfo::TYPE_MULTILINE_DATA = "MultilineData"; 00022 const std::string TableViewColumnInfo::TYPE_FIXED_CHOICE_DATA = "FixedChoiceData"; 00023 const std::string TableViewColumnInfo::TYPE_BITMAP_DATA = "BitMap"; 00024 00025 const std::string TableViewColumnInfo::TYPE_ON_OFF = "OnOff"; 00026 const std::string TableViewColumnInfo::TYPE_TRUE_FALSE = "TrueFalse"; 00027 const std::string TableViewColumnInfo::TYPE_YES_NO = "YesNo"; 00028 00029 const std::string TableViewColumnInfo::TYPE_START_CHILD_LINK = "ChildLink"; 00030 const std::string TableViewColumnInfo::TYPE_START_CHILD_LINK_UID = "ChildLinkUID"; 00031 const std::string TableViewColumnInfo::TYPE_START_CHILD_LINK_GROUP_ID = 00032 "ChildLinkGroupID"; 00033 const std::string TableViewColumnInfo::TYPE_START_GROUP_ID = "GroupID"; 00034 const std::string TableViewColumnInfo::TYPE_COMMENT = "Comment"; 00035 const std::string TableViewColumnInfo::TYPE_AUTHOR = "Author"; 00036 const std::string TableViewColumnInfo::TYPE_TIMESTAMP = "Timestamp"; 00037 // NOTE: Do NOT put '-' in static const TYPEs because it will mess up javascript handling 00038 // in the web gui 00039 00040 const std::string TableViewColumnInfo::DATATYPE_NUMBER = "NUMBER"; 00041 const std::string TableViewColumnInfo::DATATYPE_STRING = "VARCHAR2"; 00042 const std::string TableViewColumnInfo::DATATYPE_TIME = "TIMESTAMP WITH TIMEZONE"; 00043 00044 const std::string TableViewColumnInfo::TYPE_VALUE_YES = "Yes"; 00045 const std::string TableViewColumnInfo::TYPE_VALUE_NO = "No"; 00046 const std::string TableViewColumnInfo::TYPE_VALUE_TRUE = "True"; 00047 const std::string TableViewColumnInfo::TYPE_VALUE_FALSE = "False"; 00048 const std::string TableViewColumnInfo::TYPE_VALUE_ON = "On"; 00049 const std::string TableViewColumnInfo::TYPE_VALUE_OFF = "Off"; 00050 00051 const std::string TableViewColumnInfo::DATATYPE_STRING_DEFAULT = "DEFAULT"; 00052 const std::string TableViewColumnInfo::DATATYPE_COMMENT_DEFAULT = "No Comment"; 00053 const std::string TableViewColumnInfo::DATATYPE_BOOL_DEFAULT = "0"; 00054 const std::string TableViewColumnInfo::DATATYPE_NUMBER_DEFAULT = "0"; 00055 const std::string TableViewColumnInfo::DATATYPE_TIME_DEFAULT = "0"; 00056 const std::string TableViewColumnInfo::DATATYPE_LINK_DEFAULT = "NO_LINK"; 00057 00058 const std::string TableViewColumnInfo::COL_NAME_STATUS = "Status"; 00059 const std::string TableViewColumnInfo::COL_NAME_PRIORITY = "Priority"; 00060 00061 //============================================================================== 00062 // TableViewColumnInfo 00063 // if(capturedExceptionString) *capturedExceptionString = ""; //indicates no error found 00064 // if(!capturedExceptionString) then exception is thrown on error 00065 TableViewColumnInfo::TableViewColumnInfo(const std::string& type, 00066 const std::string& name, 00067 const std::string& storageName, 00068 const std::string& dataType, 00069 const std::string& dataChoicesCSV, 00070 std::string* capturedExceptionString) 00071 : type_(type) 00072 , name_(name) 00073 , storageName_(storageName) 00074 , dataType_(dataType) 00075 , bitMapInfoP_(0) 00076 { 00077 // verify type 00078 if((type_ != TYPE_UID) && (type_ != TYPE_DATA) && (type_ != TYPE_UNIQUE_DATA) && 00079 (type_ != TYPE_UNIQUE_GROUP_DATA) && (type_ != TYPE_MULTILINE_DATA) && 00080 (type_ != TYPE_FIXED_CHOICE_DATA) && (type_ != TYPE_BITMAP_DATA) && 00081 (type_ != TYPE_ON_OFF) && (type_ != TYPE_TRUE_FALSE) && (type_ != TYPE_YES_NO) && 00082 (type_ != TYPE_COMMENT) && (type_ != TYPE_AUTHOR) && (type_ != TYPE_TIMESTAMP) && 00083 !isChildLink() && !isChildLinkUID() && !isChildLinkGroupID() && !isGroupID()) 00084 { 00085 __SS__ << "The type for column " << name_ << " is " << type_ 00086 << ", while the only accepted types are: " << TYPE_DATA << " " 00087 << TYPE_UNIQUE_DATA << " " << TYPE_UNIQUE_GROUP_DATA << " " 00088 << TYPE_MULTILINE_DATA << " " << TYPE_FIXED_CHOICE_DATA << " " << TYPE_UID 00089 << " " << TYPE_ON_OFF << " " << TYPE_TRUE_FALSE << " " << TYPE_YES_NO 00090 << " " << TYPE_START_CHILD_LINK << "-* " << TYPE_START_CHILD_LINK_UID 00091 << "-* " << TYPE_START_CHILD_LINK_GROUP_ID << "-* " << TYPE_START_GROUP_ID 00092 << "-* " << std::endl; 00093 if(capturedExceptionString) 00094 *capturedExceptionString = ss.str(); 00095 else 00096 __SS_THROW__; 00097 } 00098 else if(capturedExceptionString) 00099 *capturedExceptionString = ""; // indicates no error found 00100 00101 // enforce that type only 00102 // allows letters, numbers, dash, underscore 00103 for(unsigned int i = 0; i < type_.size(); ++i) 00104 if(!((type_[i] >= 'A' && type_[i] <= 'Z') || 00105 (type_[i] >= 'a' && type_[i] <= 'z') || 00106 (type_[i] >= '0' && type_[i] <= '9') || 00107 (type_[i] == '-' || type_[i] <= '_' || type_[i] <= '.'))) 00108 { 00109 __SS__ << "The data type for column " << name_ << " is '" << type_ 00110 << "'. Data types must contain only letters, numbers," 00111 << "dashes, underscores, and periods." << std::endl; 00112 if(capturedExceptionString) 00113 *capturedExceptionString += ss.str(); 00114 else 00115 __SS_THROW__; 00116 } 00117 00118 // verify data type 00119 if((dataType_ != DATATYPE_NUMBER) && (dataType_ != DATATYPE_STRING) && 00120 (dataType_ != DATATYPE_TIME)) 00121 { 00122 __SS__ << "The data type for column " << name_ << " is " << dataType_ 00123 << ", while the only accepted types are: " << DATATYPE_NUMBER << " " 00124 << DATATYPE_STRING << " " << DATATYPE_TIME << std::endl; 00125 if(capturedExceptionString) 00126 *capturedExceptionString += ss.str(); 00127 else 00128 __SS_THROW__; 00129 } 00130 00131 if(dataType_.size() == 0) 00132 { 00133 __SS__ << "The data type for column " << name_ << " is '" << dataType_ 00134 << "'. Data types must contain at least 1 character." << std::endl; 00135 if(capturedExceptionString) 00136 *capturedExceptionString += ss.str(); 00137 else 00138 __SS_THROW__; 00139 } 00140 00141 // enforce that data type only 00142 // allows letters, numbers, dash, underscore 00143 for(unsigned int i = 0; i < dataType_.size(); ++i) 00144 if(!((dataType_[i] >= 'A' && dataType_[i] <= 'Z') || 00145 (dataType_[i] >= 'a' && dataType_[i] <= 'z') || 00146 (dataType_[i] >= '0' && dataType_[i] <= '9') || 00147 (dataType_[i] == '-' || dataType_[i] <= '_'))) 00148 { 00149 __SS__ << "The data type for column " << name_ << " is '" << dataType_ 00150 << "'. Data types must contain only letters, numbers," 00151 << "dashes, and underscores." << std::endl; 00152 if(capturedExceptionString) 00153 *capturedExceptionString += ss.str(); 00154 else 00155 __SS_THROW__; 00156 } 00157 00158 if(name_.size() == 0) 00159 { 00160 __SS__ << "There is a column named " << name_ 00161 << "'. Column names must contain at least 1 character." << std::endl; 00162 if(capturedExceptionString) 00163 *capturedExceptionString += ss.str(); 00164 else 00165 __SS_THROW__; 00166 } 00167 00168 // enforce that col name only 00169 // allows letters, numbers, dash, underscore 00170 for(unsigned int i = 0; i < name_.size(); ++i) 00171 if(!((name_[i] >= 'A' && name_[i] <= 'Z') || 00172 (name_[i] >= 'a' && name_[i] <= 'z') || 00173 (name_[i] >= '0' && name_[i] <= '9') || 00174 (name_[i] == '-' || name_[i] <= '_'))) 00175 { 00176 __SS__ << "There is a column named " << name_ 00177 << "'. Column names must contain only letters, numbers," 00178 << "dashes, and underscores." << std::endl; 00179 if(capturedExceptionString) 00180 *capturedExceptionString += ss.str(); 00181 else 00182 __SS_THROW__; 00183 } 00184 00185 if(storageName_.size() == 0) 00186 { 00187 __SS__ << "The storage name for column " << name_ << " is '" << storageName_ 00188 << "'. Storage names must contain at least 1 character." << std::endl; 00189 if(capturedExceptionString) 00190 *capturedExceptionString += ss.str(); 00191 else 00192 __SS_THROW__; 00193 } 00194 00195 // enforce that col storage name only 00196 // allows capital letters, numbers, dash, underscore 00197 for(unsigned int i = 0; i < storageName_.size(); ++i) 00198 if(!((storageName_[i] >= 'A' && storageName_[i] <= 'Z') || 00199 (storageName_[i] >= '0' && storageName_[i] <= '9') || 00200 (storageName_[i] == '-' || storageName_[i] <= '_'))) 00201 { 00202 __SS__ << "The storage name for column " << name_ << " is '" << storageName_ 00203 << "'. Storage names must contain only capital letters, numbers," 00204 << "dashes, and underscores." << std::endl; 00205 if(capturedExceptionString) 00206 *capturedExceptionString += ss.str(); 00207 else 00208 __SS_THROW__; 00209 } 00210 00211 // build data choices vector from URI encoded data 00212 //__COUT__ << "dataChoicesCSV " << dataChoicesCSV << std::endl; 00213 { 00214 std::istringstream f(dataChoicesCSV); 00215 std::string s; 00216 while(getline(f, s, ',')) 00217 dataChoices_.push_back(StringMacros::decodeURIComponent(s)); 00218 // for(const auto &dc: dataChoices_) 00219 // __COUT__ << dc << std::endl; 00220 } 00221 00222 try 00223 { 00224 extractBitMapInfo(); 00225 } 00226 catch(std::runtime_error& e) 00227 { 00228 if(capturedExceptionString) 00229 *capturedExceptionString += e.what(); 00230 else 00231 throw; 00232 } 00233 00234 //__COUT__ << "dataChoicesCSV " << dataChoicesCSV << std::endl; 00235 } 00236 00237 //============================================================================== 00238 void TableViewColumnInfo::extractBitMapInfo() 00239 { 00240 // create BitMapInfo if this is a bitmap column 00241 if(type_ == TYPE_BITMAP_DATA) 00242 { 00243 if(bitMapInfoP_) 00244 delete bitMapInfoP_; 00245 bitMapInfoP_ = new BitMapInfo(); 00246 00247 // extract bitMapInfo parameters: 00248 // must match TableEditor js handling: 00249 00250 // [ //types => 0:string, 1:bool (default no), 00251 // //2:bool (default yes), 3:color 00252 // 00253 // 0 0,//"Number of Rows", 00254 // 1 0,//"Number of Columns", 00255 // 2 0,//"Cell Bit-field Size", 00256 // 3 0,//"Min-value Allowed", 00257 // 4 0,//"Max-value Allowed", 00258 // 5 0,//"Value step-size Allowed", 00259 // 6 0,//"Display Aspect H:W", 00260 // 7 3,//"Min-value Cell Color", 00261 // 8 3,//"Mid-value Cell Color", 00262 // 9 3,//"Max-value Cell Color", 00263 // 10 3,//"Absolute Min-value Cell Color", 00264 // 11 3,//"Absolute Max-value Cell Color", 00265 // 12 1,//"Display Rows in Ascending Order", 00266 // 13 2,//"Display Columns in Ascending Order", 00267 // 14 1,//"Snake Double Rows", 00268 // 15 1];//"Snake Double Columns"]; 00269 00270 if(dataChoices_.size() < 16) 00271 { 00272 __SS__ << "The Bit-Map data parameters for column " << name_ 00273 << " should be size 16, but is size " << dataChoices_.size() 00274 << ". Bit-Map parameters should be rows, cols, cellBitSize, and min, " 00275 "mid, max color." 00276 << std::endl; 00277 __SS_THROW__; 00278 } 00279 00280 sscanf(dataChoices_[0].c_str(), "%u", &(bitMapInfoP_->numOfRows_)); 00281 sscanf(dataChoices_[1].c_str(), "%u", &(bitMapInfoP_->numOfColumns_)); 00282 sscanf(dataChoices_[2].c_str(), "%u", &(bitMapInfoP_->cellBitSize_)); 00283 00284 sscanf(dataChoices_[3].c_str(), "%lu", &(bitMapInfoP_->minValue_)); 00285 sscanf(dataChoices_[4].c_str(), "%lu", &(bitMapInfoP_->maxValue_)); 00286 sscanf(dataChoices_[5].c_str(), "%lu", &(bitMapInfoP_->stepValue_)); 00287 00288 bitMapInfoP_->aspectRatio_ = dataChoices_[6]; 00289 bitMapInfoP_->minColor_ = dataChoices_[7]; 00290 bitMapInfoP_->midColor_ = dataChoices_[8]; 00291 bitMapInfoP_->maxColor_ = dataChoices_[9]; 00292 bitMapInfoP_->absMinColor_ = dataChoices_[10]; 00293 bitMapInfoP_->absMaxColor_ = dataChoices_[11]; 00294 00295 bitMapInfoP_->rowsAscending_ = dataChoices_[12] == "Yes" ? 1 : 0; 00296 bitMapInfoP_->colsAscending_ = dataChoices_[13] == "Yes" ? 1 : 0; 00297 bitMapInfoP_->snakeRows_ = dataChoices_[14] == "Yes" ? 1 : 0; 00298 bitMapInfoP_->snakeCols_ = dataChoices_[15] == "Yes" ? 1 : 0; 00299 } 00300 } 00301 00302 //============================================================================== 00303 // private empty default constructor. Only used by assignment operator. 00304 TableViewColumnInfo::TableViewColumnInfo(void) {} 00305 00306 //============================================================================== 00307 TableViewColumnInfo::TableViewColumnInfo( 00308 const TableViewColumnInfo& c) // copy constructor because of bitmap pointer 00309 : type_(c.type_) 00310 , name_(c.name_) 00311 , storageName_(c.storageName_) 00312 , dataType_(c.dataType_) 00313 , dataChoices_(c.dataChoices_) 00314 , bitMapInfoP_(0) 00315 { 00316 // extract bitmap info if necessary 00317 extractBitMapInfo(); 00318 } 00319 00320 //============================================================================== 00321 TableViewColumnInfo& TableViewColumnInfo::operator=( 00322 const TableViewColumnInfo& c) // assignment operator because of bitmap pointer 00323 { 00324 TableViewColumnInfo* retColInfo = new TableViewColumnInfo(); 00325 retColInfo->type_ = c.type_; 00326 retColInfo->name_ = c.name_; 00327 retColInfo->storageName_ = c.storageName_; 00328 retColInfo->dataType_ = c.dataType_; 00329 retColInfo->dataChoices_ = c.dataChoices_; 00330 retColInfo->bitMapInfoP_ = 0; 00331 00332 // extract bitmap info if necessary 00333 retColInfo->extractBitMapInfo(); 00334 00335 return *retColInfo; 00336 } 00337 00338 //============================================================================== 00339 TableViewColumnInfo::~TableViewColumnInfo(void) 00340 { 00341 if(bitMapInfoP_) 00342 delete bitMapInfoP_; 00343 } 00344 00345 //============================================================================== 00346 const std::string& TableViewColumnInfo::getType(void) const { return type_; } 00347 00348 //============================================================================== 00349 const std::string& TableViewColumnInfo::getDefaultValue(void) const 00350 { 00351 if(getDataType() == TableViewColumnInfo::DATATYPE_STRING) 00352 { 00353 if(getType() == TableViewColumnInfo::TYPE_ON_OFF || 00354 getType() == TableViewColumnInfo::TYPE_TRUE_FALSE || 00355 getType() == TableViewColumnInfo::TYPE_YES_NO) 00356 return ( 00357 TableViewColumnInfo::DATATYPE_BOOL_DEFAULT); // default to OFF, NO, FALSE 00358 else if(isChildLink()) 00359 return (TableViewColumnInfo::DATATYPE_LINK_DEFAULT); 00360 else if(getType() == TableViewColumnInfo::TYPE_COMMENT) 00361 return (TableViewColumnInfo::DATATYPE_COMMENT_DEFAULT); 00362 else 00363 return (TableViewColumnInfo::DATATYPE_STRING_DEFAULT); 00364 } 00365 else if(getDataType() == TableViewColumnInfo::DATATYPE_NUMBER) 00366 return (TableViewColumnInfo::DATATYPE_NUMBER_DEFAULT); 00367 else if(getDataType() == TableViewColumnInfo::DATATYPE_TIME) 00368 return (TableViewColumnInfo::DATATYPE_TIME_DEFAULT); 00369 else 00370 { 00371 __SS__ << "\tUnrecognized View data type: " << getDataType() << std::endl; 00372 __COUT_ERR__ << "\n" << ss.str(); 00373 __SS_THROW__; 00374 } 00375 } 00376 00377 //============================================================================== 00378 std::vector<std::string> TableViewColumnInfo::getAllTypesForGUI(void) 00379 { 00380 std::vector<std::string> all; 00381 all.push_back(TYPE_DATA); 00382 all.push_back(TYPE_UNIQUE_DATA); 00383 all.push_back(TYPE_UNIQUE_GROUP_DATA); 00384 all.push_back(TYPE_FIXED_CHOICE_DATA); 00385 all.push_back(TYPE_MULTILINE_DATA); 00386 all.push_back(TYPE_BITMAP_DATA); 00387 all.push_back(TYPE_ON_OFF); 00388 all.push_back(TYPE_TRUE_FALSE); 00389 all.push_back(TYPE_YES_NO); 00390 all.push_back(TYPE_START_CHILD_LINK_UID); 00391 all.push_back(TYPE_START_CHILD_LINK_GROUP_ID); 00392 all.push_back(TYPE_START_CHILD_LINK); 00393 all.push_back(TYPE_START_GROUP_ID); 00394 return all; 00395 } 00396 00397 //============================================================================== 00398 std::vector<std::string> TableViewColumnInfo::getAllDataTypesForGUI(void) 00399 { 00400 std::vector<std::string> all; 00401 all.push_back(DATATYPE_STRING); 00402 all.push_back(DATATYPE_NUMBER); 00403 all.push_back(DATATYPE_TIME); 00404 return all; 00405 } 00406 00407 //============================================================================== 00408 // map of datatype,type to default value 00409 std::map<std::pair<std::string, std::string>, std::string> 00410 TableViewColumnInfo::getAllDefaultsForGUI(void) 00411 { 00412 std::map<std::pair<std::string, std::string>, std::string> all; 00413 all[std::pair<std::string, std::string>(DATATYPE_NUMBER, "*")] = 00414 DATATYPE_NUMBER_DEFAULT; 00415 all[std::pair<std::string, std::string>(DATATYPE_TIME, "*")] = DATATYPE_TIME_DEFAULT; 00416 00417 all[std::pair<std::string, std::string>(DATATYPE_STRING, TYPE_ON_OFF)] = 00418 DATATYPE_BOOL_DEFAULT; 00419 all[std::pair<std::string, std::string>(DATATYPE_STRING, TYPE_TRUE_FALSE)] = 00420 DATATYPE_BOOL_DEFAULT; 00421 all[std::pair<std::string, std::string>(DATATYPE_STRING, TYPE_YES_NO)] = 00422 DATATYPE_BOOL_DEFAULT; 00423 00424 all[std::pair<std::string, std::string>(DATATYPE_STRING, TYPE_START_CHILD_LINK)] = 00425 DATATYPE_LINK_DEFAULT; 00426 all[std::pair<std::string, std::string>(DATATYPE_STRING, "*")] = 00427 DATATYPE_STRING_DEFAULT; 00428 return all; 00429 } 00430 00431 //============================================================================== 00432 // isBoolType 00433 const bool TableViewColumnInfo::isBoolType(void) const 00434 { 00435 return (type_ == TYPE_ON_OFF || type_ == TYPE_TRUE_FALSE || type_ == TYPE_YES_NO); 00436 } // end isBoolType() 00437 00438 //============================================================================== 00439 // isNumberDataType 00440 const bool TableViewColumnInfo::isNumberDataType(void) const 00441 { 00442 return (dataType_ == DATATYPE_NUMBER); 00443 } // end isBoolType() 00444 00445 //============================================================================== 00446 const std::string& TableViewColumnInfo::getName(void) const { return name_; } 00447 00448 //============================================================================== 00449 const std::string& TableViewColumnInfo::getStorageName(void) const 00450 { 00451 return storageName_; 00452 } 00453 00454 //============================================================================== 00455 const std::string& TableViewColumnInfo::getDataType(void) const { return dataType_; } 00456 00457 //============================================================================== 00458 const std::vector<std::string>& TableViewColumnInfo::getDataChoices(void) const 00459 { 00460 return dataChoices_; 00461 } 00462 00463 //============================================================================== 00464 // getBitMapInfo 00465 // uses dataChoices CSV fields if type is TYPE_BITMAP_DATA 00466 const TableViewColumnInfo::BitMapInfo& TableViewColumnInfo::getBitMapInfo(void) const 00467 { 00468 if(bitMapInfoP_) 00469 return *bitMapInfoP_; 00470 00471 // throw error at this point! 00472 { 00473 __SS__ << "getBitMapInfo request for non-BitMap column of type: " << getType() 00474 << std::endl; 00475 __COUT_ERR__ << "\n" << ss.str(); 00476 __SS_THROW__; 00477 } 00478 } 00479 00480 //============================================================================== 00481 // isChildLink 00482 // note: TYPE_START_CHILD_LINK index may be a subset of UID and GROUP_ID 00483 // so don't allow alpha character immediately after 00484 const bool TableViewColumnInfo::isChildLink(void) const 00485 { 00486 return (type_.find(TYPE_START_CHILD_LINK) == 0 && 00487 type_.length() > TYPE_START_CHILD_LINK.length() && 00488 type_[TYPE_START_CHILD_LINK.length()] == '-'); 00489 } 00490 00491 //============================================================================== 00492 // isChildLinkUID 00493 // note: TYPE_START_CHILD_LINK index may be a subset of UID and GROUP_ID 00494 // so don't allow alpha character immediately after 00495 const bool TableViewColumnInfo::isChildLinkUID(void) const 00496 { 00497 return (type_.find(TYPE_START_CHILD_LINK_UID) == 0 && 00498 type_.length() > TYPE_START_CHILD_LINK_UID.length() && 00499 type_[TYPE_START_CHILD_LINK_UID.length()] == '-'); 00500 } 00501 00502 //============================================================================== 00503 // isChildLinkGroupID 00504 // note: TYPE_START_CHILD_LINK index may be a subset of UID and GROUP_ID 00505 // so don't allow alpha character immediately after 00506 const bool TableViewColumnInfo::isChildLinkGroupID(void) const 00507 { 00508 return (type_.find(TYPE_START_CHILD_LINK_GROUP_ID) == 0 && 00509 type_.length() > TYPE_START_CHILD_LINK_GROUP_ID.length() && 00510 type_[TYPE_START_CHILD_LINK_GROUP_ID.length()] == '-'); 00511 } 00512 00513 //============================================================================== 00514 // isGroupID 00515 // note: TYPE_START_CHILD_LINK index may be a subset of UID and GROUP_ID 00516 // so don't allow alpha character immediately after in group index 00517 const bool TableViewColumnInfo::isGroupID(void) const 00518 { 00519 return (type_.find(TYPE_START_GROUP_ID) == 0 && 00520 type_.length() > TYPE_START_GROUP_ID.length() && 00521 type_[TYPE_START_GROUP_ID.length()] == '-'); 00522 } 00523 00524 //============================================================================== 00525 // isUID 00526 const bool TableViewColumnInfo::isUID(void) const { return (type_ == TYPE_UID); } 00527 00528 //============================================================================== 00529 // getChildLinkIndex 00530 std::string TableViewColumnInfo::getChildLinkIndex(void) const 00531 { 00532 // note: +1 to skip '-' 00533 if(isChildLink()) 00534 return type_.substr(TYPE_START_CHILD_LINK.length() + 1); 00535 else if(isChildLinkUID()) 00536 return type_.substr(TYPE_START_CHILD_LINK_UID.length() + 1); 00537 else if(isChildLinkGroupID()) 00538 return type_.substr(TYPE_START_CHILD_LINK_GROUP_ID.length() + 1); 00539 else if(isGroupID()) 00540 return type_.substr(TYPE_START_GROUP_ID.length() + 1); 00541 else 00542 { 00543 __SS__ 00544 << ("Requesting a Link Index from a column that is not a child link member!") 00545 << std::endl; 00546 __COUT_ERR__ << ss.str(); 00547 __SS_THROW__; 00548 } 00549 }