casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TableAttr.h
Go to the documentation of this file.
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: TableAttr.h 20652 2009-07-06 05:04:32Z Malte.Marquarding $
00027 
00028 #ifndef TABLES_TABLEATTR_H
00029 #define TABLES_TABLEATTR_H
00030 
00031 //# Includes
00032 #include <casa/aips.h>
00033 #include <casa/BasicSL/String.h>
00034 #include <tables/Tables/TableLock.h>
00035 
00036 namespace casa { //# NAMESPACE CASA - 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     // If the table is already open, it will be reopened with read/write
00108     // access if the table is writable.
00109     void setRW()
00110       { openWritable_p = True; }
00111 
00112     void setName (const String& name)
00113       { name_p = name; }
00114 
00115     // Get info.
00116     // <group>
00117     const String& name() const
00118       { return name_p; }
00119     Bool openWritable() const
00120       { return openWritable_p; }
00121     const TableLock& lockOptions() const
00122       { return lockOptions_p; }
00123     // </group>
00124 
00125 private:
00126     String    name_p;
00127     Bool      openWritable_p;
00128     TableLock lockOptions_p;
00129 };
00130 
00131 
00132 
00133 } //# NAMESPACE CASA - END
00134 
00135 #endif