USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::PvlTranslationManager Class Reference

Allows applications to translate simple text files. More...

#include <PvlTranslationManager.h>

Inheritance diagram for Isis::PvlTranslationManager:
Inheritance graph
Collaboration diagram for Isis::PvlTranslationManager:
Collaboration graph

Public Member Functions

 PvlTranslationManager (const QString &transFile)
 
 PvlTranslationManager (Isis::Pvl &inputLabel, const QString &transFile)
 Constructs and initializes a TranslationManager object.
 
 PvlTranslationManager (Isis::Pvl &inputLabel, std::istream &transStrm)
 Constructs and initializes a TranslationManager object.
 
 ~PvlTranslationManager ()
 Destroys the TranslationManager object.
 
QString Translate (QString nName, int findex=0)
 Returns a translated value.
 
void Auto (Isis::Pvl &outputLabel)
 
const PvlKeywordInputKeyword (const QString nName) const
 Returns the ith input value assiciated with the output name argument.
 
bool InputHasKeyword (const QString nName)
 Indicates if the input keyword corresponding to the output name exists in the label.
 
void SetLabel (Isis::Pvl &lab)
 
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 Member Functions

Isis::PvlKeyword DoTranslation (const QString nName)
 Translate the requested output name to output values using the input name and values or default value.
 
const Isis::PvlContainerGetContainer (const PvlKeyword &inputGroup) const
 
Isis::PvlContainerCreateContainer (const QString nName, Isis::Pvl &pvl)
 

Private Attributes

Isis::Pvl p_fLabel
 A Pvl object for the input label file.
 

Detailed Description

Allows applications to translate simple text files.

This class allows the translation of text files which can be parsed by the Pvl class.

Author
2003-05-29 Stuart Sides
History:

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

2003-09-25 Stuart Sides - Added the Translate member

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

2006-08-09 Brendan George - Modified to support Optional keyword translation

2006-10-01 Stuart Sides - Fixed bug with Optional keyword. Non-optional keywords were being reported instantly.

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

2007-06-22 Stuart Sides - Added ability to have more than one input location keyword for a translation. The first one found which contains the input keyword is used.

2008-05-09 Steven Lambright - Added ability to change input label without re-reading the translation file.

2008-07-10 Noah Hilt - Changed while loops to continue searching other groups if a group has been found, but the keyword does not exist in that group.

2008-07-10 Steven Lambright - Changed to use new accessors

2010-01-04 Steven Lambright - Added InputKeyword method and removed InputSize, InputUnits, InputValue. Renamed private Translate method to DoTranslation to remove ambiguity with a parent method, instead of using a dummy parameter.

Todo:
2005-02-15 Stuart Sides - add coded example and implementation example to class documentation, and finish documentation

Definition at line 75 of file PvlTranslationManager.h.

Constructor & Destructor Documentation

Isis::PvlTranslationManager::PvlTranslationManager ( Isis::Pvl inputLabel,
const QString &  transFile 
)

Constructs and initializes a TranslationManager object.

Parameters
inputLabelThe Pvl holding the input label.
transFileThe translation file to be used to tranlate keywords in the input label.

Definition at line 43 of file PvlTranslationManager.cpp.

Isis::PvlTranslationManager::PvlTranslationManager ( Isis::Pvl inputLabel,
std::istream &  transStrm 
)

Constructs and initializes a TranslationManager object.

Parameters
inputLabelThe Pvl holding the input label.
transStrmA stream containing the tranlation table to be used to tranlate keywords in the input label.

Definition at line 59 of file PvlTranslationManager.cpp.

Isis::PvlTranslationManager::~PvlTranslationManager ( )
inline

Destroys the TranslationManager object.

Definition at line 86 of file PvlTranslationManager.h.

Member Function Documentation

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

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)
inherited

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.

Isis::PvlKeyword Isis::PvlTranslationManager::DoTranslation ( const QString  nName)
private

Translate the requested output name to output values using the input name and values or default value.

Parameters
nNameThe output name used to identify the input keyword to be translated.
Returns
Isis::PvlKeyword

Definition at line 108 of file PvlTranslationManager.cpp.

References Isis::PvlKeyword::addValue(), Isis::PvlContainer::hasKeyword(), Isis::PvlKeyword::setName(), and Isis::PvlTranslationTable::Translate().

QString Isis::PvlTranslationTable::InputDefault ( const QString  nName) const
inherited

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
inherited

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

bool Isis::PvlTranslationManager::InputHasKeyword ( const QString  nName)

Indicates if the input keyword corresponding to the output name exists in the label.

Parameters
nNameThe output name used to identify the input keyword.

Definition at line 217 of file PvlTranslationManager.cpp.

References Isis::PvlContainer::hasKeyword().

Referenced by Isis::ProcessImportPds::ExtractPdsProjection(), Isis::ProcessImportPds::IdentifySource(), Isis::ProcessImportPds::ProcessLabel(), Isis::ProcessImportPds::ProcessSpecialPixels(), and Isis::ProcessImportPds::TranslatePdsProjection().

const PvlKeyword & Isis::PvlTranslationManager::InputKeyword ( const QString  nName) const

Returns the ith input value assiciated with the output name argument.

Parameters
nNameThe output name used to identify the input keyword.
findexThe index into the input keyword array. Defaults to 0
Exceptions
Isis::IException::Programmer

Definition at line 169 of file PvlTranslationManager.cpp.

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

Referenced by Isis::ProcessImportPds::ExtractPdsProjection(), Isis::ProcessImportPds::ProcessDataFilePointer(), and Isis::ProcessImportPds::ProcessPdsQubeLabel().

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

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::PvlTranslationManager::Translate ( QString  nName,
int  findex = 0 
)

Returns a translated value.

The output name is used to find the input group, keyword, default and tranlations in the translation table. If the keyword does not exist in the input label, the input default if available will be used as the input value. This input value is then used to search all of the translations. If a match is found the translated value is returned.

Parameters
nNameThe output name used to identify the input keyword to be translated.
findexThe index into the input keyword array. Defaults to 0
Returns
string

Definition at line 82 of file PvlTranslationManager.cpp.

References Isis::PvlContainer::hasKeyword(), and Isis::PvlTranslationTable::Translate().

Referenced by Isis::NaifStatus::CheckErrors(), Isis::ProcessImportPds::ExtractPdsProjection(), Isis::ObservationNumber::FindObservationTranslation(), Isis::SerialNumber::FindSerialTranslation(), Isis::ProcessImportPds::ProcessDataFilePointer(), Isis::ProcessImportPds::ProcessLabel(), Isis::ProcessImportPds::ProcessPdsImageLabel(), Isis::ProcessImportPds::ProcessPdsM3Label(), Isis::ProcessImportPds::ProcessPixelBitandType(), and Isis::ProcessImportPds::ProcessSpecialPixels().

QString Isis::PvlTranslationTable::Translate ( const QString  nName,
const QString  fValue = "" 
) const
inherited

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 DoTranslation(), and Translate().

Member Data Documentation

Isis::Pvl Isis::PvlTranslationManager::p_fLabel
private

A Pvl object for the input label file.

Definition at line 106 of file PvlTranslationManager.h.


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