casacore
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
casacore::RecordInterface Class Referenceabstract

More...

#include <RecordInterface.h>

Public Types

enum  RecordType {
  Fixed ,
  Variable
}
 Define the flag telling if a Record has a fixed or variable structure. More...
 
enum  DuplicatesFlag {
  RenameDuplicates ,
  SkipDuplicates ,
  OverwriteDuplicates ,
  ThrowOnDuplicates
}
 Define the Duplicates flag for the function merge in the various record classes. More...
 
typedef Bool CheckFieldFunction(const String &fieldName, DataType dataType, const void *extraArgument, String &message)
 Define the signature of the add callback function. More...
 

Public Member Functions

 RecordInterface ()
 The default constructor creates an empty record with a variable structure. More...
 
 RecordInterface (RecordType type, CheckFieldFunction *funcPtr, const void *checkArgument)
 Create a record with no fields. More...
 
 RecordInterface (const RecordInterface &other)
 Copy constructor (copy semantics). More...
 
RecordInterfaceoperator= (const RecordInterface &other)
 Assignment (copy semantics). More...
 
virtual ~RecordInterface ()
 Destruct the record. More...
 
virtual RecordInterfaceclone () const =0
 Make a copy of this object. More...
 
virtual void assign (const RecordInterface &that)=0
 Assign that RecordInterface object to this one. More...
 
