00001 //# TableAttr.h: Some attributes of a table 00002 //# Copyright (C) 2001 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id$ 00027 00028 #ifndef TABLES_TABLEATTR_H 00029 #define TABLES_TABLEATTR_H 00030 00031 //# Includes 00032 #include <casacore/casa/aips.h> 00033 #include <casacore/casa/BasicSL/String.h> 00034 #include <casacore/tables/Tables/TableLock.h> 00035 00036 namespace casacore { //# NAMESPACE CASACORE - BEGIN 00037 00038 //# Forward Declarations 00039 class Table; 00040 00041 00042 // <summary> 00043 // Some attributes of a table. 00044 // </summary> 00045 00046 // <use visibility=local> 00047 00048 // <reviewed reviewer="Mark Wieringa" date="1996/04/15" tests="tTableRecord"> 00049 // </reviewed> 00050 00051 // <prerequisite> 00052 //# Classes you should understand before using this one. 00053 // <li> <linkto class=TableRecord>TableRecord</linkto> 00054 // <li> <linkto class=Table>Table</linkto> 00055 // </prerequisite> 00056 00057 // <synopsis> 00058 // This class holds some attributes of a table. 00059 // These attributes are name, readable/writable, and lock options. 00060 // <br> 00061 // The primary use of the class is to be able to pass the various 00062 // attributes of the parent table to its subtables (e.g. in classes 00063 // like <linkto class=TableRecord>TableRecord</linkto> and 00064 // <linkto class=TableKeyword>TableKeyword</linkto>). 00065 // </synopsis> 00066 00067 // <motivation> 00068 // This class makes it possible to have more attributes without 00069 // having to alter the classes using subtables. 00070 // </motivation> 00071 00072 //# <todo asof="$DATE:$"> 00073 //# A List of bugs, limitations, extensions or planned refinements. 00074 //# </todo> 00075 00076 00077 class TableAttr 00078 { 00079 public: 00080 // Default constructor results in empty name. 00081 TableAttr(); 00082 00083 // Construct the attributes from the table. 00084 explicit TableAttr (const Table& table); 00085 00086 // Construct with given values. 00087 // <group> 00088 explicit TableAttr (const String& name, Bool openWritable = False); 00089 TableAttr (const String& name, Bool openWritable, const TableLock&); 00090 // </group> 00091 00092 // Copy constructor (copy semantics). 00093 TableAttr (const TableAttr& that); 00094 00095 // Assignment (copy semantics). 00096 // <group> 00097 TableAttr& operator= (const TableAttr& that); 00098 TableAttr& operator= (const Table& table); 00099 // </group> 00100 00101 ~TableAttr(); 00102 00103 // Set the object to for another table. 00104 void set (const Table& table); 00105 00106 // Set the keyword to read/write access. 00107 void setRW() 00108 { openWritable_p = True; } 00109 00110 void setName (const String& name) 00111 { name_p = name; } 00112 00113 // Get info. 00114 // <group> 00115 const String& name() const 00116 { return name_p; } 00117 Bool openWritable() const 00118 { return openWritable_p; } 00119 const TableLock& lockOptions() const 00120 { return lockOptions_p; } 00121 // </group> 00122 00123 private: 00124 String name_p; 00125 Bool openWritable_p; 00126 TableLock lockOptions_p; 00127 }; 00128 00129 00130 00131 } //# NAMESPACE CASACORE - END 00132 00133 #endif