/usr/include/casacore/tables/Tables/ColumnCache.h is in casacore-dev 2.2.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | //# ColumnCache.h: A caching object for a table column
//# Copyright (C) 1997
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
//# $Id$
#ifndef TABLES_COLUMNCACHE_H
#define TABLES_COLUMNCACHE_H
//# Includes
#include <casacore/casa/aips.h>
namespace casacore { //# NAMESPACE CASACORE - BEGIN
// <summary>
// A caching object for a table column.
// </summary>
// <use visibility=local>
// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="">
// </reviewed>
// <prerequisite>
//# Classes you should understand before using this one.
// <li> <linkto class=ScalarColumn>ScalarColumn</linkto>
// </prerequisite>
// <synopsis>
// ColumnCache acts as a cache for a table column.
// It contains a pointer to data and the start and end row number
// for which these data are valid. An increment is part of the object
// and is usually 0 or 1. The value 0 is used for data which is
// valid for multiple rows (as used in
// <linkto class=IncrementalStMan>IncrementalStMan</linkto>).
// The value 1 is used for data stored consecutevily in a buffer for
// each row (as used in <linkto class=StManAipsIO>StManAipsIO</linkto>).
// <p>
// The ColumnCache object is created and updated by the data manager.
// The top level <linkto class=ScalarColumn>ScalarColumn</linkto> object
// contains a pointer to the cache object. In this way the
// <src>ScalarColumn::get</src> can often be executed by a few inlined
// statements which improves performance considerably.
// <p>
// The <src>invalidate</src> function can be used to invalidate the
// cache. This is for instance needed when a table lock is acquired
// or released to be sure that the cache gets refreshed.
// </synopsis>
// <motivation>
// This class was developed to improve the performance for getting a scalar.
// </motivation>
// <todo asof="$DATE:$">
// <li>For ConcatColumn add the ability to have other ColumnCache objects
// using this one and invalidate them as well.
// </todo>
class ColumnCache
{
public:
// Constructor.
// It sets the increment to 1 and calls invalidate.
ColumnCache();
// Set the increment to the given value.
void setIncrement (uInt increment);
// Set the start and end row number for which the given data pointer
// is valid.
void set (uInt startRow, uInt endRow, const void* dataPtr);
// Invalidate the cache.
// This clears the data pointer and sets startRow>endRow.
void invalidate();
// Calculate the offset in the cached data for the given row.
// -1 is returned if the row is not within the cached rows.
Int offset (uInt rownr) const;
// Give a pointer to the data.
// The calling function has to do a proper cast after which the
// calculated offset can be added to get the proper data.
const void* dataPtr() const;
// Give the start, end (including), and increment row number
// of the cached column values.
uInt start() const {return itsStart;}
uInt end() const {return itsEnd;}
uInt incr() const {return itsIncr;}
private:
uInt itsStart;
uInt itsEnd;
uInt itsIncr;
const void* itsData;
};
inline void ColumnCache::setIncrement (uInt increment)
{
itsIncr = increment;
}
inline void ColumnCache::invalidate()
{
set (1, 0, 0);
}
inline Int ColumnCache::offset (uInt rownr) const
{
return rownr<itsStart || rownr>itsEnd ? -1 :
Int((rownr-itsStart)*itsIncr);
}
inline const void* ColumnCache::dataPtr() const
{
return itsData;
}
/*
inline uInt ColumnCache::start() const
{
return itsStart;
}
inline uInt ColumnCache::end() const
{
return itsEnd;
}
inline uInt ColumnCache::incr() const
{
return itsIncr;
}
*/
} //# NAMESPACE CASACORE - END
#endif
|