Bool isFixed () const
 Is the Record structure fixed (i.e. More...
 
virtual uInt nfields () const =0
 How many fields does this structure have? More...
 
uInt size () const
 
bool empty () const
 Is the record empty? More...
 
virtual Int fieldNumber (const String &fieldName) const =0
 Get the field number from the field name. More...
 
Int idToNumber (const RecordFieldId &) const
 Get the field number for the given field id. More...
 
Bool isDefined (const String &fieldName) const
 Test if a field name exists. More...
 
virtual DataType type (Int whichField) const =0
 Get the data type of this field (as defined in DataType.h). More...
 
DataType dataType (const RecordFieldId &) const
 
String name (const RecordFieldId &) const
 Get the name of this field. More...
 
virtual const Stringcomment (const RecordFieldId &) const =0
 Get the comment for this field. More...
 
virtual void setComment (const RecordFieldId &, const String &comment)=0
 Set the comment for this field. More...
 
IPosition shape (const RecordFieldId &) const
 Get the actual shape of this field. More...
 
RecordDesc description () const
 Get the description of this record. More...
 
virtual void restructure (const RecordDesc &newDescription, Bool recursive=True)=0
 Change the structure of this Record to contain the fields in newDescription. More...
 
virtual void removeField (const RecordFieldId &)=0
 Remove a field from the record. More...
 
virtual ValueHolder asValueHolder (const RecordFieldId &) const
 Get or define the value as a ValueHolder. More...
 
virtual void defineFromValueHolder (const RecordFieldId &, const ValueHolder &)
 
void define (const RecordFieldId &, Bool value)
 Define a value for the given field. More...
 
void define (const RecordFieldId &, uChar value)
 
void define (const RecordFieldId &, Short value)
 
void define (const RecordFieldId &, Int value)
 
void define (const RecordFieldId &, uInt value)
 
void define (const RecordFieldId &, Int64 value)
 
void define (const RecordFieldId &, Float value)
 
void define (const RecordFieldId &, Double value)
 
void define (const RecordFieldId &, const Complex &value)
 
void define (const RecordFieldId &, const DComplex &value)
 
void define (const RecordFieldId &, const Char *value)
 
void define (const RecordFieldId &, const String &value)
 
void define (const RecordFieldId &, const Array< Bool > &value, Bool FixedShape=False)
 
void define (const RecordFieldId &, const Array< uChar > &value, Bool FixedShape=False)
 
void define (const RecordFieldId &, const Array< Short > &value, Bool FixedShape=False)
 
void define (const RecordFieldId &, const Array< Int > &value, Bool FixedShape=False)
 
void define (const RecordFieldId &, const Array< uInt > &value, Bool FixedShape=False)
 
void define (const RecordFieldId &, const Array< Int64 > &value, Bool FixedShape=False)
 
void define (const RecordFieldId &, const Array< Float > &value, Bool FixedShape=False)
 
void define (const RecordFieldId &, const Array< Double > &value, Bool FixedShape=False)
 
void define (const RecordFieldId &, const Array< Complex > &value, Bool FixedShape=False)
 
void define (const RecordFieldId &, const Array< DComplex > &value, Bool FixedShape=False)
 
void define (const RecordFieldId &, const Array< String > &value, Bool FixedShape=False)
 
virtual void defineRecord (const RecordFieldId &, const RecordInterface &value, RecordType=Variable)=0
 
void get (const RecordFieldId &, Bool &value) const
 Get the value of the given field. More...
 
void get (const RecordFieldId &, uChar &value) const
 
void get (const RecordFieldId &, Short &value) const
 
void get (const RecordFieldId &, Int &value) const
 
void get (const RecordFieldId &, uInt &value) const
 
void get (const RecordFieldId &, Int64 &value) const
 
void get (const RecordFieldId &, Float &value) const
 
void get (const RecordFieldId &, Double &value) const
 
void get (const RecordFieldId &, Complex &value) const
 
void get (const RecordFieldId &, DComplex &value) const
 
void get (const RecordFieldId &, String &value) const
 
void get (const RecordFieldId &, Array< Bool > &value) const
 
void get (const RecordFieldId &, Array< uChar > &value) const
 
void get (const RecordFieldId &, Array< Short > &value) const
 
void get (const RecordFieldId &, Array< Int > &value) const
 
void get (const RecordFieldId &, Array< uInt > &value) const
 
void get (const RecordFieldId &, Array< Int64 > &value) const
 
void get (const RecordFieldId &, Array< Float > &value) const
 
void get (const RecordFieldId &, Array< Double > &value) const
 
void get (const RecordFieldId &, Array< Complex > &value) const
 
void get (const RecordFieldId &, Array< DComplex > &value) const
 
void get (const RecordFieldId &, Array< String > &value) const
 
Bool asBool (const RecordFieldId &) const
 The following functions get the value based on field name or number. More...
 
uChar asuChar (const RecordFieldId &) const
 
Short asShort (const RecordFieldId &) const
 
Int asInt (const RecordFieldId &) const
 
uInt asuInt (const RecordFieldId &) const
 
Int64 asInt64 (const RecordFieldId &) const
 
Float asFloat (const RecordFieldId &) const
 
Double asDouble (const RecordFieldId &) const
 
Complex asComplex (const RecordFieldId &) const
 
DComplex asDComplex (const RecordFieldId &) const
 
const StringasString (const RecordFieldId &) const
 
const Array< Bool > & asArrayBool (const RecordFieldId &) const
 
const Array< uChar > & asArrayuChar (const RecordFieldId &) const
 
const Array< Short > & asArrayShort (const RecordFieldId &) const
 
const Array< Int > & asArrayInt (const RecordFieldId &) const
 
const Array< uInt > & asArrayuInt (const RecordFieldId &) const
 
const Array< Int64 > & asArrayInt64 (const RecordFieldId &) const
 
const Array< Float > & asArrayFloat (const RecordFieldId &) const
 
const Array< Double > & asArrayDouble (const RecordFieldId &) const
 
const Array< Complex > & asArrayComplex (const RecordFieldId &) const
 
const Array< DComplex > & asArrayDComplex (const RecordFieldId &) const
 
const Array< String > & asArrayString (const RecordFieldId &) const
 
virtual const RecordInterfaceasRecord (const RecordFieldId &) const =0
 
virtual RecordInterfaceasrwRecord (const RecordFieldId &)=0
 
Array< BooltoArrayBool (const RecordFieldId &) const
 Get an array while promoting the data as needed. More...
 
Array< uChartoArrayuChar (const RecordFieldId &) const
 
Array< ShorttoArrayShort (const RecordFieldId &) const
 
Array< InttoArrayInt (const RecordFieldId &) const
 
Array< uInttoArrayuInt (const RecordFieldId &) const
 
Array< Int64toArrayInt64 (const RecordFieldId &) const
 
Array< FloattoArrayFloat (const RecordFieldId &) const
 
Array< DoubletoArrayDouble (const RecordFieldId &) const
 
Array< Complex > toArrayComplex (const RecordFieldId &) const
 
Array< DComplex > toArrayDComplex (const RecordFieldId &) const
 
Array< StringtoArrayString (const RecordFieldId &) const
 
void toArray (const RecordFieldId &id, Array< Bool > &array) const
 
void toArray (const RecordFieldId &id, Array< uChar > &array) const
 
void toArray (const RecordFieldId &id, Array< Short > &array) const
 
void toArray (const RecordFieldId &id, Array< Int > &array) const
 
void toArray (const RecordFieldId &id, Array< uInt > &array) const
 
void toArray (const RecordFieldId &id, Array< Int64 > &array) const
 
void toArray (const RecordFieldId &id, Array< Float > &array) const
 
void toArray (const RecordFieldId &id, Array< Double > &array) const
 
void toArray (const RecordFieldId &id, Array< Complex > &array) const
 
void toArray (const RecordFieldId &id, Array< DComplex > &array) const
 
void toArray (const RecordFieldId &id, Array< String > &array) const
 
Float asfloat (const RecordFieldId &) const
 Get value based on field name or number. More...
 
Double asdouble (const RecordFieldId &) const
 
const Array< Float > & asArrayfloat (const RecordFieldId &) const
 
const Array< Double > & asArraydouble (const RecordFieldId &) const
 
virtual void makeUnique ()=0
 Make a unique record representation (for copy-on-write in RecordFieldPtr). More...
 
virtual void defineDataField (Int whichField, DataType type, const void *value)=0
 Define a data field (for RecordFieldPtr). More...
 
virtual void * get_pointer (Int whichField, DataType type) const =0
 Used by the RecordFieldPtr classes to attach to the correct field. More...
 
virtual void * get_pointer (Int whichField, DataType type, const String &recordType) const =0
 
virtual void print (std::ostream &, Int maxNrValues=25, const String &indent="") const =0
 
- Public Member Functions inherited from casacore::NoticeSource
 NoticeSource ()
 
virtual ~NoticeSource ()
 
void notify (const Notice &note)
 Sends the note to all NoticeTargets in the target list. More...
 

Protected Member Functions

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. More...
 
void throwIfFixed () const
 Check if the Record has a non-fixed structure. More...
 
void checkName (const String &fieldName, DataType type) const
 Check if the new field name is correct. More...
 
RecordTyperecordType ()
 Give access to the RecordType flag (write-access is needed when a record is read back). More...
 
RecordType recordType () const
 
Int newIdToNumber (const RecordFieldId &) const
 Get the field number for the given field id. More...
 
void defineField (const RecordFieldId &, DataType type, const void *value)
 Add a scalar field with the given type and value. More...
 
void defineField (const RecordFieldId &, DataType type, const IPosition &shape, Bool fixedShape, const void *value)
 Add an array field with the given type, shape and value. More...
 

Private Member Functions

virtual RecordDesc getDescription () const =0
 Get the description of this record. More...
 

Private Attributes

CheckFieldFunctioncheckFunction_p
 Holds the callback function plus argument. More...
 
const void * checkArgument_p
 
RecordType type_p
 Defines if the Record has a fixed structure. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const RecordInterface &rec)
 Print the contents of the record. More...
 

