casa
$Rev:20696$
|
The identification of a record field. More...
#include <RecordFieldId.h>
Public Member Functions | |
RecordFieldId (Int fieldNumber) | |
Construct it from a field number. | |
RecordFieldId (const String &name) | |
Construct it from a field name. | |
RecordFieldId (const std::string &name) | |
RecordFieldId (const Char *name) | |
Int | fieldNumber () const |
Get the field number. | |
const String & | fieldName () const |
Get the field name. | |
Bool | byName () const |
Is the id given by name? | |
Private Attributes | |
Bool | byName_p |
Int | number_p |
String | name_p |
The identification of a record field.
Public interface
RecordFieldId gives the identification of a field in a record.
This class provides the user to identify a field in a record. Identification can be done by means of the field name or by means of its field number.
For the programmer the most convenient way is probably the name, because that is the natural identification. However, identification by means of field number is much faster and could be used when it is known.
void someFunc (const Record& record) { float value1 = record.asfloat ("name"); // identify by name float value2 = record.asfloat (0); // identify by number }
This class makes it possible that many functions in Record classes have to be defined only once. The constructors of RecordFieldId make it possible that a number and a string are automatically converted, so the user does not have to instantiate a RecordFieldId object explicitly.
Definition at line 91 of file RecordFieldId.h.
casa::RecordFieldId::RecordFieldId | ( | Int | fieldNumber | ) | [inline] |
Construct it from a field number.
Definition at line 121 of file RecordFieldId.h.
casa::RecordFieldId::RecordFieldId | ( | const String & | name | ) | [inline] |
Construct it from a field name.
Definition at line 126 of file RecordFieldId.h.
casa::RecordFieldId::RecordFieldId | ( | const std::string & | name | ) | [inline] |
Definition at line 132 of file RecordFieldId.h.
casa::RecordFieldId::RecordFieldId | ( | const Char * | name | ) | [inline] |
Definition at line 138 of file RecordFieldId.h.
Bool casa::RecordFieldId::byName | ( | ) | const [inline] |
const String & casa::RecordFieldId::fieldName | ( | ) | const [inline] |
Int casa::RecordFieldId::fieldNumber | ( | ) | const [inline] |
Bool casa::RecordFieldId::byName_p [private] |
Definition at line 114 of file RecordFieldId.h.
Referenced by byName().
String casa::RecordFieldId::name_p [private] |
Definition at line 116 of file RecordFieldId.h.
Referenced by fieldName().
Int casa::RecordFieldId::number_p [private] |
Definition at line 115 of file RecordFieldId.h.
Referenced by fieldNumber().