Changeset 10529 for trunk/FACT++/src/Fits.cc
- Timestamp:
- 05/03/11 14:04:37 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/Fits.cc
r10489 r10529 143 143 std::string factTableName = "FACT-" + tableName; 144 144 fTable = fFile->addTable(factTableName, 0, allNames, allDataTypes, allUnits); 145 fTable->makeThisCurrent(); 145 146 fCopyBuffer = new unsigned char[fTotalNumBytes]; 146 147 fNumRows = fTable->rows(); 147 148 if (fNumRows !=0) 148 149 {//If the file already existed, then we must load its data to memory before writing to it. 149 std::vector<std::string> tableNameString; 150 tableNameString.push_back(tableName); 151 fFile->read(tableNameString); 150 BinTable* bTable = dynamic_cast<BinTable*>(fTable); 151 if (!bTable) 152 { 153 fMess->Error("The table " + factTableName + " could not be converted to a binary table. skipping"); 154 return; 155 } 156 //read the table binary data. 157 std::vector<string> colName; 158 bTable->readData(true, colName); 159 160 //double check that the data was indeed read from the disk. Go through the fTable instead as colName is empty (yes, it is !) 152 161 std::map<std::string, Column*> cMap = fTable->column(); 153 162 std::map<std::string, Column*>::iterator cMapIt; 163 154 164 for (cMapIt = cMap.begin(); cMapIt != cMap.end(); cMapIt++) 155 165 { 156 //TODO this only works for scalar columns I assume. upgrade it to fully read vector columns 157 cMapIt->second->readData(1, fNumRows); 158 } 166 if (!cMapIt->second->isRead()) 167 { 168 fMess->Error("Column " + cMapIt->first + "Could not be read back from the disk"); 169 return; 170 } 171 } 159 172 updating = true; 160 173 } … … 255 268 { 256 269 257 fTable->makeThisCurrent();258 270 try 259 271 { 272 fTable->makeThisCurrent(); 260 273 fTable->insertRows(fNumRows); 261 274 }
Note:
See TracChangeset
for help on using the changeset viewer.