30 #ifndef CASA_RECORDINTERFACE_H
31 #define CASA_RECORDINTERFACE_H
185 const void* extraArgument,
198 const void* checkArgument);
234 {
return size() == 0; }
250 virtual DataType
type (
Int whichField)
const = 0;
471 const void*
value) = 0;
490 { rec.
print (os, 25,
" ");
return os; }
491 virtual void print (std::ostream&,
492 Int maxNrValues = 25,
493 const String& indent=
"")
const = 0;
502 const void*
value) = 0;
586 return asArrayFloat (
id);
591 return asArrayDouble (
id);
Bool asBool(const RecordFieldId &) const
The following functions get the value based on field name or number.
A Vector of integers, for indexing into Array<T> objects.
virtual void defineFromValueHolder(const RecordFieldId &, const ValueHolder &)
void toArray(const RecordFieldId &id, Array< Float > &array) const
const Array< Float > & asArrayfloat(const RecordFieldId &) const
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
RecordType
Define the flag telling if a Record has a fixed or variable structure.
virtual const RecordInterface & asRecord(const RecordFieldId &) const =0
Rename a name from the other set to name_n, where n is the first positive number making the name uniq...
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
Int idToNumber(const RecordFieldId &) const
Get the field number for the given field id.
virtual bool operator==(const Notice &that) const
Always returns False.
virtual ~RecordInterface()
Destruct the record.
virtual void makeUnique()=0
Make a unique record representation (for copy-on-write in RecordFieldPtr).
Int64 asInt64(const RecordFieldId &) const
const Array< String > & asArrayString(const RecordFieldId &) const
std::complex< Float > Complex
const Array< Double > & asArraydouble(const RecordFieldId &) const
Record has been deleted; detach all RecordFieldPtr's.
virtual RecordInterface * clone() const =0
Make a copy of this object.
Int newIdToNumber(const RecordFieldId &) const
Get the field number for the given field id.
const void * checkArgument_p
DComplex asDComplex(const RecordFieldId &) const
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
RecordRep has been copied; re-acquire the pointers in all RecordFieldPtr's.
void throwIfFixed() const
Check if the Record has a non-fixed structure.
Array< Int64 > toArrayInt64(const RecordFieldId &) const
const Array< Complex > & asArrayComplex(const RecordFieldId &) const
const Array< Bool > & asArrayBool(const RecordFieldId &) const
uChar asuChar(const RecordFieldId &) const
void defineField(const RecordFieldId &, DataType type, const void *value)
Add a scalar field with the given type and value.
virtual RecordDesc getDescription() const =0
Get the description of this record.
virtual void removeField(const RecordFieldId &)=0
Remove a field from the record.
bool empty() const
Is the record empty?
const Array< Int64 > & asArrayInt64(const RecordFieldId &) const
const Array< Int > & asArrayInt(const RecordFieldId &) const
Double asdouble(const RecordFieldId &) const
const Array< Double > & asArrayDouble(const RecordFieldId &) const
DataType dataType(const RecordFieldId &) const
base class for notice originators
Array< uChar > toArrayuChar(const RecordFieldId &) const
Array< Short > toArrayShort(const RecordFieldId &) const
Helper class to notify class Record about changes.
Array< Bool > toArrayBool(const RecordFieldId &) const
Get an array while promoting the data as needed.
Float asFloat(const RecordFieldId &) const
Record has a fixed structure; that is, no fields can be added or removed once the Record is created...
The identification of a record field.
Short asShort(const RecordFieldId &) const
virtual void setComment(const RecordFieldId &, const String &comment)=0
Set the comment for this field.
CheckFieldFunction * checkFunction_p
Holds the callback function plus argument.
Description of the fields in a record object.
uInt asuInt(const RecordFieldId &) const
std::complex< Double > DComplex
virtual void defineDataField(Int whichField, DataType type, const void *value)=0
Define a data field (for RecordFieldPtr).
void toArray(const RecordFieldId &id, Array< Int > &array) const
A holder for a value of any basic Casacore data type.
Record has a variable structure; after Record creation fields can be added or removed at will...
const Array< uInt > & asArrayuInt(const RecordFieldId &) const
DuplicatesFlag
Define the Duplicates flag for the function merge in the various record classes.
void toArray(const RecordFieldId &id, Array< Bool > &array) const
Double asDouble(const RecordFieldId &) const
virtual RecordInterface & asrwRecord(const RecordFieldId &)=0
bool Bool
Define the standard types used by Casacore.
abstract base class for notices
virtual void addDataField(const String &name, DataType type, const IPosition &shape, Bool fixedShape, const void *value)=0
Let the derived class add an array field with the given type, shape, and value.
NoticeType
Define the possible change types.
Float asfloat(const RecordFieldId &) const
Get value based on field name or number.
Bool isDefined(const String &fieldName) const
Test if a field name exists.
Array< Double > toArrayDouble(const RecordFieldId &) const
const Array< Short > & asArrayShort(const RecordFieldId &) const
virtual uInt nfields() const =0
How many fields does this structure have?
virtual DataType type(Int whichField) const =0
Get the data type of this field (as defined in DataType.h).
void checkName(const String &fieldName, DataType type) const
Check if the new field name is correct.
virtual void print(std::ostream &, Int maxNrValues=25, const String &indent="") const =0
RecordDesc description() const
Get the description of this record.
Int fieldNumber() const
Return the field number.
void toArray(const RecordFieldId &id, Array< DComplex > &array) const
void toArray(const RecordFieldId &id, Array< uInt > &array) const
virtual ValueHolder asValueHolder(const RecordFieldId &) const
Get or define the value as a ValueHolder.
Array< Complex > toArrayComplex(const RecordFieldId &) const
virtual void reference(const Array< T, Alloc > &other)
After invocation, this array and other reference the same storage.
Int asInt(const RecordFieldId &) const
NoticeType changeType() const
Return the change type.
Overwrite the value of a duplicate keyword This will also happen if their types differ.
RecordInterface()
The default constructor creates an empty record with a variable structure.
void toArray(const RecordFieldId &id, Array< Complex > &array) const
A field has been removed; detach that RecordFieldPtr and decrement field numbers in RecordFieldPtr's ...
void toArray(const RecordFieldId &id, Array< uChar > &array) const
const Array< DComplex > & asArrayDComplex(const RecordFieldId &) const
RecordNotice(NoticeType changeType, uInt fieldNumber)
Construct a notice for the given type and field number.
const String & asString(const RecordFieldId &) const
RecordType & recordType()
Give access to the RecordType flag (write-access is needed when a record is read back).
virtual const String & comment(const RecordFieldId &) const =0
Get the comment for this field.
Complex asComplex(const RecordFieldId &) const
Array< String > toArrayString(const RecordFieldId &) const
virtual void restructure(const RecordDesc &newDescription, Bool recursive=True)=0
Change the structure of this Record to contain the fields in newDescription.
RecordInterface & operator=(const RecordInterface &other)
Assignment (copy semantics).
String: the storage and methods of handling collections of characters.
virtual void * get_pointer(Int whichField, DataType type) const =0
Used by the RecordFieldPtr classes to attach to the correct field.
RecordType type_p
Defines if the Record has a fixed structure.
void toArray(const RecordFieldId &id, Array< Double > &array) const
Abstract base class for Record classes.
Array< Float > toArrayFloat(const RecordFieldId &) const
Bool CheckFieldFunction(const String &fieldName, DataType dataType, const void *extraArgument, String &message)
Define the signature of the add callback function.
Array< uInt > toArrayuInt(const RecordFieldId &) const
const Array< uChar > & asArrayuChar(const RecordFieldId &) const
const Array< Float > & asArrayFloat(const RecordFieldId &) const
void toArray(const RecordFieldId &id, Array< String > &array) const
void define(const RecordFieldId &, Bool value)
Define a value for the given field.
virtual void assign(const RecordInterface &that)=0
Assign that RecordInterface object to this one.
virtual Int fieldNumber(const String &fieldName) const =0
Get the field number from the field name.
void toArray(const RecordFieldId &id, Array< Short > &array) const
friend std::ostream & operator<<(std::ostream &os, const RecordInterface &rec)
Print the contents of the record.
Array< Int > toArrayInt(const RecordFieldId &) const
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
String name(const RecordFieldId &) const
Get the name of this field.
Bool isFixed() const
Is the Record structure fixed (i.e.
Skip duplicate names from the other set.
void toArray(const RecordFieldId &id, Array< Int64 > &array) const
Array< DComplex > toArrayDComplex(const RecordFieldId &) const
virtual void defineRecord(const RecordFieldId &, const RecordInterface &value, RecordType=Variable)=0