Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.atnf.csiro.au/computing/software/casacore/casacore-1.2.0/doc/html/ISMIndex_8h_source.html
Дата изменения: Unknown
Дата индексирования: Mon Feb 14 20:03:55 2011
Кодировка:

Поисковые слова: о п п
casacore: tables/Tables/ISMIndex.h Source File

ISMIndex.h

Go to the documentation of this file.
00001 //# ISMIndex.h: The Index of the Incremental Storage Manager
00002 //# Copyright (C) 1996,1997,1999,2005
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: ISMIndex.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $
00027 
00028 #ifndef TABLES_ISMINDEX_H
00029 #define TABLES_ISMINDEX_H
00030 
00031 //# Includes
00032 #include <casa/aips.h>
00033 #include <casa/Containers/Block.h>
00034 
00035 namespace casa { //# NAMESPACE CASA - BEGIN
00036 
00037 //# Forward declarations
00038 class ISMBase;
00039 class AipsIO;
00040 
00041 
00042 // <summary>
00043 // The Index of the Incremental Storage Manager
00044 // </summary>
00045 
00046 // <use visibility=local>
00047 
00048 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
00049 // </reviewed>
00050 
00051 // <prerequisite>
00052 //# Classes you should understand before using this one.
00053 //   <li> <linkto class=ISMBase>ISMBase</linkto>
00054 // </prerequisite>
00055 
00056 // <etymology>
00057 // ISMIndex represents the index in the Incremental Storage Manager.
00058 // </etymology>
00059 
00060 // <synopsis>
00061 // ISMIndex maintains an index of all buckets in an ISM (Incremental Storage
00062 // Manager). The index consists of the starting row number and the
00063 // bucket number of each bucket in the BucketCache object of the ISM.
00064 // When the ISM is opened, the entire index is read in and kept in memory.
00065 // When the ISM is closed or flushed, the index is written back after
00066 // all buckets in the file. A little header at the beginning of the file
00067 // indicates the starting offset of the index.
00068 // </synopsis> 
00069 
00070 // <motivation>
00071 // ISMIndex encapsulates all operations on the ISM index.
00072 // </motivation>
00073 
00074 //# <todo asof="$DATE:$">
00075 //# A List of bugs, limitations, extensions or planned refinements.
00076 //# </todo>
00077 
00078 
00079 class ISMIndex
00080 {
00081 public:
00082     // Create a ISMIndex object with the given parent for a new table.
00083     // It keeps the pointer to its parent (but does not own it).
00084     explicit ISMIndex (ISMBase* parent);
00085 
00086     // The destructor closes the file (if opened).
00087     ~ISMIndex();
00088 
00089     // Add a row.
00090     void addRow (uInt nrrow);
00091 
00092     // Remove a row from the index.
00093     // If the result of this is that the entire bucket gets empty,
00094     // that bucketnr is returned. Otherwise -1 is returned.
00095     Int removeRow (uInt rownr);
00096 
00097     // Get the bucket number for the given row.
00098     // Also return the start row of the bucket and the number of rows in it.
00099     uInt getBucketNr (uInt rownr, uInt& bucketStartRow,
00100                       uInt& bucketNrrow) const;
00101 
00102     // Read the bucket index from the AipsIO object.
00103     void get (AipsIO& os);
00104 
00105     // Write the bucket index into the AipsIO object.
00106     void put (AipsIO& os);
00107 
00108     // Add a bucket number to the index.
00109     // Argument <src>rownr</src> gives the starting row of the bucket.
00110     // It is used to add the bucket number at the correct place
00111     // (such that the row numbers are kept in ascending order).
00112     void addBucketNr (uInt rownr, uInt bucketNr);
00113 
00114     // Get the number of the next bucket from the index and return
00115     // it in <src>bucketNr</src>. The starting row of that bucket and
00116     // the number of rows in the bucket are also returned.
00117     // Return status False indicates that no more buckets are available.
00118     // <br>The start of the iteration is indicated by cursor=0.
00119     // The first bucket returned is the bucket containing the rownr
00120     // given in <src>bucketStartRow</src> (thus set bucketStartRow
00121     // to 0 if you to start at the first bucket).
00122     // <br>The next iterations return the next bucket number and fill
00123     // the starting row and number of rows.
00124     Bool nextBucketNr (uInt& cursor, uInt& bucketStartRow, uInt& bucketNrrow,
00125                        uInt& bucketNr) const;
00126 
00127 private:
00128     // Forbid copy constructor.
00129     ISMIndex (const ISMIndex&);
00130 
00131     // Forbid assignment.
00132     ISMIndex& operator= (const ISMIndex&);
00133 
00134     // Get the index of the bucket containing the given row.
00135     uInt getIndex (uInt rownr) const;
00136 
00137 
00138     //# Declare member variables.
00139     // Pointer to the parent storage manager.
00140     ISMBase*          stmanPtr_p;
00141     // Number of entries used.
00142     uInt              nused_p;
00143     // Rownr index (i.e. row rows_p[i] starts in bucketNr_p[i]).
00144     Block<uInt>       rows_p;
00145     // Corresponding bucket number.
00146     Block<uInt>       bucketNr_p;
00147 };
00148 
00149 
00150 
00151 
00152 } //# NAMESPACE CASA - END
00153 
00154 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines