source: trunk/src/STSubTable.cpp@ 2750

Last change on this file since 2750 was 857, checked in by mar637, 19 years ago

added name()
reworked copy constructor for (Table tab) to tale name of the derived class
fixed bug in constructor, where Table::New was used instead of Table::Scratch

File size: 1.2 KB
RevLine 
[808]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>
[857]16#include <tables/Tables/TableRecord.h>
[808]17
[849]18#include "Scantable.h"
[808]19#include "STSubTable.h"
20
[849]21
[808]22using namespace casa;
23
24namespace asap {
25
[849]26STSubTable::STSubTable( const Scantable& parent, const casa::String& name )
[808]27{
28 TableDesc td("", "1", TableDesc::Scratch);
29 td.addColumn(ScalarColumnDesc<uInt>("ID"));
[849]30 String tabname = parent.table().tableName()+"/"+name;
[857]31 SetupNewTable aNewTab(tabname, td, Table::Scratch);
[849]32 table_ = Table(aNewTab, parent.table().tableType());
[808]33 idCol_.attach(table_,"ID");
34
35}
[857]36STSubTable::STSubTable(Table tab, const String& name)
[849]37{
[857]38 table_ = tab.rwKeywordSet().asTable(name);
[849]39 idCol_.attach(table_,"ID");
40}
[808]41
[849]42
[808]43STSubTable::~STSubTable()
44{
45}
46
[849]47STSubTable& 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;
[808]54}
[849]55
56
57}
Note: See TracBrowser for help on using the repository browser.