casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Attributes
casa::RecordFieldId Class Reference

The identification of a record field. More...

#include <RecordFieldId.h>

List of all members.

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 StringfieldName () 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

Detailed Description

The identification of a record field.

Intended use:

Public interface

Review Status

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

Prerequisite

Etymology

RecordFieldId gives the identification of a field in a record.

Synopsis

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.

Example

    void someFunc (const Record& record)
    {
        float value1 = record.asfloat ("name");     // identify by name
        float value2 = record.asfloat (0);          // identify by number
    }

Motivation

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

Bool casa::RecordFieldId::byName ( ) const [inline]

Is the id given by name?

Definition at line 154 of file RecordFieldId.h.

References byName_p.

const String & casa::RecordFieldId::fieldName ( ) const [inline]

Get the field name.

Definition at line 149 of file RecordFieldId.h.

References name_p.

Get the field number.

Definition at line 144 of file RecordFieldId.h.

References number_p.


Member Data Documentation

Definition at line 114 of file RecordFieldId.h.

Referenced by byName().

Definition at line 116 of file RecordFieldId.h.

Referenced by fieldName().

Definition at line 115 of file RecordFieldId.h.

Referenced by fieldNumber().


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