// // C++ Implementation: STTcal // // Description: // // // Author: Malte Marquarding , (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #include #include #include #include #include #include #include #include #include #include "STTcal.h" using namespace casa; namespace asap { const casa::String STTcal::name_ = "TCAL"; STTcal::STTcal(casa::Table::TableType tt) : STSubTable( name_, tt ) { setup(); } STTcal::~STTcal() { } void asap::STTcal::setup( ) { // add to base class table table_.addColumn(ScalarColumnDesc("TIME")); table_.addColumn(ArrayColumnDesc("TCAL")); // new cached columns timeCol_.attach(table_,"TIME"); tcalCol_.attach(table_,"TCAL"); } uInt STTcal::addEntry( const String& time, const Vector& cal) { // test if this already exists Table result = table_( table_.col("TIME") == time ); uInt resultid = 0; if ( result.nrow() > 0) { ROScalarColumn c(result, "ID"); c.get(0, resultid); } else { uInt rno = table_.nrow(); table_.addRow(); // get last assigned tcal_id and increment if ( rno > 0 ) { idCol_.get(rno-1, resultid); resultid++; } tcalCol_.put(rno, cal); timeCol_.put(rno, time); idCol_.put(rno, resultid); } return resultid; } }