casacore
Loading...
Searching...
No Matches
casacore::RecordFieldId Class Reference

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 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 88 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 118 of file RecordFieldId.h.

References byName_p, casacore::False, fieldNumber(), and number_p.

◆ RecordFieldId() [2/4]

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

Construct it from a field name.

Definition at line 123 of file RecordFieldId.h.

References byName_p, fieldName(), name_p, number_p, and casacore::True.

◆ RecordFieldId() [3/4]

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

Definition at line 129 of file RecordFieldId.h.

References byName_p, fieldName(), name_p, number_p, and casacore::True.

◆ RecordFieldId() [4/4]

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

Definition at line 135 of file RecordFieldId.h.

References byName_p, fieldName(), name_p, number_p, and casacore::True.

Member Function Documentation

◆ byName()

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

Is the id given by name?

Definition at line 151 of file RecordFieldId.h.

References byName_p.

◆ fieldName()

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

Get the field name.

Definition at line 146 of file RecordFieldId.h.

References name_p.

Referenced by RecordFieldId(), RecordFieldId(), and RecordFieldId().

◆ fieldNumber()

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

Get the field number.

Definition at line 141 of file RecordFieldId.h.

References number_p.

Referenced by RecordFieldId().

Member Data Documentation

◆ byName_p

Bool casacore::RecordFieldId::byName_p
private

Definition at line 111 of file RecordFieldId.h.

Referenced by byName(), RecordFieldId(), RecordFieldId(), RecordFieldId(), and RecordFieldId().

◆ name_p

String casacore::RecordFieldId::name_p
private

Definition at line 113 of file RecordFieldId.h.

Referenced by fieldName(), RecordFieldId(), RecordFieldId(), and RecordFieldId().

◆ number_p

Int casacore::RecordFieldId::number_p
private

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