USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::PvlTranslationTable Class Reference

Internalizes a translation table. More...

#include <PvlTranslationTable.h>

Inheritance diagram for Isis::PvlTranslationTable:
Inheritance graph
Collaboration diagram for Isis::PvlTranslationTable:
Collaboration graph

Public Member Functions

 PvlTranslationTable (Isis::FileName transFile)
 Constructs and initializes a PvlTranslationTable object.
 
 PvlTranslationTable (std::istream &istr)
 Constructs and initializes a PvlTranslationTable object.
 
 PvlTranslationTable ()
 Construct an empty PvlTranslationTable.
 
 ~PvlTranslationTable ()
 Destroys the PvlTranslationTable object.
 
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.
 
QString InputKeywordName (const QString nName) const
 Returns the input keyword name from the translation table corresponding to the output name argument.
 
QString InputDefault (const QString nName) const
 Returns the input default value from the translation table corresponding to the output name argument.
 
QString Translate (const QString nName, const QString fValue="") const
 Translates the output name and input value.
 
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.
 
void AddTable (const QString &transFile)
 Adds the contents of a translation table to the searchable groups/keys.
 

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)
 

Private Attributes

Pvl p_trnsTbl
 

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
History:

2003-09-03 Stuart Sides - Modified to work with new isis label format

2005-02-15 Elizabeth Ribelin - Modified file to support Doxygen documentation

2005-09-08 Stuart Sides - Modified Translate member to handle translating any input value i.e., "*" to a specific output value (Thanks Kris Beckeer)

2006-11-16 Brendan George - Changed instances of "Foreign" to "Input" and "Native" to "Output"

2007-06-22 Stuart Sides - Added instance parameter to InputGroup member

2006-12-05 Brendan George - Changed OutputPosition keyword to be case insensitive, and added verification to the AddTable method so that Translation Tables are verified when read in

2008-07-10 Steven Lambright - Made trnsTbl member into a non-pointer

2010-01-04 Steven Lambright - Now using files instead of streams where possible to improve errors and added code that checks the integrity of translation files. Also now looking for "InputPosition" keyword instead of "InputGroup." The InputGroup method (which needs renamed later) now returns a PvlKeyword.

History:
2006-08-09 Brendan George - Added IsOptional function as part of support for Optional keyword translations
Todo:
2005-02-15 Stuart Sides - add coded and implementation example to class documentation and finish documentation for protected methods and variable

Definition at line 125 of file PvlTranslationTable.h.

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

Definition at line 42 of file PvlTranslationTable.cpp.

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

Constructs and initializes a PvlTranslationTable object.

Parameters
istrThe translation stream to be used to translate values

Definition at line 51 of file PvlTranslationTable.cpp.

Isis::PvlTranslationTable::PvlTranslationTable ( )

Construct an empty PvlTranslationTable.

Definition at line 56 of file PvlTranslationTable.cpp.

Isis::PvlTranslationTable::~PvlTranslationTable ( )
inline

Destroys the PvlTranslationTable object.

Definition at line 134 of file PvlTranslationTable.h.

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.

Definition at line 77 of file PvlTranslationTable.cpp.

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

Definition at line 66 of file PvlTranslationTable.cpp.

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

Definition at line 335 of file PvlTranslationTable.cpp.

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

Definition at line 235 of file PvlTranslationTable.cpp.

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

Definition at line 311 of file PvlTranslationTable.cpp.

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

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

Definition at line 168 of file PvlTranslationTable.cpp.

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

Referenced by Isis::PvlTranslationManager::DoTranslation(), and Isis::PvlTranslationManager::Translate().


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