// // C++ Implementation: STHistory // // Description: // // // Author: Malte Marquarding , (C) 2006 // // Copyright: See COPYING file that comes with this distribution // // #include #include #include #include #include #include #include #include "STDefs.h" #include "STHistory.h" using namespace casa; namespace asap { const casa::String STHistory::name_ = "HISTORY"; STHistory::STHistory(const Scantable& parent ) : STSubTable( parent, name_ ) { setup(); } asap::STHistory::STHistory( casa::Table tab ) : STSubTable(tab, name_) { itemCol_.attach(table_,"ITEM"); } STHistory::~STHistory() { } STHistory& asap::STHistory::operator =( const STHistory & other ) { if (this != &other) { static_cast(*this) = other; itemCol_.attach(table_,"ITEM"); } return *this; } void asap::STHistory::setup( ) { // add to base class table table_.addColumn(ScalarColumnDesc("ITEM")); // new cached columns itemCol_.attach(table_,"ITEM"); } uInt STHistory::addEntry( const String& item) { uInt rno = table_.nrow(); table_.addRow(); itemCol_.put(rno, item); idCol_.put(rno, 0); return 0; } void asap::STHistory::getEntry( String& item, uInt id) { Table t = table_(table_.col("ID") == Int(id), 1 ); if (t.nrow() == 0 ) { throw(AipsError("STHistory::getEntry - id out of range")); } item = ""; } void asap::STHistory::append( const STHistory & other ) { const Table& t = other.table(); addEntry(asap::SEPERATOR); TableCopy::copyRows(table_, t, table_.nrow(), 0, t.nrow()); addEntry(asap::SEPERATOR); } std::vector asap::STHistory::getHistory( ) const { std::vector stlout; for (uInt i=0; i