casacore
Loading...
Searching...
No Matches
IncrStManAccessor.h
Go to the documentation of this file.
1//# IncrStManAccessor.h: Gives access to some IncrementalStMan functions
2//# Copyright (C) 1996,1999,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: casa-feedback@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#ifndef TABLES_INCRSTMANACCESSOR_H
27#define TABLES_INCRSTMANACCESSOR_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/tables/DataMan/DataManAccessor.h>
32#include <casacore/casa/iosfwd.h>
33
34namespace casacore { //# NAMESPACE CASACORE - BEGIN
35
36//# Forward Declarations
37class ISMBase;
38class DataManager;
39class Table;
40class String;
41
42// <summary>
43// Give access to some IncrementalStMan functions
44// </summary>
45
46// <use visibility=export>
47
48// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
49// </reviewed>
50
51// <prerequisite>
52//# Classes you should understand before using this one.
53// <li> <linkto class=IncrementalStMan>IncrementalStMan</linkto>
54// </prerequisite>
55
56// <synopsis>
57// The Table system has one or more storage managers underneath.
58// One of these possible storage managers is the
59// <linkto class=IncrementalStMan>IncrementalStMan</linkto>.
60// This storage manager uses a cache of buckets. The default
61// cache size is defined when the IncrementalStMan object was
62// constructed at the time the table was created.
63// <p>
64// Sometimes it can be useful to change the cache size. E.g. when
65// the table is accessed in a random way, the hit rate may drop
66// when the cache is too small. The class ROIncrStManAccessor makes
67// it possible to change the cache size in a temporary way.
68// <br>
69// Furthermore this class makes it possible to show the cache size
70// and to show the cache statistics.
71
72// <motivation>
73// In principle a pointer to IncrementalStMan could be used.
74// However, that would give access to all public functions.
75// Furthermore it could not distinguish between read/write and readonly
76// tables.
77// </motivation>
78
79// <example>
80// This example shows how to set the cache size for
81// the incremental storage manager with the name "ISMExample". The cache
82// size is not persistent, i.e. when the same table is reopened
83// at a later time, this cache size is not remembered.
84// <srcblock>
85// // Open a table.
86// Table table("someName.data");
87// // Set the cache size of its incremental storage manager ISMExample
88// // to 5 buckets.
89// ROIncrementalStManAccessor accessor(table, "ISMExample");
90// accessor.setCacheSize (5);
91// </srcblock>
92// </example>
93
94//# <todo asof="$DATE:$">
95//# </todo>
96
97
99{
100public:
101
102 // Construct the object for a data manager in the table given the name
103 // of the data manager or the column.
104 // An exception is thrown if the data manager type is not the incremental
105 // storage manager.
106 ROIncrementalStManAccessor (const Table& table, const String& name,
107 Bool byColumn=False);
108
110
111 // Copy constructor (reference semantics).
113
114 // Assignment (reference semantics).
116 (const ROIncrementalStManAccessor& that);
117
118 // Set the cache size (in buckets) to be used by the
119 // storage manager.
120 // The cache size given in this way is not persistent.
121 // Only the cache size given to the constructors of the incremental
122 // storage managers, is persistent.
123 // If <src>canExceedNrBuckets=True</src>, the given cache size can be
124 // larger than the nr of buckets in the file. In this way the cache can
125 // be made large enough for a future file extnsion.
126 // Otherwise, it is limited to the actual number of buckets. This is useful
127 // if one wants the entire file to be cached.
128 void setCacheSize (uInt aSize, Bool canExceedNrBuckets=True);
129
130 // Get the cache size (in buckets).
132
133 // Clear the caches used by the hypercubes in this storage manager.
134 // It will flush the caches as needed and remove all buckets from them
135 // resulting in a possibly large drop in memory used.
137
138 // Show the index used by this storage manager.
139 void showIndexStatistics (ostream& os) const;
140
141 // Show the layout of the buckets used by this storage manager.
142 void showBucketLayout (ostream& os) const;
143
144 // Check that there are no repeated rowIds in the buckets comprising this ISM
145 Bool checkBucketLayout (uInt& offendingCursor,
146 rownr_t& offendingBucketStartRow,
147 uInt& offendingBucketNrow,
148 uInt& offendingBucketNr,
149 uInt& offendingCol,
150 uInt& offendingIndex,
151 rownr_t& offendingRow,
152 rownr_t& offendingPrevRow) const;
153
154private:
155 //# Declare the data members.
157};
158
159
160
161} //# NAMESPACE CASACORE - END
162
163#endif
void setCacheSize(uInt aSize, Bool canExceedNrBuckets=True)
Set the cache size (in buckets) to be used by the storage manager.
void clearCache()
Clear the caches used by the hypercubes in this storage manager.
ROIncrementalStManAccessor(const ROIncrementalStManAccessor &that)
Copy constructor (reference semantics).
void showIndexStatistics(ostream &os) const
Show the index used by this storage manager.
uInt cacheSize() const
Get the cache size (in buckets).
ROIncrementalStManAccessor(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...
void showBucketLayout(ostream &os) const
Show the layout of the buckets used by this storage manager.
Bool checkBucketLayout(uInt &offendingCursor, rownr_t &offendingBucketStartRow, uInt &offendingBucketNrow, uInt &offendingBucketNr, uInt &offendingCol, uInt &offendingIndex, rownr_t &offendingRow, rownr_t &offendingPrevRow) const
Check that there are no repeated rowIds in the buckets comprising this ISM.
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Bool True
Definition aipstype.h:41
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44