source: branches/hpc34/src/STSubTable.cpp@ 2582

Last change on this file since 2582 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
Line 
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
22using namespace casa;
23
24namespace asap {
25
26STSubTable::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}
36STSubTable::STSubTable(Table tab, const String& name)
37{
38 table_ = tab.rwKeywordSet().asTable(name);
39 idCol_.attach(table_,"ID");
40}
41
42
43STSubTable::~STSubTable()
44{
45}
46
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;
54}
55
56
57}
Note: See TracBrowser for help on using the repository browser.