Detailed Description

Abstract base class for Record classes

Intended use:

Public interface

Review Status

Reviewed By:
Mark Wieringa
Date Reviewed:
1996/04/15
Test programs:
tRecord

Etymology

`‘Record’' is a widely used term in both programming languages and data structures to denote an imhogeneous set of fields. An alternative would have been to name it structure, which would have perhaps been a clearer name for C++ programmers.
RecordInterface denotes that this class defines the common interface to possible Record classes.

Synopsis

A Record is an heterogeneous, hierarchical, collection of named fields. The fields may be of scalar type, array type, a Table or a Record. This latter feature is what makes the Record a (potentially) hierarchical type.

RecordInterface is the abstract base class for various Record classes. At the moment three Record classes exist:

Presently, the scalar types are chosen to be compatible with the native types of the Table system, viz: Bool, uChar, Short, Int, uInt, Int64, Float, Double, Complex, DComplex, String. Arrays of all these types are also available. It is fairly straightforward to extend this set if necessary, although it will result in more template instantiations with the current implementation.

Each field has an integral index, which ranges between 0 and nfields() - 1. The values of a field can be manipulated in two ways:

  1. Through the get and put functions in this class. They are easy to use and support type promotion. However, they are a bit less efficient than the second way.
  2. Through the class RecordFieldPtr. This is a bit less convenient. However, it is more efficient if the same field is accessed multiple times.

The structure of a record can be fixed or variable. If fixed, it is not possible to change the structure once the record has been instantiated. If variable, the record can be restructured or fields can be added/removed.
When a field gets added, it is possible to check if its name and type are valid by means of the CheckFunction callback. This is for instance used by the table system to assure that keywords and columns in a table do not have the same name.

Arrays in a record description can be fixed or variable shaped. If fixed shaped, only arrays with that shape can be stored in that field in the record. If variable shaped, any array can be stored.
However, note there is a difference between assign and define. Assign invokes the array assignment operator which checks for conformance. Thus even for variable shaped arrays, the new array must conform the exisitng one when using assign. Define simply replaces the array, thus for variable shaped arrays ay array shape will do.

RecordFieldPtr objects attached to a Record have to be notified when the Record is deleted or changed. The RecordInterface class provides the hooks for this via the Notice system. It is derived from NoticeSource. The class RecordNotice is for the messages.

Motivation

This common base class provides a common interface to the various Record classes. Furthermore it is needed for the class RecordFieldPtr. Finally it provides the hooks for the notification in case the record structure changes.

To Do

Definition at line 144 of file RecordInterface.h.

Member Typedef Documentation

◆ CheckFieldFunction

typedef Bool casacore::RecordInterface::CheckFieldFunction(const String &fieldName, DataType dataType, const void *extraArgument, String &message)

Define the signature of the add callback function.

This function is called when a field is added to the record (thus also when a Record is constructed from a RecordDesc). The function can check if the name and/or data type are valid. The extra argument is the argument given to the Record constructor which can be used to pass non-Record information. The function should return False if name or data type is invalid. In that case it can fill the message string, which will be added to the message in the thrown exception.

Definition at line 183 of file RecordInterface.h.

Member Enumeration Documentation

◆ DuplicatesFlag

Define the Duplicates flag for the function merge in the various record classes.

This function merges the fields from that record (description) into this one. DuplicatesFlag determines what to do if a field already exists.

Enumerator
RenameDuplicates 

Rename a name from the other set to name_n, where n is the first positive number making the name unique.

SkipDuplicates 

Skip duplicate names from the other set.

OverwriteDuplicates 

Overwrite the value of a duplicate keyword This will also happen if their types differ.

ThrowOnDuplicates 

Throw an exception.

Definition at line 162 of file RecordInterface.h.

◆ RecordType

Define the flag telling if a Record has a fixed or variable structure.

Enumerator
Fixed 

Record has a fixed structure; that is, no fields can be added or removed once the Record is created.

Variable 

Record has a variable structure; after Record creation fields can be added or removed at will.

Definition at line 149 of file RecordInterface.h.

Constructor & Destructor Documentation

◆ RecordInterface() [1/3]

casacore::RecordInterface::RecordInterface ( )

The default constructor creates an empty record with a variable structure.

◆ RecordInterface() [2/3]

casacore::RecordInterface::RecordInterface ( RecordType  type,
CheckFieldFunction funcPtr,
const void *  checkArgument 
)

Create a record with no fields.

The callback function is called when a field is added to the Record. That function can check the name and of data type of the new field (for instance, the Table system uses it to ensure that table columns and keywords have different names).

◆ RecordInterface() [3/3]

casacore::RecordInterface::RecordInterface ( const RecordInterface other)

Copy constructor (copy semantics).

◆ ~RecordInterface()

virtual casacore::RecordInterface::~RecordInterface ( )
virtual

Destruct the record.

All attached RecordFieldPtr objects are notified to detach themselves.

Member Function Documentation

◆ addDataField()

virtual void casacore::RecordInterface::addDataField ( const String name,
DataType  type,
const IPosition shape,
Bool  fixedShape,
const void *  value 
)
protectedpure virtual

Let the derived class add an array field with the given type, shape, and value.

Implemented in casacore::TableRecord, and casacore::Record.

◆ asArrayBool()

const Array<Bool>& casacore::RecordInterface::asArrayBool ( const RecordFieldId ) const

◆ asArrayComplex()

const Array<Complex>& casacore::RecordInterface::asArrayComplex ( const RecordFieldId ) const

◆ asArrayDComplex()

const Array<DComplex>& casacore::RecordInterface::asArrayDComplex ( const RecordFieldId ) const

◆ asArrayDouble()

const Array<Double>& casacore::RecordInterface::asArrayDouble ( const RecordFieldId ) const

Referenced by asArraydouble().

◆ asArraydouble()

const Array< Double > & casacore::RecordInterface::asArraydouble ( const RecordFieldId id) const
inline

Definition at line 588 of file RecordInterface.h.

References asArrayDouble().

◆ asArrayFloat()

const Array<Float>& casacore::RecordInterface::asArrayFloat ( const RecordFieldId ) const

Referenced by asArrayfloat().

◆ asArrayfloat()

const Array< Float > & casacore::RecordInterface::asArrayfloat ( const RecordFieldId id) const
inline

Definition at line 583 of file RecordInterface.h.

References asArrayFloat().

◆ asArrayInt()

const Array<Int>& casacore::RecordInterface::asArrayInt ( const RecordFieldId ) const

◆ asArrayInt64()

const Array<Int64>& casacore::RecordInterface::asArrayInt64 ( const RecordFieldId ) const

◆ asArrayShort()

const Array<Short>& casacore::RecordInterface::asArrayShort ( const RecordFieldId ) const

◆ asArrayString()

const Array<String>& casacore::RecordInterface::asArrayString ( const RecordFieldId ) const

◆ asArrayuChar()

const Array<uChar>& casacore::RecordInterface::asArrayuChar ( const RecordFieldId ) const

◆ asArrayuInt()

const Array<uInt>& casacore::RecordInterface::asArrayuInt ( const RecordFieldId ) const

◆ asBool()

Bool casacore::RecordInterface::asBool ( const RecordFieldId ) const

The following functions get the value based on field name or number.

The scalar functions promote the data type if needed. It also supports conversion of Int to Bool.
The array functions throw an exception if the data type mismatches. The toArrayX function can be used for array type promotion.

◆ asComplex()

Complex casacore::RecordInterface::asComplex ( const RecordFieldId ) const

◆ asDComplex()

DComplex casacore::RecordInterface::asDComplex ( const RecordFieldId ) const

◆ asDouble()

Double casacore::RecordInterface::asDouble ( const RecordFieldId ) const

Referenced by asdouble().

◆ asdouble()

Double casacore::RecordInterface::asdouble ( const RecordFieldId id) const
inline

Definition at line 579 of file RecordInterface.h.

References asDouble().

◆ asFloat()

Float casacore::RecordInterface::asFloat ( const RecordFieldId ) const

Referenced by asfloat().

◆ asfloat()

Float casacore::RecordInterface::asfloat ( const RecordFieldId id) const
inline

Get value based on field name or number.

They are here for backward compatibility with the old KeywordSet classes and will be removed in the future.

Definition at line 575 of file RecordInterface.h.

References asFloat().

◆ asInt()

Int casacore::RecordInterface::asInt ( const RecordFieldId ) const

◆ asInt64()

Int64 casacore::RecordInterface::asInt64 ( const RecordFieldId ) const

◆ asRecord()

virtual const RecordInterface& casacore::RecordInterface::asRecord ( const RecordFieldId ) const
pure virtual

◆ asrwRecord()

virtual RecordInterface& casacore::RecordInterface::asrwRecord ( const RecordFieldId )
pure virtual

◆ asShort()

Short casacore::RecordInterface::asShort ( const RecordFieldId ) const

◆ assign()

virtual void casacore::RecordInterface::assign ( const RecordInterface that)
pure virtual

Assign that RecordInterface object to this one.

Unlike operator= it copies all data in the derived class.

Implemented in casacore::TableRecord, and casacore::Record.

◆ asString()

const String& casacore::RecordInterface::asString ( const RecordFieldId ) const

◆ asuChar()

uChar casacore::RecordInterface::asuChar ( const RecordFieldId ) const

◆ asuInt()

uInt casacore::RecordInterface::asuInt ( const RecordFieldId ) const

◆ asValueHolder()

virtual ValueHolder casacore::RecordInterface::asValueHolder ( const RecordFieldId ) const
virtual

Get or define the value as a ValueHolder.

This is useful to pass around a value of any supported type.

Reimplemented in casacore::TableRecord, and casacore::Record.

◆ checkName()

void casacore::RecordInterface::checkName ( const String fieldName,
DataType  type 
) const
protected

Check if the new field name is correct.

This is done by calling the checkFunction (if defined). If incorrect, an exception is thrown.

◆ clone()

virtual RecordInterface* casacore::RecordInterface::clone ( ) const
pure virtual

Make a copy of this object.

Implemented in casacore::TableRecord, and casacore::Record.

◆ comment()

virtual const String& casacore::RecordInterface::comment ( const RecordFieldId ) const
pure virtual

Get the comment for this field.

Implemented in casacore::TableRecord, and casacore::Record.

◆ dataType()

DataType casacore::RecordInterface::dataType ( const RecordFieldId id) const
inline

Definition at line 567 of file RecordInterface.h.

References idToNumber(), and type().

◆ define() [1/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
Bool  value 
)

Define a value for the given field.

Array conformance rules will not be applied for variable shaped arrays. If the field and value data type mismatch, type promotion of scalars will be done if possible. If not possible, an exception is thrown.
If the field does not exist, it will be added to the record. This results in an exception for fixed structured records. The field is checked by a possible field checking function before it gets added.

Referenced by define(), casacore::FunctionMarshallable::loadFuncType(), casacore::HDF5Record::readArr(), and casacore::HDF5Record::readSca().

◆ define() [2/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const Array< Bool > &  value,
Bool  FixedShape = False 
)

◆ define() [3/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const Array< Complex > &  value,
Bool  FixedShape = False 
)

◆ define() [4/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const Array< DComplex > &  value,
Bool  FixedShape = False 
)

◆ define() [5/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const Array< Double > &  value,
Bool  FixedShape = False 
)

◆ define() [6/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const Array< Float > &  value,
Bool  FixedShape = False 
)

◆ define() [7/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const Array< Int > &  value,
Bool  FixedShape = False 
)

◆ define() [8/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const Array< Int64 > &  value,
Bool  FixedShape = False 
)

◆ define() [9/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const Array< Short > &  value,
Bool  FixedShape = False 
)

◆ define() [10/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const Array< String > &  value,
Bool  FixedShape = False 
)

◆ define() [11/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const Array< uChar > &  value,
Bool  FixedShape = False 
)

◆ define() [12/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const Array< uInt > &  value,
Bool  FixedShape = False 
)

◆ define() [13/23]

void casacore::RecordInterface::define ( const RecordFieldId id,
const Char value 
)
inline

Definition at line 571 of file RecordInterface.h.

References define(), and casacore::value().

◆ define() [14/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const Complex &  value 
)

◆ define() [15/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const DComplex &  value 
)

◆ define() [16/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
const String value 
)

◆ define() [17/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
Double  value 
)

◆ define() [18/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
Float  value 
)

◆ define() [19/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
Int  value 
)

◆ define() [20/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
Int64  value 
)

◆ define() [21/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
Short  value 
)

◆ define() [22/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
uChar  value 
)

◆ define() [23/23]

void casacore::RecordInterface::define ( const RecordFieldId ,
uInt  value 
)

◆ defineDataField()

virtual void casacore::RecordInterface::defineDataField ( Int  whichField,
DataType  type,
const void *  value 
)
pure virtual

Define a data field (for RecordFieldPtr).

Implemented in casacore::TableRecord, and casacore::Record.

Referenced by casacore::defineRecordFieldPtr().

◆ defineField() [1/2]

void casacore::RecordInterface::defineField ( const RecordFieldId ,
DataType  type,
const IPosition shape,
Bool  fixedShape,
const void *  value 
)
protected

Add an array field with the given type, shape and value.

An exception is thrown if the record structure is fixed or if the name is invalid.

◆ defineField() [2/2]

void casacore::RecordInterface::defineField ( const RecordFieldId ,
DataType  type,
const void *  value 
)
protected

Add a scalar field with the given type and value.

An exception is thrown if the record structure is fixed or if the name is invalid.

◆ defineFromValueHolder()

virtual void casacore::RecordInterface::defineFromValueHolder ( const RecordFieldId ,
const ValueHolder  
)
virtual

Reimplemented in casacore::TableRecord, and casacore::Record.

◆ defineRecord()

virtual void casacore::RecordInterface::defineRecord ( const RecordFieldId ,
const RecordInterface value,
RecordType  = Variable 
)
pure virtual

◆ description()

RecordDesc casacore::RecordInterface::description ( ) const

Get the description of this record.

Referenced by casacore::RecordExpr_global_functions_RecordExpr::makeRecordExpr().

◆ empty()

bool casacore::RecordInterface::empty ( ) const
inline

Is the record empty?

Definition at line 233 of file RecordInterface.h.

References size().

Referenced by casacore::ImageAttrGroupHDF5::isNull(), and casacore::TableProxy::record2Array().

◆ fieldNumber()

virtual Int casacore::RecordInterface::fieldNumber ( const String fieldName) const
pure virtual

Get the field number from the field name.

-1 is returned if the field name is unknown.

Implemented in casacore::TableRecord, and casacore::Record.

Referenced by isDefined().

◆ get() [1/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Array< Bool > &  value 
) const

◆ get() [2/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Array< Complex > &  value 
) const

◆ get() [3/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Array< DComplex > &  value 
) const

◆ get() [4/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Array< Double > &  value 
) const

◆ get() [5/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Array< Float > &  value 
) const

◆ get() [6/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Array< Int > &  value 
) const

◆ get() [7/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Array< Int64 > &  value 
) const

◆ get() [8/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Array< Short > &  value 
) const

◆ get() [9/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Array< String > &  value 
) const

◆ get() [10/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Array< uChar > &  value 
) const

◆ get() [11/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Array< uInt > &  value 
) const

◆ get() [12/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Bool value 
) const

Get the value of the given field.

If the field and value data type mismatch, type promotion will be done if possible. If not possible, an exception is thrown. If the value argument is an array, it will be reshaped if needed.

Referenced by casacore::ColumnsIndex::copyKeyField(), casacore::TableProxy::record2Array(), casacore::HDF5Record::writeArr(), and casacore::HDF5Record::writeSca().

◆ get() [13/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Complex &  value 
) const

◆ get() [14/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
DComplex &  value 
) const

◆ get() [15/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Double value 
) const

◆ get() [16/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Float value 
) const

◆ get() [17/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Int value 
) const

◆ get() [18/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Int64 value 
) const

◆ get() [19/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
Short value 
) const

◆ get() [20/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
String value 
) const

◆ get() [21/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
uChar value 
) const

◆ get() [22/22]

void casacore::RecordInterface::get ( const RecordFieldId ,
uInt value 
) const

◆ get_pointer() [1/2]

virtual void* casacore::RecordInterface::get_pointer ( Int  whichField,
DataType  type 
) const
pure virtual

Used by the RecordFieldPtr classes to attach to the correct field.

The latter function is used to attach to a Record-type field checking if the correct Record type is used.

Implemented in casacore::TableRecord, and casacore::Record.

Referenced by casacore::attachRecordFieldPtr().

◆ get_pointer() [2/2]

virtual void* casacore::RecordInterface::get_pointer ( Int  whichField,
DataType  type,
const String recordType 
) const
pure virtual

◆ getDescription()

virtual RecordDesc casacore::RecordInterface::getDescription ( ) const
privatepure virtual

Get the description of this record.

Implemented in casacore::TableRecord, and casacore::Record.

◆ idToNumber()

Int casacore::RecordInterface::idToNumber ( const RecordFieldId ) const

Get the field number for the given field id.

It throws an exception if id is unrecognized (e.g. an unknown name).

Referenced by dataType().

◆ isDefined()

Bool casacore::RecordInterface::isDefined ( const String fieldName) const
inline

Test if a field name exists.

Definition at line 555 of file RecordInterface.h.

References fieldNumber().

Referenced by casacore::SerialHelper::exists().

◆ isFixed()

Bool casacore::RecordInterface::isFixed ( ) const
inline

Is the Record structure fixed (i.e.

impossible to restructure or to add or remove fields)?

Definition at line 551 of file RecordInterface.h.

References Fixed, and type_p.

◆ makeUnique()

virtual void casacore::RecordInterface::makeUnique ( )
pure virtual

Make a unique record representation (for copy-on-write in RecordFieldPtr).

Implemented in casacore::TableRecord, and casacore::Record.

◆ name()

String casacore::RecordInterface::name ( const RecordFieldId ) const

Get the name of this field.

Referenced by casacore::RecordFieldPtr< T >::name().

◆ newIdToNumber()

Int casacore::RecordInterface::newIdToNumber ( const RecordFieldId ) const
protected

Get the field number for the given field id.

It returns -1 if an unknown name was given.

◆ nfields()

virtual uInt casacore::RecordInterface::nfields ( ) const
pure virtual

How many fields does this structure have?

Implemented in casacore::TableRecord, and casacore::Record.

Referenced by size().

◆ operator=()

RecordInterface& casacore::RecordInterface::operator= ( const RecordInterface other)

Assignment (copy semantics).

This only assigns the RecordInterface object itself, thus not the data in a derived class. To do that the function assign below can be used.

◆ print()

virtual void casacore::RecordInterface::print ( std::ostream &  ,
Int  maxNrValues = 25,
const String indent = "" 
) const
pure virtual

◆ recordType() [1/2]

RecordInterface::RecordType & casacore::RecordInterface::recordType ( )
inlineprotected

Give access to the RecordType flag (write-access is needed when a record is read back).

Definition at line 559 of file RecordInterface.h.

References type_p.

◆ recordType() [2/2]

RecordInterface::RecordType casacore::RecordInterface::recordType ( ) const
inlineprotected

Definition at line 563 of file RecordInterface.h.

References type_p.

◆ removeField()

virtual void casacore::RecordInterface::removeField ( const RecordFieldId )
pure virtual

Remove a field from the record.


Caution: Removing a field means that the field number of the fields following it will be decremented; It will invalidate RecordFieldPtr's pointing to the removed field, but no other RecordFieldPtr's;

Implemented in casacore::TableRecord, and casacore::Record.

◆ restructure()

virtual void casacore::RecordInterface::restructure ( const RecordDesc newDescription,
Bool  recursive = True 
)
pure virtual

Change the structure of this Record to contain the fields in newDescription.

After calling restructure, description() == newDescription. Any existing RecordFieldPtr objects are invalidated (their isAttached() members return False) after this call.
If the new description contains subrecords, those subrecords will be restructured if recursive=True is given. Otherwise the subrecord is a variable empty record. Subrecords will be variable if their description is empty (i.e. does not contain any field), otherwise they are fixed.
Restructuring is not possible and an exception is thrown if the Record has a fixed structure.

Implemented in casacore::TableRecord, and casacore::Record.

◆ setComment()

virtual void casacore::RecordInterface::setComment ( const RecordFieldId ,
const String comment 
)
pure virtual

Set the comment for this field.

Implemented in casacore::TableRecord, and casacore::Record.

◆ shape()

IPosition casacore::RecordInterface::shape ( const RecordFieldId ) const

Get the actual shape of this field.

It returns [1] for non-array fields.

◆ size()

uInt casacore::RecordInterface::size ( ) const
inline

Definition at line 228 of file RecordInterface.h.

References nfields().

Referenced by empty(), and casacore::TableProxy::record2Array().

◆ throwIfFixed()

void casacore::RecordInterface::throwIfFixed ( ) const
protected

Check if the Record has a non-fixed structure.

If it is fixed, it throws an exception. This can be used by other functions (like define).

◆ toArray() [1/11]

void casacore::RecordInterface::toArray ( const RecordFieldId id,
Array< Bool > &  array 
) const
inline

Definition at line 429 of file RecordInterface.h.

References casacore::array(), and toArrayBool().

◆ toArray() [2/11]

void casacore::RecordInterface::toArray ( const RecordFieldId id,
Array< Complex > &  array 
) const
inline

Definition at line 445 of file RecordInterface.h.

References casacore::array(), and toArrayComplex().

◆ toArray() [3/11]

void casacore::RecordInterface::toArray ( const RecordFieldId id,
Array< DComplex > &  array 
) const
inline

Definition at line 447 of file RecordInterface.h.

References casacore::array(), and toArrayDComplex().

◆ toArray() [4/11]

void casacore::RecordInterface::toArray ( const RecordFieldId id,
Array< Double > &  array 
) const
inline

Definition at line 443 of file RecordInterface.h.

References casacore::array(), and toArrayDouble().

◆ toArray() [5/11]

void casacore::RecordInterface::toArray ( const RecordFieldId id,
Array< Float > &  array 
) const
inline

Definition at line 441 of file RecordInterface.h.

References casacore::array(), and toArrayFloat().

◆ toArray() [6/11]

void casacore::RecordInterface::toArray ( const RecordFieldId id,
Array< Int > &  array 
) const
inline

Definition at line 435 of file RecordInterface.h.

References casacore::array(), and toArrayInt().

◆ toArray() [7/11]

void casacore::RecordInterface::toArray ( const RecordFieldId id,
Array< Int64 > &  array 
) const
inline

Definition at line 439 of file RecordInterface.h.

References casacore::array(), and toArrayInt64().

◆ toArray() [8/11]

void casacore::RecordInterface::toArray ( const RecordFieldId id,
Array< Short > &  array 
) const
inline

Definition at line 433 of file RecordInterface.h.

References casacore::array(), and toArrayShort().

◆ toArray() [9/11]

void casacore::RecordInterface::toArray ( const RecordFieldId id,
Array< String > &  array 
) const
inline

Definition at line 449 of file RecordInterface.h.

References casacore::array(), and toArrayString().

◆ toArray() [10/11]

void casacore::RecordInterface::toArray ( const RecordFieldId id,
Array< uChar > &  array 
) const
inline

Definition at line 431 of file RecordInterface.h.

References casacore::array(), and toArrayuChar().

◆ toArray() [11/11]

void casacore::RecordInterface::toArray ( const RecordFieldId id,
Array< uInt > &  array 
) const
inline

Definition at line 437 of file RecordInterface.h.

References casacore::array(), and toArrayuInt().

◆ toArrayBool()

Array<Bool> casacore::RecordInterface::toArrayBool ( const RecordFieldId ) const

Get an array while promoting the data as needed.

Int values can be converted to Bool. A scalar value is also converted to an array. These functions are slower than asX, but more general.

Referenced by toArray().

◆ toArrayComplex()

Array<Complex> casacore::RecordInterface::toArrayComplex ( const RecordFieldId ) const

Referenced by toArray().

◆ toArrayDComplex()

Array<DComplex> casacore::RecordInterface::toArrayDComplex ( const RecordFieldId ) const

Referenced by toArray().

◆ toArrayDouble()

Array<Double> casacore::RecordInterface::toArrayDouble ( const RecordFieldId ) const

Referenced by toArray().

◆ toArrayFloat()

Array<Float> casacore::RecordInterface::toArrayFloat ( const RecordFieldId ) const

Referenced by toArray().

◆ toArrayInt()

Array<Int> casacore::RecordInterface::toArrayInt ( const RecordFieldId ) const

Referenced by toArray().

◆ toArrayInt64()

Array<Int64> casacore::RecordInterface::toArrayInt64 ( const RecordFieldId ) const

Referenced by toArray().

◆ toArrayShort()

Array<Short> casacore::RecordInterface::toArrayShort ( const RecordFieldId ) const

Referenced by toArray().

◆ toArrayString()

Array<String> casacore::RecordInterface::toArrayString ( const RecordFieldId ) const

Referenced by toArray().

◆ toArrayuChar()

Array<uChar> casacore::RecordInterface::toArrayuChar ( const RecordFieldId ) const

Referenced by toArray().

◆ toArrayuInt()

Array<uInt> casacore::RecordInterface::toArrayuInt ( const RecordFieldId ) const

Referenced by toArray().

◆ type()

virtual DataType casacore::RecordInterface::type ( Int  whichField) const
pure virtual

Get the data type of this field (as defined in DataType.h).

Implemented in casacore::TableRecord, and casacore::Record.

Referenced by dataType().

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const RecordInterface rec 
)
friend

Print the contents of the record.

Only the first maxNrValues of an array will be printed. A value < 0 means the entire array.

Definition at line 488 of file RecordInterface.h.

Member Data Documentation

◆ checkArgument_p

const void* casacore::RecordInterface::checkArgument_p
private

Definition at line 544 of file RecordInterface.h.

◆ checkFunction_p

CheckFieldFunction* casacore::RecordInterface::checkFunction_p
private

Holds the callback function plus argument.

Definition at line 543 of file RecordInterface.h.

◆ type_p

RecordType casacore::RecordInterface::type_p
private

Defines if the Record has a fixed structure.

Definition at line 547 of file RecordInterface.h.

Referenced by isFixed(), and recordType().


The documentation for this class was generated from the following file: