Changeset 2283 for branches


Ignore:
Timestamp:
08/30/11 10:27:22 (13 years ago)
Author:
KohjiNakamura
Message:

Non-PlainColumn? supported by TableTraverse?

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
    19#include <stdio.h>
    210#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
    319#include <sys/time.h>
    4 #include <TableTraverse.h>
    5 
    6 #define TIMING 0
     20#endif
     21
     22static const char version[] = "$Id$";
    723
    824using namespace casa;
     
    119135  };
    120136
     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
    121146  void traverseTable(const Table &table,
    122147                     const char *const columnNames[],
     
    145170      colValues[i] = typeManagers[i]->allocArray(nRows);
    146171      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);
    149174      if (col) {
    150175        const uInt gotRows = col->dataManagerColumn()->
     
    152177        DebugAssert(gotRows == nRows, AipsError);
    153178      } 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);
    159180      }
    160181    }
  • 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
    113
    214#include <casa/aips.h>
    315#include <tables/Tables/BaseTable.h>
    416#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>
    917
    1018namespace asap {
     
    96104
    97105}
     106
     107#endif
Note: See TracChangeset for help on using the changeset viewer.