27#ifndef CASA_RECORDINTERFACE_H
28#define CASA_RECORDINTERFACE_H
32#include <casacore/casa/aips.h>
33#include <casacore/casa/BasicSL/String.h>
34#include <casacore/casa/Utilities/DataType.h>
35#include <casacore/casa/Containers/RecordFieldId.h>
36#include <casacore/casa/Arrays/Array.h>
181 const void* extraArgument,
194 const void* checkArgument);
230 {
return size() == 0; }
246 virtual DataType
type (
Int whichField)
const = 0;
467 const void*
value) = 0;
486 { rec.print (os, 25,
" ");
return os; }
487 virtual void print (std::ostream&,
488 Int maxNrValues = 25,
489 const String& indent=
"")
const = 0;
498 const void*
value) = 0;
547inline Bool RecordInterface::isFixed()
const
551inline Bool RecordInterface::isDefined (
const String& fieldName)
const
555inline RecordInterface::RecordType& RecordInterface::recordType()
559inline RecordInterface::RecordType RecordInterface::recordType()
const
563inline DataType RecordInterface::dataType (
const RecordFieldId&
id)
const
String: the storage and methods of handling collections of characters.
@ 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.
this file contains all the compiler specific defines
void assign(const RecordInterface &that) override
Assign that RecordInterface object to this one.
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
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.
uInt nfields() const override
How many fields does this structure have?
TYPE * array
the allocated array
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).
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.
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
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
bool empty() const
Is the record empty?
Array< uInt > toArrayuInt(const RecordFieldId &) const
Bool isFixed() const
Is the Record structure fixed (i.e.
const Array< String > & asArrayString(const RecordFieldId &) const
Record & operator=(const Record &other)
Copy the data in the other record to this record.
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.
bool Bool
Define the standard types used by Casacore.
const Array< uChar > & asArrayuChar(const RecordFieldId &) const
RecordDesc getDescription() const override
Get the description of this record.
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
DComplex asDComplex(const RecordFieldId &) const
NewDelAllocator< T > NewDelAllocator< T >::value
void toArray(const RecordFieldId &id, Array< Bool > &array) const
const Array< Int > & asArrayInt(const RecordFieldId &) 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.
RecordInterface * clone() const override
Make a copy of this object.
DataType dataType(const RecordFieldId &) const
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