casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StandardStManAccessor.h
Go to the documentation of this file.
1 //# StandardStManAccessor.h: Gives access to some StandardStMan functions
2 //# Copyright (C) 2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef TABLES_STANDARDSTMANACCESSOR_H
29 #define TABLES_STANDARDSTMANACCESSOR_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
34 #include <casacore/casa/iosfwd.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward Declarations
39 class SSMBase;
40 class DataManager;
41 class Table;
42 class String;
43 
44 // <summary>
45 // Give access to some StandardStMan functions
46 // </summary>
47 
48 // <use visibility=export>
49 
50 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tStandardStMan">
51 // </reviewed>
52 
53 // <prerequisite>
54 //# Classes you should understand before using this one.
55 // <li> <linkto class=StandardStMan>StandardStMan</linkto>
56 // </prerequisite>
57 
58 // <synopsis>
59 // The Table system has one or more storage managers underneath.
60 // One of these possible storage managers is the
61 // <linkto class=StandardStMan>StandardStMan</linkto>.
62 // This storage manager uses a cache of buckets. The default
63 // cache size is defined when the StandardStMan object was
64 // constructed at the time the table was created.
65 // <p>
66 // Sometimes it can be useful to change the cache size. E.g. when
67 // the table is accessed in a random way, the hit rate may drop
68 // when the cache is too small. The class ROStandardStManAccessor makes
69 // it possible to change the cache size in a temporary way.
70 // <br>
71 // It is also possible to get the cache size.
72 // <p>
73 // Furthermore it is possible to show some statistics (about the cache
74 // and the internals of SSM classes).
75 // </synopsis>
76 
77 // <motivation>
78 // In principle a pointer to StandardStMan could be used.
79 // However, that would give access to all public functions.
80 // Furthermore it could not distinguish between read/write and readonly
81 // tables.
82 // </motivation>
83 
84 // <example>
85 // This example shows how to set the cache size for
86 // the standard storage manager with the name "SSMExample". The cache
87 // size is not persistent, i.e. when the same table is reopened
88 // at a later time, this cache size is not remembered.
89 // <srcblock>
90 // // Open a table.
91 // Table table("someName.data");
92 // // Set the cache size of its standard storage manager SSMExample
93 // // to 5 buckets.
94 // ROStandardStManAccessor accessor(table, "SSMExample");
95 // accessor.setCacheSize (5);
96 // </srcblock>
97 // </example>
98 
99 //# <todo asof="$DATE:$">
100 //# </todo>
101 
102 
104 {
105 public:
106 
107  // Construct the object for a data manager in the table given the name
108  // of the data manager or the column.
109  // An exception is thrown if the data manager type is not the incremental
110  // storage manager.
111  ROStandardStManAccessor (const Table& table, const String& name,
112  Bool byColumn=False);
113 
114  virtual ~ROStandardStManAccessor();
115 
116  // Copy constructor (reference semantics).
118 
119  // Assignment (reference semantics).
120  ROStandardStManAccessor& operator=
121  (const ROStandardStManAccessor& that);
122 
123  // Set the cache size (in buckets) to be used by the
124  // storage manager.
125  // The cache size given in this way is not persistent.
126  // Only the cache size given to the constructors of the Standard
127  // storage managers, is persistent.
128  // If <src>canExceedNrBuckets=True</src>, the given cache size can be
129  // larger than the nr of buckets in the file. In this way the cache can
130  // be made large enough for a future file extension.
131  // Otherwise, it is limited to the actual number of buckets. This is useful
132  // if one wants the entire file to be cached.
133  void setCacheSize (uInt aSize, Bool canExceedNrBuckets=True);
134 
135  // Get the cache size (in buckets).
136  uInt getCacheSize() const;
137 
138  // Clear the cache used by this storage manager.
139  // It will flush the cache as needed and remove all buckets from it
140  // resulting in a drop in memory used.
141  void clearCache();
142 
143  // Show the statistics for the base class.
144  void showBaseStatistics (ostream& anOs) const;
145 
146  // Show the statistics for each index used by this storage manager.
147  void showIndexStatistics (ostream& anOs) const;
148 
149 
150 private:
151  //# Declare the data members.
153 };
154 
155 
156 
157 } //# NAMESPACE CASACORE - END
158 
159 #endif
Main interface class to a read/write table.
Definition: Table.h:153
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
Base class of the Standard Storage Manager.
Definition: SSMBase.h:158
void clearCache()
Clear the cache used by this storage manager.
void setCacheSize(uInt aSize, Bool canExceedNrBuckets=True)
Set the cache size (in buckets) to be used by the storage manager.
uInt getCacheSize() const
Get the cache size (in buckets).
void showIndexStatistics(ostream &anOs) const
Show the statistics for each index used by this storage manager.
ROStandardStManAccessor(const Table &table, const String &name, Bool byColumn=False)
Construct the object for a data manager in the table given the name of the data manager or the column...
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool False
Definition: aipstype.h:44
void showBaseStatistics(ostream &anOs) const
Show the statistics for the base class.
Give access to some StandardStMan functions.
Base class for the Data Manager Accessor classes.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
const Bool True
Definition: aipstype.h:43
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42