- Timestamp:
- 08/30/11 10:27:22 (13 years ago)
- Location:
- branches/parallel/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/parallel/src/TableTraverse.cpp
r2281 r2283 1 // 2 // C++ Interface: Scantable 3 // 4 // Description: 5 // 6 // Copyright: See COPYING file that comes with this distribution 7 // 8 1 9 #include <stdio.h> 2 10 #include <stdlib.h> 11 #include <TableTraverse.h> 12 #include <tables/Tables/TableColumn.h> 13 #include <tables/Tables/PlainColumn.h> 14 #include <tables/Tables/DataManager.h> 15 16 #define TIMING 0 17 18 #if TIMING 3 19 #include <sys/time.h> 4 # include <TableTraverse.h>5 6 #define TIMING 0 20 #endif 21 22 static const char version[] = "$Id$"; 7 23 8 24 using namespace casa; … … 119 135 }; 120 136 137 static void copyColumnData(void *colValues, size_t elementSize, uInt nRows, 138 BaseColumn *refCol) 139 { 140 char *base = (char *)colValues; 141 for (uInt i = 0; i < nRows; i++) { 142 refCol->get(i, &base[elementSize * i]); 143 } 144 } 145 121 146 void traverseTable(const Table &table, 122 147 const char *const columnNames[], … … 145 170 colValues[i] = typeManagers[i]->allocArray(nRows); 146 171 sizes[i] = typeManagers[i]->sizeOf(); 147 PlainColumn *col = dynamic_cast <PlainColumn *>(148 ROTableColumnBackDoor::baseColumnPtr(cols[i]));172 BaseColumn *baseCol = ROTableColumnBackDoor::baseColumnPtr(cols[i]); 173 PlainColumn *col = dynamic_cast <PlainColumn *>(baseCol); 149 174 if (col) { 150 175 const uInt gotRows = col->dataManagerColumn()-> … … 152 177 DebugAssert(gotRows == nRows, AipsError); 153 178 } else { 154 for (uInt i = 0; i < colCount; i++) { 155 typeManagers[i]->freeArray(colValues[i]); 156 delete cols[i]; 157 } 158 throw AipsError("Invalid type of column specified." ) ; 179 copyColumnData(colValues[i], typeManagers[i]->sizeOf(), nRows, baseCol); 159 180 } 160 181 } -
branches/parallel/src/TableTraverse.h
r2282 r2283 1 // 2 // C++ Interface: TableTraverse 3 // 4 // Description: 5 // 6 // Copyright: See COPYING file that comes with this distribution 7 // 8 9 // $Id$ 10 11 #ifndef ASAP_TABLETRAVERSE_H 12 #define ASAP_TABLETRAVERSE_H 1 13 2 14 #include <casa/aips.h> 3 15 #include <tables/Tables/BaseTable.h> 4 16 #include <tables/Tables/Table.h> 5 #include <tables/Tables/PlainColumn.h>6 #include <tables/Tables/DataManager.h>7 #include <tables/Tables/ScalarColumn.h>8 #include <tables/Tables/ArrayColumn.h>9 17 10 18 namespace asap { … … 96 104 97 105 } 106 107 #endif
Note:
See TracChangeset
for help on using the changeset viewer.