/usr/include/casacore/tables/Tables/BaseColDesc.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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | //# BaseColDesc.h: an abstract base class for column descriptions
//# Copyright (C) 1994,1995,1996,1997,1999,2000,2001
//# 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_BASECOLDESC_H
#define TABLES_BASECOLDESC_H
//# Includes
#include <casacore/casa/aips.h>
#include <casacore/casa/Utilities/DataType.h>
#include <casacore/casa/Arrays/IPosition.h>
#include <casacore/casa/BasicSL/String.h>
#include <casacore/casa/iosfwd.h>
namespace casacore { //# NAMESPACE CASACORE - BEGIN
//# Forward Declarations
class AipsIO;
class ColumnDescSet;
class TableRecord;
class TableAttr;
class BaseColumn;
class PlainColumn;
class RefTable;
class RefColumn;
class ConcatTable;
class ConcatColumn;
class TableDesc;
class ColumnSet;
// <summary>
// An abstract base class for table column descriptions
// </summary>
// <use visibility=local>
// <reviewed reviewer="Paul Shannon" date="1994/08/11" tests="none">
// </reviewed>
// <prerequisite>
// <li> Tables module (see especially Tables.h, the module header file)
// <li> The description of letter/envelope class design, and its
// application to the family of classes of which BaseColumnDesc
// is a part, in ColumnDesc.h
// <li> TableDesc
// </prerequisite>
// <etymology>
// "Base" indicates that this is a base class for the specialized
// column description classes.
// </etymology>
// <synopsis>
// BaseColumnDesc is an abstract class describing a column in a table.
// Various XXXXColumnDesc classes are derived from it to describe
// the various types of columns, among them ArrayColumnDesc<T>
// and ScalarcolumnDesc<T>. These derived classes are used to
// construct a column description which can be added to the TableDesc.
//
// BaseColumnDesc contains functions common to all kinds of column
// descriptions.
// It contains a TableRecord to attach simple keywords to the
// column description (e.g. to define a scale-factor). This keyword set
// serves as the initial keyword set for the column when a table
// gets instantiated from a table description.
//
// The ColumnDesc class is an envelope around BaseColumnDesc, which
// can be used to get information about existing column descriptions.
// </synopsis>
// <motivation>
// This abstract base class defines the common features required of all
// concrete column description classes. It also provides the hook (for
// letter objects) required by ColumnDesc, the envelope class.
// </motivation>
// <todo asof="$DATE:$">
//# A List of bugs, limitations, extensions or planned refinements.
// </todo>
class BaseColumnDesc
{
//# Allow ColumnDesc to call the private functions checkAdd, etc..
friend class ColumnDesc;
public:
// Construct the column base object.
BaseColumnDesc (const String& name, const String& comment,
const String& dataManagerType,
const String& dataManagerGroup,
DataType, const String& dataTypeId,
Int options, uInt ndim, const IPosition& shape,
Bool isScalar, Bool isArray, Bool isTable);
// Copy constructor (copy semantics).
BaseColumnDesc (const BaseColumnDesc&);
virtual ~BaseColumnDesc ();
// Get access to the set of keywords.
// <group>
TableRecord& rwKeywordSet()
{ return *keySetPtr_p; }
const TableRecord& keywordSet() const
{ return *keySetPtr_p; }
// </group>
// Show the column.
virtual void show (ostream& os) const = 0;
// Get the name of the column.
const String& name() const
{ return colName_p; }
// Get the data type of the column.
DataType dataType() const
{ return dtype_p; }
// Get the type id for non-standard data types (i.e. for TpOther).
// For standard data types the returned string is empty.
const String& dataTypeId() const
{ return dtypeId_p; }
// Get the type name of the default data manager.
const String& dataManagerType() const
{ return dataManType_p; }
// Get the type name of the default data manager.
// (allowing it to be changed)
String& dataManagerType()
{ return dataManType_p; }
// Get the data manager group.
const String& dataManagerGroup() const
{ return dataManGroup_p; }
// Get the data manager group.
// (allowing it to be changed)
String& dataManagerGroup()
{ return dataManGroup_p; }
// Set the data manager type and group to the default.
// If <src>always==True</src> they are always set, otherwise only if empty.
void setDefaultDataManager (Bool always);
// Get comment string.
const String& comment() const
{ return comment_p; }
// Get comment string (allowing it to be changed).
String& comment()
{ return comment_p; }
// Get the options.
Int options() const
{ return option_p; }
// Test if column is scalar, array or table.
// <group>
Bool isScalar() const
{ return isScalar_p; }
Bool isArray() const
{ return isArray_p; }
Bool isTable() const
{ return isTable_p; }
// </group>
// Get the number of dimensions.
Int ndim() const
{ return nrdim_p; }
// Get the predefined shape.
// If not defined, a zero shape will be returned.
const IPosition& shape() const
{ return shape_p; }
// Set the number of dimensions.
// This is only allowed for arrays.
// <src>ndim</src> can be zero to clear the number of dimensions
// and the shape.
// Otherwise it can only be used if the dimensionality has not been
// defined yet.
void setNdim (uInt ndim);
// Set the predefined shape.
// This is only allowed for arrays, for which the shape
// has not been defined yet.
// If the dimensionality has already been defined, it must match.
// It will set the option FixedShape if not set yet.
// <br> The first version leaves the <src>Direct</src> option as is.
// The second version sets the <src>Direct</src> option as given.
// <group>
void setShape (const IPosition& shape);
void setShape (const IPosition& shape, Bool directOption);
// </group>
// Set the options to the given value.
// Option <src>ColumnDesc::Direct</src> forces <src>FixedShape</src>.
// If <src>FixedShape</src> is not given (implicitly or explicitly),
// the column can have no shape, so its shape is cleared.
void setOptions (Int options);
// Get the maximum value length.
uInt maxLength() const
{ return maxLength_p; }
// Set the maximum value length.
// So far, this is only possible for columns containing String values.
// An exception is thrown if the column data type is not TpString.
// Some storage managers support fixed length strings and can store
// them more efficiently than variable length strings.
void setMaxLength (uInt maxLength);
// Get table description (in case column contains subtables).
// <group>
//# Use the non-const version to implement the const one.
//# The cast is fully safe, because it returns a const object.
const TableDesc* tableDesc() const
{ return ((BaseColumnDesc*)this)->tableDesc(); }
virtual TableDesc* tableDesc();
// </group>
protected:
String colName_p; //# column name
String comment_p; //# comment
String dataManType_p; //# default data manager type
String dataManGroup_p; //# data manager group
DataType dtype_p; //# datatype
String dtypeId_p; //# datatype id for TpOther
Int option_p; //# column options
Int nrdim_p; //# #dimensions (<0 = unknown)
IPosition shape_p; //# table array shape
uInt maxLength_p; //# maximum value length (for strings)
TableRecord* keySetPtr_p; //# set of keywords
Bool isScalar_p; //# True = column contains scalars
Bool isArray_p; //# True = column contains arrays
Bool isTable_p; //# True = column contains tables
// Assignment (copy semantics).
BaseColumnDesc& operator= (const BaseColumnDesc&);
// Put the object.
// It uses putDesc to put the derived object.
void putFile (AipsIO&, const TableAttr&) const;
// Get the object.
// It uses getDesc to get the derived object.
void getFile (AipsIO&, const TableAttr&);
// Put the derived object.
virtual void putDesc (AipsIO&) const = 0;
// Get the derived object.
virtual void getDesc (AipsIO&) = 0;
// Make a PlainColumn object out of the description.
virtual PlainColumn* makeColumn (ColumnSet*) const = 0;
// Make a RefColumn object out of the description.
RefColumn* makeRefColumn (RefTable*, BaseColumn*) const;
// Make a ConcatColumn object out of the description.
// The default makes a ConcatColumn object.
// Derived classes (ScalarColumnDesc) can make more specialized objects.
virtual ConcatColumn* makeConcatColumn (ConcatTable*) const;
private:
// Check if a column can be handled by ColumnDescSet.
// This gives, for instance, the virtual column class the opportunity
// to check if the used columns exist.
// <group>
virtual void checkAdd (const ColumnDescSet& cds) const;
virtual void checkRename (const ColumnDescSet& cds,
const String& newName) const;
// </group>
// Take action after a column has been handled by ColumnDescSet.
// This gives, for instance, the virtual column class the opportunity
// to update the virtual column list.
// <group>
virtual void handleAdd (ColumnDescSet& cds);
virtual void handleRename (ColumnDescSet& cds, const String& oldName);
virtual void handleRemove (ColumnDescSet& cds);
// </group>
// This function allows each column to act upon a rename of another column.
// If the old name is used internally, the column can update itself.
virtual void renameAction (const String& newName, const String& oldName);
public:
// Clone a column description (creating a new column description object).
virtual BaseColumnDesc* clone() const = 0;
// Get the underlying class name.
virtual String className() const = 0;
// Set the name of the column (for a rename).
void setName (const String& name)
{ colName_p = name; }
};
} //# NAMESPACE CASACORE - END
#endif
|