casa
$Rev:20696$
|
00001 //# StandardStManAccessor.h: Gives access to some StandardStMan functions 00002 //# Copyright (C) 2000,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: StandardStManAccessor.h 21295 2012-11-30 16:00:01Z gervandiepen $ 00027 00028 #ifndef TABLES_STANDARDSTMANACCESSOR_H 00029 #define TABLES_STANDARDSTMANACCESSOR_H 00030 00031 //# Includes 00032 #include <casa/aips.h> 00033 #include <tables/Tables/DataManAccessor.h> 00034 #include <casa/iosfwd.h> 00035 00036 namespace casa { //# NAMESPACE CASA - BEGIN 00037 00038 //# Forward Declarations 00039 class SSMBase; 00040 class DataManager; 00041 class Table; 00042 class String; 00043 00044 // <summary> 00045 // Give access to some StandardStMan functions 00046 // </summary> 00047 00048 // <use visibility=export> 00049 00050 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tStandardStMan"> 00051 // </reviewed> 00052 00053 // <prerequisite> 00054 //# Classes you should understand before using this one. 00055 // <li> <linkto class=StandardStMan>StandardStMan</linkto> 00056 // </prerequisite> 00057 00058 // <synopsis> 00059 // The Table system has one or more storage managers underneath. 00060 // One of these possible storage managers is the 00061 // <linkto class=StandardStMan>StandardStMan</linkto>. 00062 // This storage manager uses a cache of buckets. The default 00063 // cache size is defined when the StandardStMan object was 00064 // constructed at the time the table was created. 00065 // <p> 00066 // Sometimes it can be useful to change the cache size. E.g. when 00067 // the table is accessed in a random way, the hit rate may drop 00068 // when the cache is too small. The class ROStandardStManAccessor makes 00069 // it possible to change the cache size in a temporary way. 00070 // <br> 00071 // It is also possible to get the cache size. 00072 // <p> 00073 // Furthermore it is possible to show some statistics (about the cache 00074 // and the internals of SSM classes). 00075 // </synopsis> 00076 00077 // <motivation> 00078 // In principle a pointer to StandardStMan could be used. 00079 // However, that would give access to all public functions. 00080 // Furthermore it could not distinguish between read/write and readonly 00081 // tables. 00082 // </motivation> 00083 00084 // <example> 00085 // This example shows how to set the cache size for 00086 // the standard storage manager with the name "SSMExample". The cache 00087 // size is not persistent, i.e. when the same table is reopened 00088 // at a later time, this cache size is not remembered. 00089 // <srcblock> 00090 // // Open a table. 00091 // Table table("someName.data"); 00092 // // Set the cache size of its standard storage manager SSMExample 00093 // // to 5 buckets. 00094 // ROStandardStManAccessor accessor(table, "SSMExample"); 00095 // accessor.setCacheSize (5); 00096 // </srcblock> 00097 // </example> 00098 00099 //# <todo asof="$DATE:$"> 00100 //# </todo> 00101 00102 00103 class ROStandardStManAccessor : public RODataManAccessor 00104 { 00105 public: 00106 00107 // Construct the object for a data manager in the table given the name 00108 // of the data manager or the column. 00109 // An exception is thrown if the data manager type is not the incremental 00110 // storage manager. 00111 ROStandardStManAccessor (const Table& table, const String& name, 00112 Bool byColumn=False); 00113 00114 virtual ~ROStandardStManAccessor(); 00115 00116 // Copy constructor (reference semantics). 00117 ROStandardStManAccessor (const ROStandardStManAccessor& that); 00118 00119 // Assignment (reference semantics). 00120 ROStandardStManAccessor& operator= 00121 (const ROStandardStManAccessor& that); 00122 00123 // Set the cache size (in buckets) to be used by the 00124 // storage manager. 00125 // The cache size given in this way is not persistent. 00126 // Only the cache size given to the constructors of the Standard 00127 // storage managers, is persistent. 00128 // If <src>canExceedNrBuckets=True</src>, the given cache size can be 00129 // larger than the nr of buckets in the file. In this way the cache can 00130 // be made large enough for a future file extnsion. 00131 // Otherwise, it is limited to the actual number of buckets. This is useful 00132 // if one wants the entire file to be cached. 00133 void setCacheSize (uInt aSize, Bool canExceedNrBuckets=True); 00134 00135 // Get the cache size (in buckets). 00136 uInt getCacheSize() const; 00137 00138 // Clear the cache used by this storage manager. 00139 // It will flush the cache as needed and remove all buckets from it 00140 // resulting in a drop in memory used. 00141 void clearCache(); 00142 00143 // Show the statistics for the base class. 00144 void showBaseStatistics (ostream& anOs) const; 00145 00146 // Show the statistics for each index used by this storage manager. 00147 void showIndexStatistics (ostream& anOs) const; 00148 00149 00150 private: 00151 //# Declare the data members. 00152 SSMBase* itsSSMPtr; 00153 }; 00154 00155 00156 00157 } //# NAMESPACE CASA - END 00158 00159 #endif