30 #ifndef TABLES_TABLERECORD_H
31 #define TABLES_TABLERECORD_H
34 #include <casacore/casa/aips.h>
35 #include <casacore/casa/Containers/RecordInterface.h>
36 #include <casacore/tables/Tables/TableRecordRep.h>
37 #include <casacore/casa/Containers/RecordDesc.h>
38 #include <casacore/casa/Utilities/COWPtr.h>
39 #include <casacore/casa/Arrays/ArrayFwd.h>
202 const void* checkArgument = 0);
214 const void* checkArgument = 0);
405 const String& oldParentName);
440 Int maxNrValues = 25,
441 const String& indent=
"")
const;
556 const String& oldParentName)
RecordType & recordType()
Give access to the RecordType flag (write-access is needed when a record is read back).
String name(const RecordFieldId &) const
Get the name of this field.
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
RecordType
Define the flag telling if a Record has a fixed or variable structure.
@ Variable
Record has a variable structure; after Record creation fields can be added or removed at will.
@ Fixed
Record has a fixed structure; that is, no fields can be added or removed once the Record is created.
Bool CheckFieldFunction(const String &fieldName, DataType dataType, const void *extraArgument, String &message)
Define the signature of the add callback function.
DuplicatesFlag
Define the Duplicates flag for the function merge in the various record classes.
@ ThrowOnDuplicates
Throw an exception.
String: the storage and methods of handling collections of characters.
void closeTables() const
Close all open tables.
const RecordDesc & description() const
Describes the current structure of this Record.
void reopenRW()
Reopen possible tables in keywords as read/write.
Bool areTablesMultiUsed() const
Are subtables used in other processes.
void getData(AipsIO &os, uInt version, const TableAttr &)
Read the data of a record.
void putData(AipsIO &os, const TableAttr &) const
Put the data of a record.
void renameTables(const String &newParentName, const String &oldParentName)
Rename the subtables with a path containing the old parent table name.
Bool conform(const TableRecordRep &other) const
Returns True if this and other have the same RecordDesc, other than different names for the fields.
void flushTables(Bool fsync) const
Flush all open subtables.
TableRecord()
Create a record with no fields.
Table asTable(const RecordFieldId &) const
Get the table from the given field.
virtual void restructure(const RecordDesc &newDescription, Bool recursive=True)
Change the structure of this TableRecord to contain the fields in newDescription.
void defineRecord(const RecordFieldId &, const TableRecord &value, RecordType type=Variable)
Define a value for the given field.
void closeTables() const
Close all open tables.
virtual void * get_pointer(Int whichField, DataType type, const String &recordType) const
friend AipsIO & operator>>(AipsIO &os, TableRecord &rec)
Read the TableRecord from an input stream.
void getData(AipsIO &os, uInt version, const TableAttr &)
Read the data of a record.
Record toRecord() const
Convert the TableRecord to a Record (recursively).
virtual void assign(const RecordInterface &that)
Assign that RecordInterface object to this one.
virtual Int fieldNumber(const String &fieldName) const
Get the field number from the field name.
virtual void makeUnique()
Make a unique record representation (to do copy-on-write in RecordFieldPtr).
void putData(AipsIO &os, const TableAttr &) const
Put the data of a record.
friend AipsIO & operator<<(AipsIO &os, const TableRecord &rec)
Write the TableRecord to an output stream.
virtual void * get_pointer(Int whichField, DataType type) const
Used by the RecordField classes to attach in a type-safe way to the correct field.
Bool areTablesMultiUsed() const
Are subtables used in other processes.
virtual const RecordInterface & asRecord(const RecordFieldId &) const
virtual RecordInterface & asrwRecord(const RecordFieldId &)
void removeField(const RecordFieldId &)
Remove a field from the record.
void mergeField(const TableRecord &other, const RecordFieldId &, DuplicatesFlag=ThrowOnDuplicates)
Merge a field from another record into this record.
virtual void print(std::ostream &, Int maxNrValues=25, const String &indent="") const
Print the contents of the record.
Table asTable(const RecordFieldId &, const TableLock &lockOptions) const
void setRecordType(RecordType type)
Set the recordtype of this record and all its subrecords (recursively).
void closeTable(const RecordFieldId &) const
Close the table in the given field.
void defineTable(const RecordFieldId &, const Table &value, RecordType type=Variable)
virtual void addDataField(const String &name, DataType type, const IPosition &shape, Bool fixedShape, const void *value)
Add a field to the record.
Bool conform(const TableRecord &other) const
Returns True if this and other have the same RecordDesc, other than different names for the fields.
TableRecord(RecordType type, CheckFieldFunction *=0, const void *checkArgument=0)
Create a record with no fields.
virtual void defineRecord(const RecordFieldId &, const RecordInterface &value, RecordType=Variable)
virtual DataType type(Int whichField) const
Get the data type of this field.
~TableRecord()
Release resources associated with this object.
void setTableAttr(const TableRecord &other, const TableAttr &defaultAttr)
Recursively set the attributes of subtables to the ones in the other record for matching subtable fie...
void renameTables(const String &newParentName, const String &oldParentName)
Rename the subtables with a path containing the old parent table name.
virtual void defineDataField(Int whichField, DataType type, const void *value)
Define a value in the given field.
TableRecordRep & rwRef()
Return a non-const reference to the underlying TableRecordRep.
const TableRecordRep & ref() const
Return a const reference to the underlying TableRecordRep.
virtual uInt nfields() const
How many fields does this structure have? A convenient synonym for description().nfields().
const TableAttr & tableAttributes(const RecordFieldId &) const
Get the attributes of a table field.
TableRecord(TableRecordRep *parent, RecordType type)
TableRecordRep * parent_p
The parent TableRecord.
TableRecord & rwSubRecord(const RecordFieldId &)
virtual void setComment(const RecordFieldId &, const String &comment)
Set the comment for this field.
TableRecord(const TableRecord &other)
Create a copy of other using copy semantics.
void putRecord(AipsIO &os, const TableAttr &) const
Put the data of a record.
virtual RecordInterface * clone() const
Make a copy of this object.
const TableRecord & subRecord(const RecordFieldId &) const
Get the subrecord or table from the given field.
TableRecord(const RecordInterface &other)
Create a TableRecord from another type of record.
void getRecord(AipsIO &os, const TableAttr &)
Read a record.
TableRecord & operator=(const TableRecord &other)
Copy the data in the other record to this record.
COWPtr< TableRecordRep > rep_p
The TableRecord representation.
void merge(const TableRecord &other, DuplicatesFlag=ThrowOnDuplicates)
Merge all fields from the other record into this record.
void renameField(const String &newName, const RecordFieldId &)
Rename the given field.
void reopenRW()
Reopen possible tables in keywords as read/write.
virtual RecordDesc getDescription() const
Get the description of this record.
virtual ValueHolder asValueHolder(const RecordFieldId &) const
Get or define the value as a ValueHolder.
virtual const String & comment(const RecordFieldId &) const
Get the comment for this field.
const RecordDesc & description() const
Describes the current structure of this TableRecord.
void flushTables(Bool fsync=False) const
Flush all open subtables.
void fromRecord(const Record &rec)
Fill the TableRecord from the given Record.
TableRecord(TableRecordRep *parent, const RecordDesc &description)
Create TableRecord as a subrecord.
TableRecord(const RecordDesc &description, RecordType type=Fixed, CheckFieldFunction *=0, const void *checkArgument=0)
Create a record with the given description.
virtual void defineFromValueHolder(const RecordFieldId &, const ValueHolder &)
this file contains all the compiler specific defines
bool Bool
Define the standard types used by Casacore.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.