Go to the documentation of this file.
30 #ifndef CASA_RECORDDESC_H
31 #define CASA_RECORDDESC_H
35 #include <casacore/casa/aips.h>
36 #include <casacore/casa/Containers/RecordDescRep.h>
37 #include <casacore/casa/Containers/RecordInterface.h>
38 #include <casacore/casa/Utilities/COWPtr.h>
39 #include <casacore/casa/iosfwd.h>
200 DataType
type (
Int whichField)
const;
284 Bool& equalDataTypes)
const;
294 ostream&
put (ostream& os)
const;
310 : desc_p (other.desc_p)
315 if (
this != &other) {
326 return desc_p.rwRef().addField (fieldName, dataType);
330 DataType scalarOrArrayType,
333 return desc_p.rwRef().addArray (fieldName, scalarOrArrayType,
shape);
339 return desc_p.rwRef().addRecord (fieldName, subDesc);
343 const String& tableDescName)
350 return desc_p.ref().comment (whichField);
364 Int whichFieldFromOther,
367 return desc_p.rwRef().mergeField (other.
desc_p.ref(), whichFieldFromOther,
374 return desc_p.rwRef().merge (other.
desc_p.ref(), duplicateAction);
379 return desc_p.rwRef().removeField (whichField);
384 desc_p.rwRef().renameField (newName, whichField);
389 return desc_p.ref().fieldNumber (fieldName);
394 return desc_p.ref().nfields();
399 return desc_p.ref().type (whichField);
409 return desc_p.ref().makeName (whichField);
414 return desc_p.ref().name (whichField);
419 return desc_p.ref().isArray (whichField);
424 return desc_p.ref().isScalar (whichField);
429 return desc_p.ref().isSubRecord (whichField);
434 return desc_p.ref().isTable (whichField);
439 return desc_p.ref().shape (whichField);
444 return desc_p.ref().tableDescName (whichField);
449 return desc_p.ref().subRecord (whichField);
454 return desc_p.rwRef().subRecord (whichField);
472 Bool& equalDataTypes)
const
474 return desc_p.ref().isEqual (other.
desc_p.ref(), equalDataTypes);
477 Bool& equalDataTypes)
const
479 return desc_p.ref().isSubset (other.
desc_p.ref(), equalDataTypes);
482 Bool& equalDataTypes)
const
484 return desc_p.ref().isStrictSubset (other.
desc_p.ref(), equalDataTypes);
487 Bool& equalDataTypes)
const
489 return other.
desc_p.ref().isSubset (
desc_p.ref(), equalDataTypes);
492 Bool& equalDataTypes)
const
494 return other.
desc_p.ref().isStrictSubset (
desc_p.ref(), equalDataTypes);
504 return desc.
put (os);
508 return desc.
put (os);
512 return desc.
get (os);
Description of the fields in a record object.
friend ostream & operator<<(ostream &os, const RecordDesc &desc)
Writes/reads the RecordDesc to/from an output stream.
Bool isArray(Int whichField) const
Returns True if whichField is an array.
A Vector of integers, for indexing into Array<T> objects.
Bool isSubRecord(Int whichField) const
Returns True if whichField is a sub-record.
void setComment(Int whichField, const String &comment)
Set the comment for this field.
AipsIO is the object persistency mechanism of Casacore
uInt removeField(Int whichField)
Remove the given field from the description.
Bool isSuperset(const RecordDesc &other, Bool &equalDataTypes) const
Test if this description is a superset of another one.
const RecordDesc & subRecord(Int whichField) const
If whichField is a sub-record return its description.
uInt addTable(const String &fieldName, const String &tableDescName)
Add a Table field to the description.
DuplicatesFlag
Define the Duplicates flag for the function merge in the various record classes.
COWPtr< RecordDescRep > desc_p
Use a copy-on-write pointer to the RecordDescRep.
RecordDesc & operator=(const RecordDesc &other)
Replace this description with other.
Bool operator==(const RecordDesc &other) const
This and other compare equal if the field types and shapes are identical (recursively if there are de...
ostream & put(ostream &os) const
Writes/reads the RecordDesc to/from an output stream.
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.
uInt merge(const RecordDesc &other, RecordInterface::DuplicatesFlag DuplicateAction=RecordInterface::ThrowOnDuplicates)
Add all the fields from another RecordDesc to the current objects.
Bool isScalar(Int whichField) const
Returns True if whichField is a scalar.
AipsIO & operator>>(AipsIO &os, Record &rec)
Bool isTable(Int whichField) const
Returns True if whichField is a table.
const IPosition & shape(Int whichField) const
What is the shape of the given field.
String makeName(Int whichField) const
Create a name for a field defined by index as *i (similar to glish).
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape.
const String & tableDescName(Int whichField) const
What is the name of the table description.
Bool isSubset(const RecordDesc &other, Bool &equalDataTypes) const
Test if this description is a subset of another one.
const String & name(Int whichField) const
What is the name of the given field.
Bool isDisjoint(const RecordDesc &other) const
Test if the set of field names in this and other record description is disjoint (i....
this file contains all the compiler specific defines
Copy-On-Write-Pointer class - allows control of copy based on constness.
Bool operator!=(const RecordDesc &other) const
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.
Bool isEqual(const RecordDesc &other, Bool &equalDataTypes) const
Test if this description equals another one.
RecordDesc()
Create a description with no fields.
DataType type(Int whichField) const
What is the type of the given field.
RecordDesc & rwSubRecord(Int whichField)
String: the storage and methods of handling collections of characters.
bool Bool
Define the standard types used by Casacore.
void renameField(const String &newName, Int whichField)
Rename the given field.
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
const String & comment(Int whichField) const
Get the comment for this field.
void setShape(Int whichField, const IPosition &shape)
Set the shape for this field.
Representation of a RecordDesc.
String uniqueName(const String &name) const
Make the given name unique by adding a suffix _j when needed.
uInt mergeField(const RecordDesc &other, Int whichFieldFromOther, RecordInterface::DuplicatesFlag DuplicateAction=RecordInterface::ThrowOnDuplicates)
Merge a single field from other.
uInt addField(const String &fieldName, DataType dataType)
Add scalar, array, sub-record, or table field.
@ ThrowOnDuplicates
Throw an exception.
Int fieldNumber(const String &fieldName) const
Returns the index of the field named fieldName.
friend AipsIO & operator>>(AipsIO &os, RecordDesc &desc)
Bool conform(const RecordDesc &other) const
Test if this description conforms the other.
AipsIO & put(AipsIO &os) const
uInt nfields() const
Number of fields in the description.