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
98 public:
99 // Construct the object for a data manager in the table given the name
100 // of the data manager or the column.
101 // An exception is thrown if the data manager type is not the incremental
102 // storage manager.
103 ROIncrementalStManAccessor(const Table& table, const String& name, Bool byColumn = False);
104
106
107 // Copy constructor (reference semantics).
109
110 // Assignment (reference semantics).
112
113 // Set the cache size (in buckets) to be used by the
114 // storage manager.
115 // The cache size given in this way is not persistent.
116 // Only the cache size given to the constructors of the incremental
117 // storage managers, is persistent.
118 // If <src>canExceedNrBuckets=True</src>, the given cache size can be
119 // larger than the nr of buckets in the file. In this way the cache can
120 // be made large enough for a future file extnsion.
121 // Otherwise, it is limited to the actual number of buckets. This is useful
122 // if one wants the entire file to be cached.
123 void setCacheSize(uInt aSize, Bool canExceedNrBuckets = True);
124
125 // Get the cache size (in buckets).
127
128 // Clear the caches used by the hypercubes in this storage manager.
129 // It will flush the caches as needed and remove all buckets from them
130 // resulting in a possibly large drop in memory used.
132
133 // Show the index used by this storage manager.
134 void showIndexStatistics(ostream& os) const;
135
136 // Show the layout of the buckets used by this storage manager.
137 void showBucketLayout(ostream& os) const;
138
139 // Check that there are no repeated rowIds in the buckets comprising this ISM
140 Bool checkBucketLayout(uInt& offendingCursor, rownr_t& offendingBucketStartRow,
141 uInt& offendingBucketNrow, uInt& offendingBucketNr, uInt& offendingCol,
142 uInt& offendingIndex, rownr_t& offendingRow,
143 rownr_t& offendingPrevRow) const;
144
145 private:
146 // # Declare the data members.
148};
149
150} // namespace casacore
151
152#endif
Abstract base class for a data manager.
RODataManAccessor()
Construct an empty object.
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).
ROIncrementalStManAccessor & operator=(const ROIncrementalStManAccessor &that)
Assignment (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:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
unsigned int uInt
Definition aipstype.h:49
String name() const
Return the name of the field.
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