Isis 3.0 Object Programmers' Reference |
Home |
Internalizes a translation table. More...
#include <PvlTranslationTable.h>
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 | |
Pvl & | TranslationTable () |
const Pvl & | TranslationTable () const |
bool | IsAuto (const QString nName) |
bool | IsOptional (const QString nName) |
PvlKeyword & | OutputPosition (const QString nName) |
QString | OutputName (const QString nName) |
Private Attributes | |
Pvl | p_trnsTbl |
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:
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.
Definition at line 125 of file PvlTranslationTable.h.
Isis::PvlTranslationTable::PvlTranslationTable | ( | Isis::FileName | transFile | ) |
Constructs and initializes a PvlTranslationTable object.
transFile | The translation file to be used |
iException::Io |
Definition at line 42 of file PvlTranslationTable.cpp.
Isis::PvlTranslationTable::PvlTranslationTable | ( | std::istream & | istr | ) |
Constructs and initializes a PvlTranslationTable object.
istr | The 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.
|
inline |
Destroys the PvlTranslationTable object.
Definition at line 134 of file PvlTranslationTable.h.
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.
transStm | The 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.
transFile | The name of the translation file to be added. |
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.
nName | The output name to be used to search the translation table. |
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.
nName | The output name to be used to search the translation table. |
inst | The occurence number of the "InputGroup" keyword (first one is zero) |
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.
nName | The output name to be used to search the translation table. |
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.
nName | The output name to be used to search the translation table. |
fValue | The input value to be translated |
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().