| 1 | // | 
|---|
| 2 | // C++ Implementation: STSubTable | 
|---|
| 3 | // | 
|---|
| 4 | // Description: | 
|---|
| 5 | // | 
|---|
| 6 | // | 
|---|
| 7 | // Author: Malte Marquarding <asap@atnf.csiro.au>, (C) 2006 | 
|---|
| 8 | // | 
|---|
| 9 | // Copyright: See COPYING file that comes with this distribution | 
|---|
| 10 | // | 
|---|
| 11 | // | 
|---|
| 12 | #include <casa/Exceptions/Error.h> | 
|---|
| 13 | #include <tables/Tables/TableDesc.h> | 
|---|
| 14 | #include <tables/Tables/SetupNewTab.h> | 
|---|
| 15 | #include <tables/Tables/ScaColDesc.h> | 
|---|
| 16 | #include <tables/Tables/TableRecord.h> | 
|---|
| 17 |  | 
|---|
| 18 | #include "Scantable.h" | 
|---|
| 19 | #include "STSubTable.h" | 
|---|
| 20 |  | 
|---|
| 21 |  | 
|---|
| 22 | using namespace casa; | 
|---|
| 23 |  | 
|---|
| 24 | namespace asap { | 
|---|
| 25 |  | 
|---|
| 26 | STSubTable::STSubTable( const Scantable& parent, const casa::String& name ) | 
|---|
| 27 | { | 
|---|
| 28 | TableDesc td("", "1", TableDesc::Scratch); | 
|---|
| 29 | td.addColumn(ScalarColumnDesc<uInt>("ID")); | 
|---|
| 30 | String tabname = parent.table().tableName()+"/"+name; | 
|---|
| 31 | SetupNewTable aNewTab(tabname, td, Table::Scratch); | 
|---|
| 32 | table_ = Table(aNewTab, parent.table().tableType()); | 
|---|
| 33 | idCol_.attach(table_,"ID"); | 
|---|
| 34 |  | 
|---|
| 35 | } | 
|---|
| 36 | STSubTable::STSubTable(Table tab, const String& name) | 
|---|
| 37 | { | 
|---|
| 38 | table_ = tab.rwKeywordSet().asTable(name); | 
|---|
| 39 | idCol_.attach(table_,"ID"); | 
|---|
| 40 | } | 
|---|
| 41 |  | 
|---|
| 42 |  | 
|---|
| 43 | STSubTable::~STSubTable() | 
|---|
| 44 | { | 
|---|
| 45 | } | 
|---|
| 46 |  | 
|---|
| 47 | STSubTable& asap::STSubTable::operator=( const STSubTable& other) | 
|---|
| 48 | { | 
|---|
| 49 | if (&other != this) { | 
|---|
| 50 | this->table_ = other.table_; | 
|---|
| 51 | idCol_.attach(this->table_,"ID"); | 
|---|
| 52 | } | 
|---|
| 53 | return *this; | 
|---|
| 54 | } | 
|---|
| 55 |  | 
|---|
| 56 |  | 
|---|
| 57 | } | 
|---|