Isis 3.0
Home
Isis::PvlTranslationTable Class Reference

Internalizes a translation table. More...

#include <PvlTranslationTable.h>

Inherited by Isis::PvlTranslationManager.

Public Member Functions

 PvlTranslationTable (Isis::FileName transFile)
 Constructs and initializes a PvlTranslationTable object. More...
 
 PvlTranslationTable (std::istream &istr)
 Constructs and initializes a PvlTranslationTable object. More...
 
 PvlTranslationTable ()
 Construct an empty PvlTranslationTable. More...
 
 ~PvlTranslationTable ()
 Destroys the PvlTranslationTable object. More...
 
PvlKeyword InputGroup (const QString nName, const int inst=0) const
 Returns the input group name from the translation table corresponding to the output name argument. More...
 
QString InputKeywordName (const QString nName) const
 Returns the input keyword name from the translation table corresponding to the output name argument. More...
 
QString InputDefault (const QString nName) const
 Returns the input default value from the translation table corresponding to the output name argument. More...
 
QString Translate (const QString nName, const QString fValue="") const
 Translates the output name and input value. More...
 
void AddTable (std::istream &transStm)
 Adds the contents of a translation table to the searchable groups/keys Also performs a verification, to ensure that the translation table is valid. More...
 
void AddTable (const QString &transFile)
 Adds the contents of a translation table to the searchable groups/keys. More...
 

Protected Member Functions

PvlTranslationTable ()
 
const PvlTranslationTable () const
 
bool IsAuto (const QString nName)
 
bool IsOptional (const QString nName)
 
PvlKeywordOutputPosition (const QString nName)
 
QString OutputName (const QString nName)
 

Detailed Description

Internalizes a translation table.

This class internalizes an Isis translation table and provides group/key searches and value translations. The group names listed are the output names used by applications to get the input names and values. There is only one level of groups and groups are not allowed to be nested. The Group names can NOT be repeated. OutputGroup is a comma delimited list of objects and/or groups in the input label. Traversing this list within the input label will lead to the correct level to find the input keyword. OutputKey is the keyword within the group which holds the information. OutputDefault is the value used if there is no value for the keyword. Translation is the output and corresponding input values. Translation may be repeated as needed. An example piece of a tranlation file:

* Group = DataStart
* OutputKey = ^IMAGE
* OutputDefault = 1
* Translation = (*,*)
* EndGroup
* Group = DataFileRecordBytes
* OutputKey = RECORD_BYTES
* Translation = (*,*)
* EndGroup
* Group = CoreSamples
* OutputGroup = IMAGE
* OutputKey = LINE_SAMPLES
* Translation = (*,*)
* EndGroup
* Group = CorePixelType
* OutputGroup = IMAGE
* OutputKey = SAMPLE_TYPE
* OutputDefault = LSB_INTEGER
* Translation = (Integer,LSB_INTEGER)
* Translation = (Integer,MSB_INTEGER)
* Translation = (Integer,PC_INTEGER)
* Translation = (Integer,MAC_INTEGER)
* Translation = (Integer,SUN_INTEGER)
* Translation = (Integer,VAX_INTEGER)
* Translation = (Natural,UNSIGNED_INTEGER)
* Translation = (Natural,LSB_UNSIGNED_INTEGER)
* Translation = (Natural,MSB_UNSIGNED_INTEGER)
* EndGroup
* Group = CoreOrganization
* OutputGroup = IMAGE
* OutputKey = BAND_STORAGE_TYPE
* OutputDefault = BAND_SEQUENTIAL
* Translation = (BSQ,BAND_SEQUENTIAL)
* Translation = (BIL,LINE_INTERLEAVED)
* Translation = (BIP,SAMPLE_INTERLEAVED)
* EndGroup
* End
*
Author
2003-05-01 Stuart Sides

Constructor & Destructor Documentation

Isis::PvlTranslationTable::PvlTranslationTable ( Isis::FileName  transFile)

Constructs and initializes a PvlTranslationTable object.

Parameters
transFileThe translation file to be used
Exceptions
iException::Io

References Isis::FileName::expanded().

Isis::PvlTranslationTable::PvlTranslationTable ( std::istream &  istr)

Constructs and initializes a PvlTranslationTable object.

Parameters
istrThe translation stream to be used to translate values
Isis::PvlTranslationTable::PvlTranslationTable ( )

Construct an empty PvlTranslationTable.

Isis::PvlTranslationTable::~PvlTranslationTable ( )
inline

Destroys the PvlTranslationTable object.

Member Function Documentation

void Isis::PvlTranslationTable::AddTable ( std::istream &  transStm)

Adds the contents of a translation table to the searchable groups/keys Also performs a verification, to ensure that the translation table is valid.

Parameters
transStmThe stream to be added.

References _FILEINFO_, Isis::PvlContainer::hasKeyword(), Isis::PvlContainer::keywords(), Isis::PvlContainer::name(), Isis::PvlKeyword::name(), and Isis::PvlKeyword::size().

void Isis::PvlTranslationTable::AddTable ( const QString &  transFile)

Adds the contents of a translation table to the searchable groups/keys.

Parameters
transFileThe name of the translation file to be added.
Exceptions
IException::Io
QString Isis::PvlTranslationTable::InputDefault ( const QString  nName) const

Returns the input default value from the translation table corresponding to the output name argument.

Parameters
nNameThe output name to be used to search the translation table.
Returns
QString The input default value
Exceptions
iException::Programmer

References _FILEINFO_, Isis::PvlContainer::fileName(), and Isis::PvlContainer::hasKeyword().

PvlKeyword Isis::PvlTranslationTable::InputGroup ( const QString  nName,
const int  inst = 0 
) const

Returns the input group name from the translation table corresponding to the output name argument.

Parameters
nNameThe output name to be used to search the translation table.
instThe occurence number of the "InputGroup" keyword (first one is zero)
Returns
QString The input group name
Exceptions
iException::Programmer

References _FILEINFO_, Isis::PvlContainer::begin(), Isis::PvlContainer::end(), Isis::PvlContainer::findKeyword(), and Isis::PvlKeyword::size().

QString Isis::PvlTranslationTable::InputKeywordName ( const QString  nName) const

Returns the input keyword name from the translation table corresponding to the output name argument.

Parameters
nNameThe output name to be used to search the translation table.
Returns
QString The input keyword name
Exceptions
iException::Programmer

References _FILEINFO_, and Isis::PvlContainer::hasKeyword().

bool Isis::PvlTranslationTable::IsAuto ( const QString  nName)
protected
bool Isis::PvlTranslationTable::IsOptional ( const QString  nName)
protected
QString Isis::PvlTranslationTable::OutputName ( const QString  nName)
protected
Isis::PvlKeyword & Isis::PvlTranslationTable::OutputPosition ( const QString  nName)
protected
QString Isis::PvlTranslationTable::Translate ( const QString  nName,
const QString  fValue = "" 
) const

Translates the output name and input value.

Parameters
nNameThe output name to be used to search the translation table.
fValueThe input value to be translated
Returns
QString The translated QString
Exceptions
iException::Programmer

References _FILEINFO_, Isis::PvlContainer::begin(), Isis::PvlContainer::end(), Isis::PvlContainer::fileName(), Isis::PvlContainer::findKeyword(), and Isis::PvlContainer::hasKeyword().

Referenced by Isis::PvlTranslationManager::Translate().

Pvl& Isis::PvlTranslationTable::TranslationTable ( )
inlineprotected
const Pvl& Isis::PvlTranslationTable::TranslationTable ( ) const
inlineprotected

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