casacore
Loading...
Searching...
No Matches
RecordInterface.h
Go to the documentation of this file.
1// # RecordInterface.h: Abstract base class for Record classes
2// # Copyright (C) 1996,1997,1998,1999,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 CASA_RECORDINTERFACE_H
27#define CASA_RECORDINTERFACE_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/BasicSL/String.h>
32#include <casacore/casa/Utilities/DataType.h>
33#include <casacore/casa/Containers/RecordFieldId.h>
34#include <casacore/casa/Arrays/Array.h>
35
36namespace casacore { // # NAMESPACE CASACORE - BEGIN
37
38// # Forward Declarations
39class RecordDesc;
40class ValueHolder;
41class IPosition;
42
43// <summary>
44// Abstract base class for Record classes
45// </summary>
46
47// <use visibility=export>
48// <reviewed reviewer="Mark Wieringa" date="1996/04/15" tests="tRecord">
49// </reviewed>
50
51// # <prerequisite>
52// # </prerequisite>
53
54// <etymology>
55// ``Record'' is a widely used term in both programming languages and data
56// structures to denote an imhogeneous set of fields. An alternative would
57// have been to name it <em>struct</em>ure, which would have perhaps been
58// a clearer name for C++ programmers.
59// <br>
60// RecordInterface denotes that this class defines the common interface to
61// possible Record classes.
62// </etymology>
63
64// <synopsis>
65// A Record is an heterogeneous, hierarchical, collection of named fields. The
66// fields may be of scalar type, array type, a Table or a Record. This latter
67// feature is what makes the Record a (potentially) hierarchical type.
68// <p>
69// RecordInterface is the abstract base class for various Record classes.
70// At the moment three Record classes exist:
71// <ul>
72// <li> <linkto class=Record>Record</linkto>
73// <li> <linkto class=TableRecord>TableRecord</linkto>
74// </ul>
75// Presently, the scalar types are chosen to be compatible with the native
76// types of the Table system, viz: Bool, uChar, Short, Int, uInt, Int64,
77// Float, Double, Complex, DComplex, String.
78// Arrays of all these types are also available.
79// It is fairly straightforward to extend this set if necessary, although it
80// will result in more template instantiations with the current implementation.
81// <p>
82// Each field has an integral index, which ranges between 0 and
83// <src>nfields() - 1</src>. The values of a field can be manipulated
84// in two ways:
85// <ol>
86// <li> Through the get and put functions in this class.
87// They are easy to use and support type promotion.
88// However, they are a bit less efficient than the second way.
89// <li> Through the class
90// <linkto class="RecordFieldPtr">RecordFieldPtr</linkto>.
91// This is a bit less convenient. However, it is more efficient if
92// the same field is accessed multiple times.
93// </ol>
94// The structure of a record can be fixed or variable.
95// If fixed, it is not possible to change the structure once the
96// record has been instantiated. If variable, the record can be
97// restructured or fields can be added/removed.
98// <br>
99// When a field gets added, it is possible to check if its name and
100// type are valid by means of the CheckFunction callback. This is
101// for instance used by the table system to assure that keywords
102// and columns in a table do not have the same name.
103// <p>
104// Arrays in a record description can be fixed or variable shaped.
105// If fixed shaped, only arrays with that shape can be stored
106// in that field in the record. If variable shaped, any array
107// can be stored.
108// <br> However, note there is a difference between assign and define.
109// Assign invokes the array assignment operator which checks for
110// conformance. Thus even for variable shaped arrays, the new array
111// must conform the exisitng one when using assign. Define simply replaces
112// the array, thus for variable shaped arrays ay array shape will do.
113// <p>
114// RecordFieldPtr objects attached to a Record have to be notified when
115// the Record is deleted or changed.
116// The RecordInterface class provides the hooks for this via the
117// Notice system. It is derived from
118// <linkto class=NoticeSource> NoticeSource</linkto>. The class
119// <linkto class=RecordNotice>RecordNotice</linkto> is for the messages.
120// </synopsis>
121
122// <motivation>
123// This common base class provides a common interface to the various
124// Record classes.
125// Furthermore it is needed for the class RecordFieldPtr.
126// Finally it provides the hooks for the notification in case the
127// record structure changes.
128// </motivation>
129//
130// <todo asof="1996/03/10">
131// <li> A record reference class, which contains some fields from another
132// record, would likely be useful. This would be analagous to a
133// subarray sliced from an existing array.
134// </todo>
135
136class RecordInterface {
137 public:
138 // Define the flag telling if a Record has a fixed or
139 // variable structure.
141 // Record has a fixed structure; that is, no fields can
142 // be added or removed once the Record is created.
144 // Record has a variable structure; after Record creation
145 // fields can be added or removed at will.
147 };
148
149 // Define the Duplicates flag for the function merge in the various
150 // record classes.
151 // This function merges the fields from that record (description)
152 // into this one.
153 // DuplicatesFlag determines what to do if a field already exists.
155 // Rename a name from the other set to name_n,
156 // where n is the first positive number making the name unique.
158 // Skip duplicate names from the other set.
160 // Overwrite the value of a duplicate keyword
161 // This will also happen if their types differ.
163 // Throw an exception.
165 };
166
167 // Define the signature of the add callback function.
168 // This function is called when a field is added to the record
169 // (thus also when a Record is constructed from a RecordDesc).
170 // The function can check if the name and/or data type are valid.
171 // The extra argument is the argument given to the Record constructor
172 // which can be used to pass non-Record information.
173 // The function should return False if name or data type is invalid.
174 // In that case it can fill the message string, which will be added
175 // to the message in the thrown exception.
176 typedef Bool CheckFieldFunction(const String& fieldName, DataType dataType,
177 const void* extraArgument, String& message);
178
179 // The default constructor creates an empty record with a variable
180 // structure.
182
183 // Create a record with no fields.
184 // The callback function is called when a field is added to the Record.
185 // That function can check the name and of data type of the new field
186 // (for instance, the Table system uses it to ensure that table columns
187 // and keywords have different names).
188 RecordInterface(RecordType type, CheckFieldFunction* funcPtr, const void* checkArgument);
189
190 // Copy constructor (copy semantics).
192
193 // Assignment (copy semantics).
194 // This only assigns the RecordInterface object itself,
195 // thus not the data in a derived class.
196 // To do that the function <src>assign</src> below can be used.
198
199 // Destruct the record.
200 // All attached RecordFieldPtr objects are notified to detach themselves.
202
203 // Make a copy of this object.
204 virtual RecordInterface* clone() const = 0;
205
206 // Assign that RecordInterface object to this one.
207 // Unlike <src>operator=</src> it copies all data in the derived
208 // class.
209 virtual void assign(const RecordInterface& that) = 0;
210
211 // Is the Record structure fixed (i.e. impossible to restructure or
212 // to add or remove fields)?
213 Bool isFixed() const;
214
215 // How many fields does this structure have?
216 // <group>
217 virtual uInt nfields() const = 0;
218 uInt size() const { return nfields(); }
219 // </group>
220
221 // Is the record empty?
222 bool empty() const { return size() == 0; }
223
224 // Get the field number from the field name.
225 // -1 is returned if the field name is unknown.
226 virtual Int fieldNumber(const String& fieldName) const = 0;
227
228 // Get the field number for the given field id.
229 // It throws an exception if id is unrecognized (e.g. an unknown name).
231
232 // Test if a field name exists.
233 // # Is here for backward compatibility with KeywordSet.
234 Bool isDefined(const String& fieldName) const;
235
236 // Get the data type of this field (as defined in DataType.h).
237 // <group>
238 virtual DataType type(Int whichField) const = 0;
239 DataType dataType(const RecordFieldId&) const;
240 // </group>
241
242 // Get the name of this field.
243 String name(const RecordFieldId&) const;
244
245 // Get the comment for this field.
246 virtual const String& comment(const RecordFieldId&) const = 0;
247
248 // Set the comment for this field.
249 virtual void setComment(const RecordFieldId&, const String& comment) = 0;
250
251 // Get the actual shape of this field.
252 // It returns [1] for non-array fields.
254
255 // Get the description of this record.
256 RecordDesc description() const;
257
258 // Change the structure of this Record to contain the fields in
259 // newDescription. After calling restructure, <src>description() ==
260 // newDescription</src>. Any existing RecordFieldPtr objects are
261 // invalidated (their <src>isAttached()</src> members return False) after
262 // this call.
263 // <br>If the new description contains subrecords, those subrecords
264 // will be restructured if <src>recursive=True</src> is given.
265 // Otherwise the subrecord is a variable empty record.
266 // Subrecords will be variable if their description is empty (i.e. does
267 // not contain any field), otherwise they are fixed.
268 // <br>Restructuring is not possible and an exception is thrown
269 // if the Record has a fixed structure.
270 virtual void restructure(const RecordDesc& newDescription, Bool recursive = True) = 0;
271
272 // Remove a field from the record.
273 // <note role=caution>
274 // Removing a field means that the field number of the fields following
275 // it will be decremented. It will invalidate RecordFieldPtr's
276 // pointing to the removed field, but no other RecordFieldPtr's.
277 // </note>
278 virtual void removeField(const RecordFieldId&) = 0;
279
280 // Get or define the value as a ValueHolder.
281 // This is useful to pass around a value of any supported type.
282 // <group>
283 virtual ValueHolder asValueHolder(const RecordFieldId&) const;
284 virtual void defineFromValueHolder(const RecordFieldId&, const ValueHolder&);
285 // </group>
286
287 // Define a value for the given field.
288 // Array conformance rules will not be applied for variable shaped arrays.
289 // If the field and value data type mismatch, type promotion
290 // of scalars will be done if possible. If not possible, an exception
291 // is thrown.
292 // <br>
293 // If the field does not exist, it will be added to the record.
294 // This results in an exception for fixed structured records.
295 // The field is checked by a possible field checking function
296 // before it gets added.
297 // <group>
306 void define(const RecordFieldId&, const Complex& value);
307 void define(const RecordFieldId&, const DComplex& value);
308 void define(const RecordFieldId&, const Char* value);
309 void define(const RecordFieldId&, const String& value);
310 void define(const RecordFieldId&, const Array<Bool>& value, Bool FixedShape = False);
311 void define(const RecordFieldId&, const Array<uChar>& value, Bool FixedShape = False);
312 void define(const RecordFieldId&, const Array<Short>& value, Bool FixedShape = False);
313 void define(const RecordFieldId&, const Array<Int>& value, Bool FixedShape = False);
314 void define(const RecordFieldId&, const Array<uInt>& value, Bool FixedShape = False);
315 void define(const RecordFieldId&, const Array<Int64>& value, Bool FixedShape = False);
316 void define(const RecordFieldId&, const Array<Float>& value, Bool FixedShape = False);
317 void define(const RecordFieldId&, const Array<Double>& value, Bool FixedShape = False);
318 void define(const RecordFieldId&, const Array<Complex>& value, Bool FixedShape = False);
319 void define(const RecordFieldId&, const Array<DComplex>& value, Bool FixedShape = False);
320 void define(const RecordFieldId&, const Array<String>& value, Bool FixedShape = False);
321 virtual void defineRecord(const RecordFieldId&, const RecordInterface& value,
322 RecordType = Variable) = 0;
323 // </group>
324
325 // Get the value of the given field.
326 // If the field and value data type mismatch, type promotion
327 // will be done if possible. If not possible, an exception
328 // is thrown.
329 // If the value argument is an array, it will be reshaped if needed.
330 // <group>
331 void get(const RecordFieldId&, Bool& value) const;
332 void get(const RecordFieldId&, uChar& value) const;
333 void get(const RecordFieldId&, Short& value) const;
334 void get(const RecordFieldId&, Int& value) const;
335 void get(const RecordFieldId&, uInt& value) const;
336 void get(const RecordFieldId&, Int64& value) const;
337 void get(const RecordFieldId&, Float& value) const;
338 void get(const RecordFieldId&, Double& value) const;
339 void get(const RecordFieldId&, Complex& value) const;
340 void get(const RecordFieldId&, DComplex& value) const;
341 void get(const RecordFieldId&, String& value) const;
342 void get(const RecordFieldId&, Array<Bool>& value) const;
343 void get(const RecordFieldId&, Array<uChar>& value) const;
344 void get(const RecordFieldId&, Array<Short>& value) const;
345 void get(const RecordFieldId&, Array<Int>& value) const;
346 void get(const RecordFieldId&, Array<uInt>& value) const;
347 void get(const RecordFieldId&, Array<Int64>& value) const;
348 void get(const RecordFieldId&, Array<Float>& value) const;
349 void get(const RecordFieldId&, Array<Double>& value) const;
350 void get(const RecordFieldId&, Array<Complex>& value) const;
352 void get(const RecordFieldId&, Array<String>& value) const;
353 // </group>
354
355 // The following functions get the value based on field name or number.
356 // The scalar functions promote the data type if needed. It also supports
357 // conversion of Int to Bool.
358 // <br>The array functions throw an exception if the data type mismatches.
359 // The toArrayX function can be used for array type promotion.
360 // <group>
361 Bool asBool(const RecordFieldId&) const;
364 Int asInt(const RecordFieldId&) const;
365 uInt asuInt(const RecordFieldId&) const;
369 Complex asComplex(const RecordFieldId&) const;
370 DComplex asDComplex(const RecordFieldId&) const;
371 const String& asString(const RecordFieldId&) const;
375 const Array<Int>& asArrayInt(const RecordFieldId&) const;
383 virtual const RecordInterface& asRecord(const RecordFieldId&) const = 0;
384 virtual RecordInterface& asrwRecord(const RecordFieldId&) = 0;
385 // </group>
386
387 // Get an array while promoting the data as needed.
388 // Int values can be converted to Bool.
389 // A scalar value is also converted to an array.
390 // These functions are slower than <src>asX</src>, but more general.
391 // <group>
403 void toArray(const RecordFieldId& id, Array<Bool>& array) const {
404 array.reference(toArrayBool(id));
405 }
406 void toArray(const RecordFieldId& id, Array<uChar>& array) const {
407 array.reference(toArrayuChar(id));
408 }
409 void toArray(const RecordFieldId& id, Array<Short>& array) const {
410 array.reference(toArrayShort(id));
411 }
412 void toArray(const RecordFieldId& id, Array<Int>& array) const {
413 array.reference(toArrayInt(id));
414 }
415 void toArray(const RecordFieldId& id, Array<uInt>& array) const {
416 array.reference(toArrayuInt(id));
417 }
418 void toArray(const RecordFieldId& id, Array<Int64>& array) const {
419 array.reference(toArrayInt64(id));
420 }
421 void toArray(const RecordFieldId& id, Array<Float>& array) const {
422 array.reference(toArrayFloat(id));
423 }
424 void toArray(const RecordFieldId& id, Array<Double>& array) const {
425 array.reference(toArrayDouble(id));
426 }
427 void toArray(const RecordFieldId& id, Array<Complex>& array) const {
428 array.reference(toArrayComplex(id));
429 }
430 void toArray(const RecordFieldId& id, Array<DComplex>& array) const {
431 array.reference(toArrayDComplex(id));
432 }
433 void toArray(const RecordFieldId& id, Array<String>& array) const {
434 array.reference(toArrayString(id));
435 }
436 // </group>
437
438 // Get value based on field name or number.
439 // They are here for backward compatibility with the old KeywordSet
440 // classes and will be removed in the future.
441 // <group>
444 const Array<Float>& asArrayfloat(const RecordFieldId&) const;
445 const Array<Double>& asArraydouble(const RecordFieldId&) const;
446 // </group>
447
448 // Make a unique record representation
449 // (for copy-on-write in RecordFieldPtr).
450 virtual void makeUnique() = 0;
451
452 // Define a data field (for RecordFieldPtr).
453 // # This function has to be public for the global defineRecordFieldPtr
454 // # functions in RecordField.h.
455 virtual void defineDataField(Int whichField, DataType type, const void* value) = 0;
456
457 // Used by the RecordFieldPtr classes to attach to the correct field.
458 // # This function has to be public for the global attachRecordFieldPtr
459 // # functions in RecordField.h.
460 // The latter function is used to attach to a Record-type field
461 // checking if the correct Record type is used.
462 // <group>
463 virtual void* get_pointer(Int whichField, DataType type) const = 0;
464 virtual void* get_pointer(Int whichField, DataType type, const String& recordType) const = 0;
465 // </group>
466
467 // Print the contents of the record.
468 // Only the first <src>maxNrValues</src> of an array will be printed.
469 // A value < 0 means the entire array.
470 // <group>
471 friend inline std::ostream& operator<<(std::ostream& os, const RecordInterface& rec) {
472 rec.print(os, 25, " ");
473 return os;
474 }
475 virtual void print(std::ostream&, Int maxNrValues = 25, const String& indent = "") const = 0;
476 // </group>
477
478 protected:
479 // Let the derived class add an array field with the given type, shape,
480 // and value.
481 virtual void addDataField(const String& name, DataType type, const IPosition& shape,
482 Bool fixedShape, const void* value) = 0;
483
484 // Check if the Record has a non-fixed structure.
485 // If it is fixed, it throws an exception.
486 // This can be used by other functions (like define).
487 void throwIfFixed() const;
488
489 // Check if the new field name is correct.
490 // This is done by calling the checkFunction (if defined).
491 // If incorrect, an exception is thrown.
492 void checkName(const String& fieldName, DataType type) const;
493
494 // Give access to the RecordType flag (write-access is needed when
495 // a record is read back).
496 // <group>
498 RecordType recordType() const;
499 // </group>
500
501 // Get the field number for the given field id.
502 // It returns -1 if an unknown name was given.
504
505 // Add a scalar field with the given type and value.
506 // An exception is thrown if the record structure is fixed
507 // or if the name is invalid.
508 void defineField(const RecordFieldId&, DataType type, const void* value);
509
510 // Add an array field with the given type, shape and value.
511 // An exception is thrown if the record structure is fixed
512 // or if the name is invalid.
513 void defineField(const RecordFieldId&, DataType type, const IPosition& shape, Bool fixedShape,
514 const void* value);
515
516 private:
517 // Get the description of this record.
518 virtual RecordDesc getDescription() const = 0;
519
520 // Holds the callback function plus argument.
522 const void* checkArgument_p;
523
524 // Defines if the Record has a fixed structure.
526};
527
528inline Bool RecordInterface::isFixed() const { return (type_p == Fixed); }
529inline Bool RecordInterface::isDefined(const String& fieldName) const {
530 return (fieldNumber(fieldName) >= 0);
531}
532inline RecordInterface::RecordType& RecordInterface::recordType() { return type_p; }
533inline RecordInterface::RecordType RecordInterface::recordType() const { return type_p; }
534inline DataType RecordInterface::dataType(const RecordFieldId& id) const {
535 return type(idToNumber(id));
536}
537inline void RecordInterface::define(const RecordFieldId& id, const Char* value) {
538 define(id, String(value));
539}
540inline Float RecordInterface::asfloat(const RecordFieldId& id) const { return asFloat(id); }
541inline Double RecordInterface::asdouble(const RecordFieldId& id) const { return asDouble(id); }
542inline const Array<Float>& RecordInterface::asArrayfloat(const RecordFieldId& id) const {
543 return asArrayFloat(id);
544}
545inline const Array<Double>& RecordInterface::asArraydouble(const RecordFieldId& id) const {
546 return asArrayDouble(id);
547}
548
549} // namespace casacore
550
551#endif
String: the storage and methods of handling collections of characters.
Definition String.h:355
@ Fixed
Record has a fixed structure; that is, no fields can be added or removed once the Record is created.
@ Variable
Record has a variable structure; after Record creation fields can be added or removed at will.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
void assign(const RecordInterface &that) override
Assign that RecordInterface object to this one.
unsigned char uChar
Definition aipstype.h:45
DataType type(Int whichField) const override
Get the data type of this field.
const Array< Float > & asArrayFloat(const RecordFieldId &) const
RecordInterface & asrwRecord(const RecordFieldId &) override
const Array< Short > & asArrayShort(const RecordFieldId &) const
Bool isDefined(const String &fieldName) const
Test if a field name exists.
Complex asComplex(const RecordFieldId &) const
const Bool False
Definition aipstype.h:42
Array< Short > toArrayShort(const RecordFieldId &) const
void defineDataField(Int whichField, DataType type, const void *value) override
Define a value in the given field.
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
Float asFloat(const RecordFieldId &) const
Array< String > toArrayString(const RecordFieldId &) const
void defineRecord(const RecordFieldId &, const Record &value, RecordType type=Variable)
Define a value for the given field containing a subrecord.
const RecordDesc & description() const
Describes the current structure of this Record.
Array< Int64 > toArrayInt64(const RecordFieldId &) const
Int newIdToNumber(const RecordFieldId &) const
Get the field number for the given field id.
void print(std::ostream &, Int maxNrValues=25, const String &indent="") const override
Print the contents of the record.
void defineFromValueHolder(const RecordFieldId &, const ValueHolder &) override
RecordType type_p
Defines if the Record has a fixed structure.
CheckFieldFunction * checkFunction_p
Holds the callback function plus argument.
const Array< uInt > & asArrayuInt(const RecordFieldId &) const
void removeField(const RecordFieldId &) override
Remove a field from the record.
void checkName(const String &fieldName, DataType type) const
Check if the new field name is correct.
void * get_pointer(Int whichField, DataType type) const override
Used by the RecordField classes to attach in a type-safe way to the correct field.
short Short
Definition aipstype.h:46
uInt nfields() const override
How many fields does this structure have?
T * array
The actual storage.
Definition Block.h:689
unsigned int uInt
Definition aipstype.h:49
const Array< DComplex > & asArrayDComplex(const RecordFieldId &) const
void addDataField(const String &name, DataType type, const IPosition &shape, Bool fixedShape, const void *value) override
Add a field to the record.
Array< Bool > toArrayBool(const RecordFieldId &) const
Get an array while promoting the data as needed.
Array< DComplex > toArrayDComplex(const RecordFieldId &) const
Int64 asInt64(const RecordFieldId &) const
Float asfloat(const RecordFieldId &) const
Get value based on field name or number.
ValueHolder asValueHolder(const RecordFieldId &) const override
Get or define the value as a ValueHolder.
Bool CheckFieldFunction(const String &fieldName, DataType dataType, const void *extraArgument, String &message)
Define the signature of the add callback function.
void setComment(const RecordFieldId &, const String &comment) override
Set the comment for this field.
DuplicatesFlag
Define the Duplicates flag for the function merge in the various record classes.
@ SkipDuplicates
Skip duplicate names from the other set.
@ OverwriteDuplicates
Overwrite the value of a duplicate keyword This will also happen if their types differ.
@ ThrowOnDuplicates
Throw an exception.
@ RenameDuplicates
Rename a name from the other set to name_n, where n is the first positive number making the name uniq...
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size).
Definition aipsxtype.h:36
const Array< Double > & asArraydouble(const RecordFieldId &) const
Array< Double > toArrayDouble(const RecordFieldId &) const
Bool asBool(const RecordFieldId &) const
The following functions get the value based on field name or number.
Int fieldNumber() const
Return the fieldnumber of this field.
Bool empty() const
Is the block empty (i.e.
Definition Block.h:574
uChar asuChar(const RecordFieldId &) const
virtual ~RecordInterface()
Destruct the record.
const Array< Complex > & asArrayComplex(const RecordFieldId &) const
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
const Array< Float > & asArrayfloat(const RecordFieldId &) const
float Float
Definition aipstype.h:52
String name() const
Return the name of the field.
const String & comment(const RecordFieldId &) const override
Get the comment for this field.
RecordType & recordType()
Give access to the RecordType flag (write-access is needed when a record is read back).
const Array< Int64 > & asArrayInt64(const RecordFieldId &) const
Array< uInt > toArrayuInt(const RecordFieldId &) const
Bool isFixed() const
Is the Record structure fixed (i.e.
const Array< String > & asArrayString(const RecordFieldId &) const
Array< Float > toArrayFloat(const RecordFieldId &) const
Short asShort(const RecordFieldId &) const
const RecordInterface & asRecord(const RecordFieldId &) const override
uInt asuInt(const RecordFieldId &) const
const void * checkArgument_p
Array< uChar > toArrayuChar(const RecordFieldId &) const
void throwIfFixed() const
Check if the Record has a non-fixed structure.
void define(const T &value)
Store a value in the field using redefinition.
RecordInterface()
The default constructor creates an empty record with a variable structure.
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
const Array< uChar > & asArrayuChar(const RecordFieldId &) const
RecordDesc getDescription() const override
Get the description of this record.
size_t size() const
Definition Block.h:566
const Array< Double > & asArrayDouble(const RecordFieldId &) const
const String & asString(const RecordFieldId &) const
const Array< Bool > & asArrayBool(const RecordFieldId &) const
Array< Int > toArrayInt(const RecordFieldId &) const
const Bool True
Definition aipstype.h:41
DComplex asDComplex(const RecordFieldId &) const
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:360
void toArray(const RecordFieldId &id, Array< Bool > &array) const
double Double
Definition aipstype.h:53
const Array< Int > & asArrayInt(const RecordFieldId &) const
const T & get() const
Double asDouble(const RecordFieldId &) const
void makeUnique() override
Make a unique record representation (to do copy-on-write in RecordFieldPtr).
const String & comment() const
Get the comment of this field.
char Char
Definition aipstype.h:44
RecordInterface * clone() const override
Make a copy of this object.
Definition Polynomial.h:125
DataType dataType(const RecordFieldId &) const
Block< T > & operator=(const T &val)
Set all values in the block to "val".
Definition Block.h:536
Array< Complex > toArrayComplex(const RecordFieldId &) const
void restructure(const RecordDesc &newDescription, Bool recursive=True) override
Change the structure of this Record to contain the fields in newDescription.
Double asdouble(const RecordFieldId &) const
Int idToNumber(const RecordFieldId &) const
Get the field number for the given field id.
void defineField(const RecordFieldId &, DataType type, const void *value)
Add a scalar field with the given type and value.
Int asInt(const RecordFieldId &) const