casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
DataManAccessor.h
Go to the documentation of this file.
00001 //# DataManAccessor.h: Base class for the Data Manager Accessor classes
00002 //# Copyright (C) 1996,1999
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: DataManAccessor.h 21295 2012-11-30 16:00:01Z gervandiepen $
00027 
00028 #ifndef TABLES_DATAMANACCESSOR_H
00029 #define TABLES_DATAMANACCESSOR_H
00030 
00031 //# Includes
00032 #include <casa/aips.h>
00033 #include <tables/Tables/DataManager.h>
00034 #include <iosfwd>
00035 
00036 namespace casa { //# NAMESPACE CASA - BEGIN
00037 
00038 // <summary>
00039 // Base class for the Data Manager Accessor classes.
00040 // </summary>
00041 
00042 // <use visibility=local>
00043 
00044 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
00045 // </reviewed>
00046 
00047 // <prerequisite>
00048 //# Classes you should understand before using this one.
00049 // <li> <linkto class=DataManager>DataManager</linkto>
00050 // </prerequisite>
00051 
00052 // <synopsis>
00053 // The Table system has one or more data managers underneath.
00054 // Once a table is constructed, these data managers are invisible
00055 // and there is no way to get access to them.
00056 // However, sometimes limited access to them is needed (e.g. to
00057 // set the size of an internal cache).
00058 // <p>
00059 // This class should be used as the base class for specialized
00060 // Data Manager Accessor classes (e.g. class
00061 // <linkto class=ROIncrementalStManAccessor:description>
00062 // ROIncrementalStManAccessor</linkto>.
00063 // This base class provides the functionality to get the
00064 // <src>DataManager</src> object for a given column.
00065 // </synopsis> 
00066 
00067 // <motivation>
00068 // This base class makes it possible that every derived class can get the
00069 // data manager, because RODataManAccessor is a friend of class Table.
00070 // Otherwise all accessor classes needed to be friend of Table.
00071 // </motivation>
00072 
00073 //# <todo asof="$DATE:$">
00074 //# </todo>
00075 
00076 
00077 class RODataManAccessor
00078 {
00079 public:
00080     // Construct an empty object.
00081     RODataManAccessor()
00082       : itsDataManager(0)
00083     {}
00084 
00085     // Construct the accessor object for a data manager in the table.
00086     // An exception is thrown if the name of the data manager or column is
00087     // unknown.
00088     RODataManAccessor (const Table& table, const String& name,
00089                        Bool byColumn);
00090 
00091     virtual ~RODataManAccessor();
00092 
00093     // Set data manager properties using the fields in the record.
00094     // Each data manager has its specific set of properties.
00095     void setProperties (const Record&) const;
00096 
00097     // Get data manager properties as a record.
00098     Record getProperties() const;
00099 
00100     // Get the data manager type.
00101     String dataManagerType() const
00102       { return itsDataManager->dataManagerType(); } 
00103 
00104     // Get the data manager name.
00105     String dataManagerName() const
00106       { return itsDataManager->dataManagerName(); } 
00107 
00108     // Get the data manager sequence nr.
00109     uInt dataManagerSeqNr() const
00110       { return itsDataManager->sequenceNr(); } 
00111 
00112     // Show IO statistics.
00113     void showCacheStatistics (ostream& os) const
00114       { itsDataManager->showCacheStatistics (os); }
00115 
00116 protected:
00117     // Get the data manager for the given data manager or column name.
00118     DataManager* baseDataManager() const
00119       { return itsDataManager; }
00120 
00121 private:
00122     DataManager* itsDataManager;
00123 };
00124 
00125 
00126 } //# NAMESPACE CASA - END
00127 
00128 #endif