USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::PvlTranslationTable Class Reference
[Parsing]

#include <PvlTranslationTable.h>

Inheritance diagram for Isis::PvlTranslationTable:

Inheritance graph
[legend]
Collaboration diagram for Isis::PvlTranslationTable:

Collaboration graph
[legend]
List of all members.

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

For internal use only.

History:
2003-09-03 Stuart Sides - Modified to work with new isis label format
History:
2005-02-15 Elizabeth Ribelin - Modified file to support Doxygen documentation
History:
2005-09-08 Stuart Sides - Modified Translate member to handle translating any input value i.e., "*" to a specific output value (Thanks Kris Beckeer)
History:
2006-08-09 Brendan George - Added IsOptional function as part of support for Optional keyword translations
History:
2006-11-16 Brendan George - Changed instances of "Foreign" to "Input" and "Native" to "Output"
History:
2007-06-22 Stuart Sides - Added instance parameter to InputGroup member
History:
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
History:
2008-07-10 Steven Lambright - Made trnsTbl member into a non-pointer
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 117 of file 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.
std::string InputGroup (const std::string nName, const int inst=0) const
 Returns the input group name from the translation table corresponding to the output name argument.
std::string InputKeyword (const std::string nName) const
 Returns the input keyword name from the translation table corresponding to the output name argument.
std::string InputDefault (const std::string nName) const
 Returns the input default value from the translation table corresponding to the output name argument.
std::string Translate (const std::string nName, const std::string 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 std::string &transFile)
 Adds the contents of a translation table to the searchable groups/keys.

Protected Member Functions

PvlTranslationTable ()
bool IsAuto (const std::string nName)
bool IsOptional (const std::string nName)
Isis::PvlKeywordOutputPosition (const std::string nName)
std::string OutputName (const std::string nName)

Private Attributes

Pvl p_trnsTbl


Constructor & Destructor Documentation

Isis::PvlTranslationTable::PvlTranslationTable ( Isis::Filename  transFile  ) 

Constructs and initializes a PvlTranslationTable object.

Parameters:
transFile The translation file to be used
Exceptions:
Isis::iException::Io 

Definition at line 43 of file PvlTranslationTable.cpp.

References _FILEINFO_, Isis::Filename::Expanded(), Isis::Message::FileOpen(), in, Isis::iException::Message(), and p_trnsTbl.

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

Constructs and initializes a PvlTranslationTable object.

Parameters:
istr The translation stream to be used to translate values

Definition at line 62 of file PvlTranslationTable.cpp.

References p_trnsTbl.

Isis::PvlTranslationTable::PvlTranslationTable (  ) 

Construct an empty PvlTranslationTable.

Definition at line 67 of file PvlTranslationTable.cpp.

Isis::PvlTranslationTable::~PvlTranslationTable (  )  [inline]

Destroys the PvlTranslationTable object.

Definition at line 126 of file PvlTranslationTable.h.


Member Function Documentation

void Isis::PvlTranslationTable::AddTable ( const std::string &  transFile  ) 

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

Parameters:
transFile The name of the translation file to be added.
Exceptions:
Isis::iException::Io 

Definition at line 77 of file PvlTranslationTable.cpp.

References _FILEINFO_, AddTable(), Isis::Filename::Expanded(), Isis::Message::FileOpen(), in, and Isis::iException::Message().

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:
transStm The stream to be added.

Definition at line 100 of file PvlTranslationTable.cpp.

References p_trnsTbl.

Referenced by AddTable(), and Isis::PvlTranslationManager::PvlTranslationManager().

string Isis::PvlTranslationTable::InputDefault ( const std::string  nName  )  const

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

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

Definition at line 272 of file PvlTranslationTable.cpp.

References _FILEINFO_, Isis::PvlContainer::Filename(), Isis::PvlObject::FindGroup(), Isis::PvlObject::HasGroup(), Isis::PvlContainer::HasKeyword(), Isis::iException::Message(), and p_trnsTbl.

string Isis::PvlTranslationTable::InputGroup ( const std::string  nName,
const int  inst = 0 
) const

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

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

Definition at line 211 of file PvlTranslationTable.cpp.

References _FILEINFO_, Isis::PvlContainer::Begin(), Isis::PvlContainer::End(), Isis::PvlContainer::Filename(), Isis::PvlObject::FindGroup(), Isis::PvlContainer::FindKeyword(), Isis::PvlObject::HasGroup(), Isis::PvlContainer::HasKeyword(), Isis::iException::Message(), Isis::PvlContainer::Name(), and p_trnsTbl.

Referenced by Isis::PvlTranslationManager::InputHasKeyword(), Isis::PvlTranslationManager::InputSize(), Isis::PvlTranslationManager::InputUnits(), Isis::PvlTranslationManager::InputValue(), and Isis::PvlTranslationManager::Translate().

string Isis::PvlTranslationTable::InputKeyword ( const std::string  nName  )  const

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

Parameters:
nName The output name to be used to search the translation table.
Returns:
string The input keyword name
Exceptions:
Isis::iException::Programmer 

Definition at line 249 of file PvlTranslationTable.cpp.

References _FILEINFO_, Isis::PvlContainer::Filename(), Isis::PvlObject::FindGroup(), Isis::PvlObject::HasGroup(), Isis::PvlContainer::HasKeyword(), Isis::iException::Message(), and p_trnsTbl.

Referenced by Isis::PvlTranslationManager::InputHasKeyword(), Isis::PvlTranslationManager::InputSize(), Isis::PvlTranslationManager::InputUnits(), Isis::PvlTranslationManager::InputValue(), and Isis::PvlTranslationManager::Translate().

string Isis::PvlTranslationTable::Translate ( const std::string  nName,
const std::string  fValue = "" 
) const

Translates the output name and input value.

Parameters:
nName The output name to be used to search the translation table.
fValue The input value to be translated
Returns:
string The translated string
Exceptions:
Isis::iException::Programmer 

Definition at line 151 of file PvlTranslationTable.cpp.

References _FILEINFO_, Isis::PvlContainer::Begin(), Isis::PvlContainer::End(), Isis::PvlContainer::Filename(), Isis::PvlObject::FindGroup(), Isis::PvlContainer::FindKeyword(), Isis::PvlObject::HasGroup(), Isis::PvlContainer::HasKeyword(), Isis::iException::Message(), and p_trnsTbl.

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


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