casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: 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_INCRSTMANACCESSOR_H
29 #define TABLES_INCRSTMANACCESSOR_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 ISMBase;
40 class DataManager;
41 class Table;
42 class String;
43 
44 // <summary>
45 // Give access to some IncrementalStMan functions
46 // </summary>
47 
48 // <use visibility=export>
49 
50 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
51 // </reviewed>
52 
53 // <prerequisite>
54 //# Classes you should understand before using this one.
55 // <li> <linkto class=IncrementalStMan>IncrementalStMan</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=IncrementalStMan>IncrementalStMan</linkto>.
62 // This storage manager uses a cache of buckets. The default
63 // cache size is defined when the IncrementalStMan 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 ROIncrStManAccessor makes
69 // it possible to change the cache size in a temporary way.
70 // <br>
71 // Furthermore this class makes it possible to show the cache size
72 // and to show the cache statistics.
73 
74 // <motivation>
75 // In principle a pointer to IncrementalStMan could be used.
76 // However, that would give access to all public functions.
77 // Furthermore it could not distinguish between read/write and readonly
78 // tables.
79 // </motivation>
80 
81 // <example>
82 // This example shows how to set the cache size for
83 // the incremental storage manager with the name "ISMExample". The cache
84 // size is not persistent, i.e. when the same table is reopened
85 // at a later time, this cache size is not remembered.
86 // <srcblock>
87 // // Open a table.
88 // Table table("someName.data");
89 // // Set the cache size of its incremental storage manager ISMExample
90 // // to 5 buckets.
91 // ROIncrementalStManAccessor accessor(table, "ISMExample");
92 // accessor.setCacheSize (5);
93 // </srcblock>
94 // </example>
95 
96 //# <todo asof="$DATE:$">
97 //# </todo>
98 
99 
101 {
102 public:
103 
104  // Construct the object for a data manager in the table given the name
105  // of the data manager or the column.
106  // An exception is thrown if the data manager type is not the incremental
107  // storage manager.
108  ROIncrementalStManAccessor (const Table& table, const String& name,
109  Bool byColumn=False);
110 
111  virtual ~ROIncrementalStManAccessor();
112 
113  // Copy constructor (reference semantics).
115 
116  // Assignment (reference semantics).
117  ROIncrementalStManAccessor& operator=
118  (const ROIncrementalStManAccessor& that);
119 
120  // Set the cache size (in buckets) to be used by the
121  // storage manager.
122  // The cache size given in this way is not persistent.
123  // Only the cache size given to the constructors of the incremental
124  // storage managers, is persistent.
125  // If <src>canExceedNrBuckets=True</src>, the given cache size can be
126  // larger than the nr of buckets in the file. In this way the cache can
127  // be made large enough for a future file extnsion.
128  // Otherwise, it is limited to the actual number of buckets. This is useful
129  // if one wants the entire file to be cached.
130  void setCacheSize (uInt aSize, Bool canExceedNrBuckets=True);
131 
132  // Get the cache size (in buckets).
133  uInt cacheSize() const;
134 
135  // Clear the caches used by the hypercubes in this storage manager.
136  // It will flush the caches as needed and remove all buckets from them
137  // resulting in a possibly large drop in memory used.
138  void clearCache();
139 
140  // Show the index used by this storage manager.
141  void showIndexStatistics (ostream& os) const;
142 
143  // Show the layout of the buckets used by this storage manager.
144  void showBucketLayout (ostream& os) const;
145 
146  // Check that there are no repeated rowIds in the buckets comprising this ISM
147  Bool checkBucketLayout (uInt &offendingCursor,
148  uInt &offendingBucketStartRow,
149  uInt &offendingBucketNrow,
150  uInt &offendingBucketNr,
151  uInt &offendingCol,
152  uInt &offendingIndex,
153  uInt &offendingRow,
154  uInt &offendingPrevRow) const;
155 
156 private:
157  //# Declare the data members.
159 };
160 
161 
162 
163 } //# NAMESPACE CASACORE - END
164 
165 #endif
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...
Bool checkBucketLayout(uInt &offendingCursor, uInt &offendingBucketStartRow, uInt &offendingBucketNrow, uInt &offendingBucketNr, uInt &offendingCol, uInt &offendingIndex, uInt &offendingRow, uInt &offendingPrevRow) const
Check that there are no repeated rowIds in the buckets comprising this ISM.
Main interface class to a read/write table.
Definition: Table.h:153
void setCacheSize(uInt aSize, Bool canExceedNrBuckets=True)
Set the cache size (in buckets) to be used by the storage manager.
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 Incremental Storage Manager.
Definition: ISMBase.h:87
void clearCache()
Clear the caches used by the hypercubes in this storage manager.
Give access to some IncrementalStMan functions.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
const Bool False
Definition: aipstype.h:44
uInt cacheSize() const
Get the cache size (in buckets).
Base class for the Data Manager Accessor classes.
void showBucketLayout(ostream &os) const
Show the layout of the buckets used by this storage manager.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void showIndexStatistics(ostream &os) const
Show the index used by this storage manager.
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