30 #ifndef CASA_RECORDINTERFACE_H 31 #define CASA_RECORDINTERFACE_H 35 #include <casacore/casa/aips.h> 36 #include <casacore/casa/BasicSL/String.h> 37 #include <casacore/casa/Utilities/Notice.h> 38 #include <casacore/casa/Utilities/DataType.h> 39 #include <casacore/casa/Containers/RecordFieldId.h> 40 #include <casacore/casa/Arrays/Array.h> 185 const void* extraArgument,
198 const void* checkArgument);
234 {
return size() == 0; }
250 virtual DataType
type (
Int whichField)
const = 0;
444 { array.
reference (toArrayDouble (
id)); }
446 { array.
reference (toArrayComplex (
id)); }
448 { array.
reference (toArrayDComplex (
id)); }
450 { array.
reference (toArrayString (
id)); }
471 const void* value) = 0;
479 virtual void*
get_pointer (
Int whichField, DataType type)
const = 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;
659 return fieldNumber_p;
A Vector of integers, for indexing into Array<T> objects.
virtual void defineFromValueHolder(const RecordFieldId &, const ValueHolder &)
void toArray(const RecordFieldId &id, Array< Short > &array) 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...
virtual void makeUnique()=0
Make a unique record representation (for copy-on-write in RecordFieldPtr).
Float asFloat(const RecordFieldId &) const
std::complex< Float > Complex
Record has been deleted; detach all RecordFieldPtr's.
Double asdouble(const RecordFieldId &) const
Array< uChar > toArrayuChar(const RecordFieldId &) const
virtual RecordInterface * clone() const =0
Make a copy of this object.
const void * checkArgument_p
const String & asString(const RecordFieldId &) const
void toArray(const RecordFieldId &id, Array< Int64 > &array) const
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Double asDouble(const RecordFieldId &) const
const Array< uChar > & asArrayuChar(const RecordFieldId &) const
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< String > & asArrayString(const RecordFieldId &) const
Int64 asInt64(const RecordFieldId &) const
DataType dataType(const RecordFieldId &) const
const Array< Short > & asArrayShort(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 operator==(const casacore_allocator< T, ALIGNMENT > &, const casacore_allocator< T, ALIGNMENT > &)
Array< String > toArrayString(const RecordFieldId &) const
Int fieldNumber() const
Return the field number.
void checkName(const String &fieldName, DataType type) const
Check if the new field name is correct.
const Array< Int > & asArrayInt(const RecordFieldId &) const
virtual void reference(const Array< T > &other)
After invocation, this array and other reference the same storage.
Complex asComplex(const RecordFieldId &) const
base class for notice originators
Helper class to notify class Record about changes.
Array< Short > toArrayShort(const RecordFieldId &) const
Record has a fixed structure; that is, no fields can be added or removed once the Record is created...
Int newIdToNumber(const RecordFieldId &) const
Get the field number for the given field id.
void toArray(const RecordFieldId &id, Array< Bool > &array) const
virtual ValueHolder asValueHolder(const RecordFieldId &) const
Get or define the value as a ValueHolder.
void toArray(const RecordFieldId &id, Array< DComplex > &array) const
The identification of a record field.
virtual void setComment(const RecordFieldId &, const String &comment)=0
Set the comment for this field.
void toArray(const RecordFieldId &id, Array< Float > &array) const
CheckFieldFunction * checkFunction_p
Holds the callback function plus argument.
Array< uInt > toArrayuInt(const RecordFieldId &) const
Description of the fields in a record object.
Array< Bool > toArrayBool(const RecordFieldId &) const
Get an array while promoting the data as needed.
std::complex< Double > DComplex
virtual void defineDataField(Int whichField, DataType type, const void *value)=0
Define a data field (for RecordFieldPtr).
A holder for a value of any basic Casacore data type.
Bool isFixed() const
Is the Record structure fixed (i.e.
void toArray(const RecordFieldId &id, Array< String > &array) const
Record has a variable structure; after Record creation fields can be added or removed at will...
DuplicatesFlag
Define the Duplicates flag for the function merge in the various record classes.
Bool isDefined(const String &fieldName) const
Test if a field name exists.
bool empty() const
Is the record empty?
const Array< Float > & asArrayfloat(const RecordFieldId &) const
virtual RecordInterface & asrwRecord(const RecordFieldId &)=0
Array< Float > toArrayFloat(const RecordFieldId &) const
const Array< Bool > & asArrayBool(const RecordFieldId &) const
const Array< Int64 > & asArrayInt64(const RecordFieldId &) const
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.
Array< Int > toArrayInt(const RecordFieldId &) const
NoticeType
Define the possible change types.
NoticeType changeType() const
Return the change type.
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).
virtual void print(std::ostream &, Int maxNrValues=25, const String &indent="") const =0
Float asfloat(const RecordFieldId &) const
Get value based on field name or number.
void toArray(const RecordFieldId &id, Array< Complex > &array) const
void toArray(const RecordFieldId &id, Array< Double > &array) const
Array< Complex > toArrayComplex(const RecordFieldId &) const
Short asShort(const RecordFieldId &) const
Array< Double > toArrayDouble(const RecordFieldId &) const
RecordDesc description() const
Get the description of this record.
uInt asuInt(const RecordFieldId &) const
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< uChar > &array) const
void toArray(const RecordFieldId &id, Array< uInt > &array) const
Int asInt(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.
virtual void restructure(const RecordDesc &newDescription, Bool recursive=True)=0
Change the structure of this Record to contain the fields in newDescription.
const Array< Double > & asArrayDouble(const RecordFieldId &) const
RecordInterface & operator=(const RecordInterface &other)
Assignment (copy semantics).
String: the storage and methods of handling collections of characters.
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
const Array< Double > & asArraydouble(const RecordFieldId &) const
Array< DComplex > toArrayDComplex(const RecordFieldId &) const
virtual void * get_pointer(Int whichField, DataType type) const =0
Used by the RecordFieldPtr classes to attach to the correct field.
const Array< DComplex > & asArrayDComplex(const RecordFieldId &) const
RecordType type_p
Defines if the Record has a fixed structure.
Abstract base class for Record classes.
Bool CheckFieldFunction(const String &fieldName, DataType dataType, const void *extraArgument, String &message)
Define the signature of the add callback function.
const Array< uInt > & asArrayuInt(const RecordFieldId &) const
void define(const RecordFieldId &, Bool value)
Define a value for the given field.
uChar asuChar(const RecordFieldId &) const
virtual void assign(const RecordInterface &that)=0
Assign that RecordInterface object to this one.
String name(const RecordFieldId &) const
Get the name of this field.
Int idToNumber(const RecordFieldId &) const
Get the field number for the given field id.
DComplex asDComplex(const RecordFieldId &) const
virtual Int fieldNumber(const String &fieldName) const =0
Get the field number from the field name.
~RecordInterface()
Destruct the record.
friend std::ostream & operator<<(std::ostream &os, const RecordInterface &rec)
Print the contents of the record.
this file contains all the compiler specific defines
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
void toArray(const RecordFieldId &id, Array< Int > &array) const
const Array< Float > & asArrayFloat(const RecordFieldId &) const
Skip duplicate names from the other set.
Bool asBool(const RecordFieldId &) const
The following functions get the value based on field name or number.
virtual void defineRecord(const RecordFieldId &, const RecordInterface &value, RecordType=Variable)=0
const Array< Complex > & asArrayComplex(const RecordFieldId &) const