26#ifndef CASA_RECORDDESC_H
27#define CASA_RECORDDESC_H
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Containers/RecordDescRep.h>
32#include <casacore/casa/Containers/RecordInterface.h>
33#include <casacore/casa/Utilities/COWPtr.h>
34#include <casacore/casa/iosfwd.h>
168 RecordInterface::DuplicatesFlag DuplicateAction = RecordInterface::ThrowOnDuplicates);
173 RecordInterface::DuplicatesFlag DuplicateAction = RecordInterface::ThrowOnDuplicates);
191 DataType
type(
Int whichField)
const;
283 ostream&
put(ostream& os)
const;
297 if (
this != &other) {
311 return desc_p.rwRef().addArray(fieldName, scalarOrArrayType,
shape);
315 return desc_p.rwRef().addRecord(fieldName, subDesc);
323 return desc_p.ref().comment(whichField);
335 RecordInterface::DuplicatesFlag duplicateAction) {
336 return desc_p.rwRef().mergeField(other.
desc_p.ref(), whichFieldFromOther, duplicateAction);
340 RecordInterface::DuplicatesFlag duplicateAction) {
341 return desc_p.rwRef().merge(other.
desc_p.ref(), duplicateAction);
345 return desc_p.rwRef().removeField(whichField);
349 desc_p.rwRef().renameField(newName, whichField);
353 return desc_p.ref().fieldNumber(fieldName);
365 return desc_p.ref().makeName(whichField);
369 return desc_p.ref().name(whichField);
377 return desc_p.ref().isSubRecord(whichField);
383 return desc_p.ref().shape(whichField);
387 return desc_p.ref().tableDescName(whichField);
391 return desc_p.ref().subRecord(whichField);
395 return desc_p.rwRef().subRecord(whichField);
410 return desc_p.ref().isEqual(other.
desc_p.ref(), equalDataTypes);
413 return desc_p.ref().isSubset(other.
desc_p.ref(), equalDataTypes);
416 return desc_p.ref().isStrictSubset(other.
desc_p.ref(), equalDataTypes);
419 return other.
desc_p.ref().isSubset(
desc_p.ref(), equalDataTypes);
422 return other.
desc_p.ref().isStrictSubset(
desc_p.ref(), equalDataTypes);
Bool isSubRecord(Int whichField) const
Returns True if whichField is a sub-record.
RecordDesc & rwSubRecord(Int whichField)
Bool isStrictSubset(const RecordDesc &other, Bool &equalDataTypes) const
Test if this description is a strict subset of another one, thus if it is a subset and not equal.
COWPtr< RecordDescRep > desc_p
Use a copy-on-write pointer to the RecordDescRep.
Int fieldNumber(const String &fieldName) const
Returns the index of the field named fieldName.
uInt nfields() const
Number of fields in the description.
uInt merge(const RecordDesc &other, RecordInterface::DuplicatesFlag DuplicateAction=RecordInterface::ThrowOnDuplicates)
Add all the fields from another RecordDesc to the current objects.
void renameField(const String &newName, Int whichField)
Rename the given field.
uInt removeField(Int whichField)
Remove the given field from the description.
RecordDesc()
Create a description with no fields.
String makeName(Int whichField) const
Create a name for a field defined by index as *i (similar to glish).
Bool isEqual(const RecordDesc &other, Bool &equalDataTypes) const
Test if this description equals another one.
Bool isSubset(const RecordDesc &other, Bool &equalDataTypes) const
Test if this description is a subset of another one.
const String & comment(Int whichField) const
Get the comment for this field.
Bool conform(const RecordDesc &other) const
Test if this description conforms the other.
uInt mergeField(const RecordDesc &other, Int whichFieldFromOther, RecordInterface::DuplicatesFlag DuplicateAction=RecordInterface::ThrowOnDuplicates)
Merge a single field from other.
const String & name(Int whichField) const
What is the name of the given field.
const RecordDesc & subRecord(Int whichField) const
If whichField is a sub-record return its description.
Bool isDisjoint(const RecordDesc &other) const
Test if the set of field names in this and other record description is disjoint (i....
void setComment(Int whichField, const String &comment)
Set the comment for this field.
friend AipsIO & operator>>(AipsIO &os, RecordDesc &desc)
String uniqueName(const String &name) const
Make the given name unique by adding a suffix _j when needed.
Bool operator!=(const RecordDesc &other) const
friend ostream & operator<<(ostream &os, const RecordDesc &desc)
Writes/reads the RecordDesc to/from an output stream.
void setShape(Int whichField, const IPosition &shape)
Set the shape for this field.
Bool isTable(Int whichField) const
Returns True if whichField is a table.
Bool isSuperset(const RecordDesc &other, Bool &equalDataTypes) const
Test if this description is a superset of another one.
Bool operator==(const RecordDesc &other) const
This and other compare equal if the field types and shapes are identical (recursively if there are de...
DataType type(Int whichField) const
What is the type of the given field.
Bool isStrictSuperset(const RecordDesc &other, Bool &equalDataTypes) const
Test if this description is a strict superset of another one, thus if it is a superset and not equal.
Bool isArray(Int whichField) const
Returns True if whichField is an array.
RecordDesc & operator=(const RecordDesc &other)
Replace this description with other.
ostream & put(ostream &os) const
Writes/reads the RecordDesc to/from an output stream.
uInt addTable(const String &fieldName, const String &tableDescName)
Add a Table field to the description.
AipsIO & put(AipsIO &os) const
Bool isScalar(Int whichField) const
Returns True if whichField is a scalar.
const String & tableDescName(Int whichField) const
What is the name of the table description.
uInt addField(const String &fieldName, DataType dataType)
Add scalar, array, sub-record, or table field.
const IPosition & shape(Int whichField) const
What is the shape of the given field.
String: the storage and methods of handling collections of characters.
For temporary backward namespace compatibility, use casa as alias for casacore.
friend AipsIO & operator>>(AipsIO &os, Record &rec)
Read the Record from an input stream.
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
Int fieldNumber() const
Return the fieldnumber of this field.
String name() const
Return the name of the field.
bool Bool
Define the standard types used by Casacore.
const String & comment() const
Get the comment of this field.
DataType dataType(const RecordFieldId &) const