casacore
Public Member Functions | Private Attributes | List of all members
casacore::RecordFieldId Class Reference

More...

#include <RecordFieldId.h>

Public Member Functions

 RecordFieldId (Int fieldNumber)
 Construct it from a field number. More...
 
 RecordFieldId (const String &name)
 Construct it from a field name. More...
 
 RecordFieldId (const std::string &name)
 
 RecordFieldId (const Char *name)
 
Int fieldNumber () const
 Get the field number. More...
 
const StringfieldName () const
 Get the field name. More...
 
Bool byName () const
 Is the id given by name? More...
 

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

◆ RecordFieldId() [1/4]

casacore::RecordFieldId::RecordFieldId ( Int  fieldNumber)
inline

Construct it from a field number.

Definition at line 121 of file RecordFieldId.h.

◆ RecordFieldId() [2/4]

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

Construct it from a field name.

Definition at line 126 of file RecordFieldId.h.

◆ RecordFieldId() [3/4]

casacore::RecordFieldId::RecordFieldId ( const std::string &  name)
inline

Definition at line 132 of file RecordFieldId.h.

◆ RecordFieldId() [4/4]

casacore::RecordFieldId::RecordFieldId ( const Char name)
inline

Definition at line 138 of file RecordFieldId.h.

Member Function Documentation

◆ byName()

Bool casacore::RecordFieldId::byName ( ) const
inline

Is the id given by name?

Definition at line 154 of file RecordFieldId.h.

References byName_p.

◆ fieldName()

const String & casacore::RecordFieldId::fieldName ( ) const
inline

Get the field name.

Definition at line 149 of file RecordFieldId.h.

References name_p.

◆ fieldNumber()

Int casacore::RecordFieldId::fieldNumber ( ) const
inline

Get the field number.

Definition at line 144 of file RecordFieldId.h.

References number_p.

Member Data Documentation

◆ byName_p

Bool casacore::RecordFieldId::byName_p
private

Definition at line 114 of file RecordFieldId.h.

Referenced by byName().

◆ name_p

String casacore::RecordFieldId::name_p
private

Definition at line 116 of file RecordFieldId.h.

Referenced by fieldName().

◆ number_p

Int casacore::RecordFieldId::number_p
private

Definition at line 115 of file RecordFieldId.h.

Referenced by fieldNumber().


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