#include <RecordField.h>
Inheritance diagram for casa::RecordFieldPtr< T >:


Part of API
RecordFieldPtr indicates that an object of this type is pointing to a field in a record.
RecordFieldPtr allows access to the fields in a record object. A record object is an object of a class derived from RecordInterface . RecordFieldPtr<T> objects can only be instantiated for types `T' which are valid fields of a record object (e.g. Int, float, String, Record, TableRecord). It can, however, NOT be instantiated for a Table field, because Table fields are accessed indirectly via a TableKeyword object. Table fields have to be accessed directly through the TableRecord interface.
The RecordFieldPtr is pointer-like in the sense that it points to an object that is physically inside of another object (the enclosing record object). Access to the value is obtained via the dereference operator (operator*()) to emphasize the pointer like nature of these classes.
An alternative way to get access to the values is using the functions define and get. Note that in
RecordFieldPtr<Array<Int> > field (record, fieldNumber); Array<Int> value; *field = value; field.define (value);
RecordFieldPtr is derived from NoticeTarget to get messages from the mother record class when it changes. For example, when the record is destructed, all RecordFieldPtr's pointing to that record will automatically be detached.
See the example in the Record class.
RecordFieldPtr provides a fast way to access the data in a record.
Definition at line 118 of file RecordField.h.
Public Member Functions | |
| RecordFieldPtr () | |
| This object does not point to any field, i.e. | |
| ~RecordFieldPtr () | |
| void | detach () |
| Point to no field in any Record. | |
| void | define (const T &value) |
| Store a value in the field using redefinition. | |
| const String & | comment () const |
| Get the comment of this field. | |
| void | setComment (const String &comment) |
| Set the comment for this field. | |
| Int | fieldNumber () const |
| Return the fieldnumber of this field. | |
| String | name () const |
| Return the name of the field. | |
| Bool | isAttached () const |
| Is this field pointer attached to a valid record? Operations which might cause it to become detached are:. | |
| RecordFieldPtr (RecordInterface &record, Int whichField) | |
| Attach this field pointer to the given field. | |
| RecordFieldPtr (RecordInterface &record, const RecordFieldId &) | |
| RecordFieldPtr (const RecordFieldPtr< T > &other) | |
| After calling, this and other point to the same field, i.e. | |
| RecordFieldPtr< T > & | operator= (const RecordFieldPtr< T > &other) |
| void | attachToRecord (RecordInterface &record, Int whichField) |
| Change our pointer to the supplied field. | |
| void | attachToRecord (RecordInterface &record, const RecordFieldId &) |
| T & | operator * () |
| Provide access to the field's value. | |
| const T & | operator * () const |
| const T & | get () const |
Private Member Functions | |
| virtual void | notify (const Notice &message) |
| Not important for users - the mechanism by which field pointers are notified when there is a change in the record. | |
Private Attributes | |
| T * | fieldPtr_p |
| RecordInterface * | parent_p |
| Int | fieldNumber_p |
| casa::RecordFieldPtr< T >::RecordFieldPtr | ( | ) |
This object does not point to any field, i.e.
this->isAttached() == False;
| casa::RecordFieldPtr< T >::RecordFieldPtr | ( | RecordInterface & | record, | |
| Int | whichField | |||
| ) |
Attach this field pointer to the given field.
If it does not exist an exception is thrown.
| casa::RecordFieldPtr< T >::RecordFieldPtr | ( | RecordInterface & | record, | |
| const RecordFieldId & | ||||
| ) |
| casa::RecordFieldPtr< T >::RecordFieldPtr | ( | const RecordFieldPtr< T > & | other | ) |
After calling, this and other point to the same field, i.e.
it uses reference semantics.
| casa::RecordFieldPtr< T >::~RecordFieldPtr | ( | ) |
| RecordFieldPtr<T>& casa::RecordFieldPtr< T >::operator= | ( | const RecordFieldPtr< T > & | other | ) |
| void casa::RecordFieldPtr< T >::attachToRecord | ( | RecordInterface & | record, | |
| Int | whichField | |||
| ) |
Change our pointer to the supplied field.
If it doesn't exist an exception is thrown.
| void casa::RecordFieldPtr< T >::attachToRecord | ( | RecordInterface & | record, | |
| const RecordFieldId & | ||||
| ) |
| void casa::RecordFieldPtr< T >::detach | ( | ) |
Point to no field in any Record.
| T& casa::RecordFieldPtr< T >::operator * | ( | ) |
Provide access to the field's value.
Note: To be sure a const function is called, it is best to use get(). For a non-const object, a non-const function is called, even if used as an rvalue.
| const T& casa::RecordFieldPtr< T >::operator * | ( | ) | const [inline] |
Definition at line 159 of file RecordField.h.
| const T& casa::RecordFieldPtr< T >::get | ( | ) | const [inline] |
Definition at line 160 of file RecordField.h.
| void casa::RecordFieldPtr< T >::define | ( | const T & | value | ) |
Store a value in the field using redefinition.
Define differs from assignment w.r.t. arrays. For define a variable shaped array is deleted first with the effect that array conformance rules are not applied for them.
| const String& casa::RecordFieldPtr< T >::comment | ( | ) | const |
Get the comment of this field.
| void casa::RecordFieldPtr< T >::setComment | ( | const String & | comment | ) |
Set the comment for this field.
| Int casa::RecordFieldPtr< T >::fieldNumber | ( | ) | const [inline] |
| String casa::RecordFieldPtr< T >::name | ( | ) | const [inline] |
Return the name of the field.
Definition at line 180 of file RecordField.h.
Referenced by casa::ColumnsIndex::copyKeyField().
| Bool casa::RecordFieldPtr< T >::isAttached | ( | ) | const [inline] |
Is this field pointer attached to a valid record? Operations which might cause it to become detached are:.
Reimplemented from casa::NoticeTarget.
Definition at line 191 of file RecordField.h.
| virtual void casa::RecordFieldPtr< T >::notify | ( | const Notice & | message | ) | [private, virtual] |
Not important for users - the mechanism by which field pointers are notified when there is a change in the record.
Implements casa::NoticeTarget.
T* casa::RecordFieldPtr< T >::fieldPtr_p [private] |
Definition at line 195 of file RecordField.h.
Referenced by casa::RecordFieldPtr< casa::Array< unsigned char > >::get(), and casa::RecordFieldPtr< casa::Array< unsigned char > >::operator *().
RecordInterface* casa::RecordFieldPtr< T >::parent_p [private] |
Definition at line 196 of file RecordField.h.
Referenced by casa::RecordFieldPtr< casa::Array< unsigned char > >::name().
Int casa::RecordFieldPtr< T >::fieldNumber_p [private] |
Definition at line 197 of file RecordField.h.
Referenced by casa::RecordFieldPtr< casa::Array< unsigned char > >::fieldNumber(), and casa::RecordFieldPtr< casa::Array< unsigned char > >::name().
1.5.1