Loading isis/src/core/src/LabelTranslationManager.cpp→isis/src/base/objs/LabelTranslationManager/LabelTranslationManager.cpp +0 −0 File moved. View file isis/src/core/include/LabelTranslationManager.h→isis/src/base/objs/LabelTranslationManager/LabelTranslationManager.h +0 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,6 @@ find files of those names at the top level of this repository. **/ #include <fstream> #include "FileName.h" #include "PvlTokenizer.h" #include "PvlTranslationTable.h" namespace Isis { Loading isis/src/base/objs/LabelTranslationManager/LabelTranslationManager.truth 0 → 100644 +59 −0 Original line number Diff line number Diff line Testing LabelTranslationManager object Testing Translate method: Translating Extra: Test Input, Index 0 Testing Auto method: Object = IsisCube Object = BandBin BandName = "Test Input, Index 0" End_Object Group = Dimensions NumberOfLines = "Test Input, Index 0" NumberOfBands = "Test Input, Index 0" End_Group End_Object Group = Mapping CenterLongitude = "Test Input, Index 0" End_Group End Testing parseSpecification method: att@name|value Testing parseSpecification method: tag@name|value Testing parseSpecification method: att@name Testing parseSpecification method: new@name Testing parseSpecification method: name|value Testing parseSpecification method: value Testing parseSpecification method: namespace:name Testing parseSpecification method: namespace:name|value Testing parseSpecification method: att@namespace:name|value Testing parseSpecification method: tag@name|value Testing parseSpecification method: att|name|value **PROGRAMMER ERROR** Malformed dependency specification [att|name|value]. **PROGRAMMER ERROR** [att|name|value] has unexpected number of '@' or '|' delimiters. Testing parseSpecification method: att@name@value **PROGRAMMER ERROR** Malformed dependency specification [att@name@value]. **PROGRAMMER ERROR** [att@name@value] has unexpected number of '@' or '|' delimiters. Testing parseSpecification method: not@name|value **PROGRAMMER ERROR** Malformed dependency specification [not@name|value]. **PROGRAMMER ERROR** Dependency type specification [not] is invalid. Valid types are [att], [tag] and [new]. Testing parseSpecification method: att@name|value1|value2 **PROGRAMMER ERROR** Malformed dependency specification [att@name|value1|value2]. **PROGRAMMER ERROR** Malformed dependency specification [att@name|value1|value2]. isis/src/base/objs/LabelTranslationManager/Makefile 0 → 100644 +7 −0 Original line number Diff line number Diff line ifeq ($(ISISROOT), $(BLANK)) .SILENT: error: echo "Please set ISISROOT"; else include $(ISISROOT)/make/isismake.objs endif No newline at end of file isis/src/base/objs/LabelTranslationManager/unitTest.cpp 0 → 100644 +191 −0 Original line number Diff line number Diff line #include <sstream> #include "LabelTranslationManager.h" #include "Preference.h" #include "IException.h" #include "IString.h" #include "Preference.h" using namespace Isis; using namespace std; /** * Child class of LabelTranslationManager to implement pure virtual methods. * * @author 2017-01-11 Jeannie Backer * * @internal * @history 2017-01-11 Jeannie Backer - Original Version. Fixes #4584. * @history 2017-10-16 Kristin Berry - Updated for changes to dependency specification format and * the addition of xml namspaces. References #5202 */ class TestTranslationManager : public LabelTranslationManager { public: TestTranslationManager(const QString &transFile) : LabelTranslationManager() { AddTable(transFile); } TestTranslationManager(std::istream &transStrm) : LabelTranslationManager() { AddTable(transStrm); } ~TestTranslationManager() { } virtual QString Translate(QString nName, int findex = 0) { QString inputValue = "Test Input, Index " + toString(findex); return PvlTranslationTable::Translate(nName, inputValue); } }; int main(void) { Preference::Preferences(true); stringstream trnsStrm; trnsStrm << "Group = NumberOfLines" << endl; trnsStrm << " Auto" << endl; trnsStrm << " OutputName = Lines" << endl; trnsStrm << " OutputPosition = (\"Object\",\"IsisCube\","; trnsStrm << "\"Group\",\"Dimensions\")" << endl; trnsStrm << " InputPosition = (Image,Size)" << endl; trnsStrm << " InputKey = NL" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "Group = NumberOfBands" << endl; trnsStrm << " Auto" << endl; trnsStrm << " Optional" << endl; trnsStrm << " OutputName = Bands" << endl; trnsStrm << " OutputPosition = (\"Object\",\"IsisCube\","; trnsStrm << "\"Group\",\"Dimensions\")" << endl; trnsStrm << " InputPosition = (Image,Size)" << endl; trnsStrm << " InputKey = Nb" << endl; trnsStrm << " InputDefault = 1" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "Group = Bonus" << endl; trnsStrm << " Auto" << endl; trnsStrm << " Optional" << endl; trnsStrm << " InputPosition = (Image,Pixel)" << endl; trnsStrm << " InputKey = Bonus" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "Group = Extra" << endl; trnsStrm << " Optional" << endl; trnsStrm << " InputPosition = (Image,Bogus)" << endl; trnsStrm << " InputKey = Extra" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "Group = PixelResolution" << endl; trnsStrm << " InputPosition = (Image,Pixel)" << endl; trnsStrm << " InputKey = Resolution" << endl; trnsStrm << " InputDefault = 1" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "Group = BandName" << endl; trnsStrm << " Auto" << endl; trnsStrm << " OutputName = Band" << endl; trnsStrm << " OutputPosition = (\"Object\",\"IsisCube\","; trnsStrm << "\"Object\",\"BandBin\")" << endl; trnsStrm << " InputPosition = (Image,BandInfo)" << endl; trnsStrm << " InputKey = Band" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "Group = CenterLongitude" << endl; trnsStrm << " Auto" << endl; trnsStrm << " OutputPosition = (\"Group\",\"Mapping\")" << endl; trnsStrm << " OutputName = CenterLongitude" << endl; trnsStrm << " InputPosition = IMAGE_MAP_PROJECTION" << endl; trnsStrm << " InputPosition = (QUBE,IMAGE_MAP_PROJECTION)" << endl; trnsStrm << " InputPosition = (SPECTRAL_QUBE,IMAGE_MAP_PROJECTION)" << endl; trnsStrm << " InputKey = CENTER_LONGITUDE" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "End" << endl; TestTranslationManager transMgr(trnsStrm); try { cout << "Testing LabelTranslationManager object" << endl; cout << endl << "Testing Translate method:" << endl; cout << endl << "Translating Extra: "; cout << transMgr.Translate("Extra") << endl; cout << endl << "Testing Auto method:" << endl; Pvl translatedLabel; transMgr.Auto(translatedLabel); cout << endl << translatedLabel << endl; } catch(IException &e) { e.print(); } try { cout << endl << "Testing parseSpecification method: att@name|value" << endl; transMgr.parseSpecification((QString)"att@name:value"); cout << endl << "Testing parseSpecification method: tag@name|value" << endl; transMgr.parseSpecification((QString)"tag@name|value"); cout << endl << "Testing parseSpecification method: att@name" << endl; transMgr.parseSpecification((QString)"att@name"); cout << endl << "Testing parseSpecification method: new@name" << endl; transMgr.parseSpecification((QString)"new@name"); cout << endl << "Testing parseSpecification method: name|value" << endl; transMgr.parseSpecification((QString)"name|value"); cout << endl << "Testing parseSpecification method: value" << endl; transMgr.parseSpecification((QString)"value"); cout << endl << "Testing parseSpecification method: namespace:name" << endl; transMgr.parseSpecification((QString)"namespace:name"); cout << endl << "Testing parseSpecification method: namespace:name|value" << endl; transMgr.parseSpecification((QString)"namespace:name|value"); cout << endl << "Testing parseSpecification method: att@namespace:name|value" << endl; transMgr.parseSpecification((QString)"att@namepsace:name|value"); cout << endl << "Testing parseSpecification method: tag@name|value" << endl; transMgr.parseSpecification((QString)"tag@namespace:name|value"); } catch(IException &e) { e.print(); } try { cout << endl << "Testing parseSpecification method: att|name|value" << endl; transMgr.parseSpecification((QString)"att|name|value"); } catch(IException &e) { e.print(); } try { cout << endl << "Testing parseSpecification method: att@name@value" << endl; transMgr.parseSpecification((QString)"att@name@value"); } catch(IException &e) { e.print(); } try { cout << endl << "Testing parseSpecification method: not@name|value" << endl; transMgr.parseSpecification((QString)"not@name|value"); } catch(IException &e) { e.print(); } try { cout << endl << "Testing parseSpecification method: att@name|value1|value2" << endl; transMgr.parseSpecification((QString)"att@name|value1|value2"); } catch(IException &e) { e.print(); } return 0; } Loading
isis/src/core/src/LabelTranslationManager.cpp→isis/src/base/objs/LabelTranslationManager/LabelTranslationManager.cpp +0 −0 File moved. View file
isis/src/core/include/LabelTranslationManager.h→isis/src/base/objs/LabelTranslationManager/LabelTranslationManager.h +0 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,6 @@ find files of those names at the top level of this repository. **/ #include <fstream> #include "FileName.h" #include "PvlTokenizer.h" #include "PvlTranslationTable.h" namespace Isis { Loading
isis/src/base/objs/LabelTranslationManager/LabelTranslationManager.truth 0 → 100644 +59 −0 Original line number Diff line number Diff line Testing LabelTranslationManager object Testing Translate method: Translating Extra: Test Input, Index 0 Testing Auto method: Object = IsisCube Object = BandBin BandName = "Test Input, Index 0" End_Object Group = Dimensions NumberOfLines = "Test Input, Index 0" NumberOfBands = "Test Input, Index 0" End_Group End_Object Group = Mapping CenterLongitude = "Test Input, Index 0" End_Group End Testing parseSpecification method: att@name|value Testing parseSpecification method: tag@name|value Testing parseSpecification method: att@name Testing parseSpecification method: new@name Testing parseSpecification method: name|value Testing parseSpecification method: value Testing parseSpecification method: namespace:name Testing parseSpecification method: namespace:name|value Testing parseSpecification method: att@namespace:name|value Testing parseSpecification method: tag@name|value Testing parseSpecification method: att|name|value **PROGRAMMER ERROR** Malformed dependency specification [att|name|value]. **PROGRAMMER ERROR** [att|name|value] has unexpected number of '@' or '|' delimiters. Testing parseSpecification method: att@name@value **PROGRAMMER ERROR** Malformed dependency specification [att@name@value]. **PROGRAMMER ERROR** [att@name@value] has unexpected number of '@' or '|' delimiters. Testing parseSpecification method: not@name|value **PROGRAMMER ERROR** Malformed dependency specification [not@name|value]. **PROGRAMMER ERROR** Dependency type specification [not] is invalid. Valid types are [att], [tag] and [new]. Testing parseSpecification method: att@name|value1|value2 **PROGRAMMER ERROR** Malformed dependency specification [att@name|value1|value2]. **PROGRAMMER ERROR** Malformed dependency specification [att@name|value1|value2].
isis/src/base/objs/LabelTranslationManager/Makefile 0 → 100644 +7 −0 Original line number Diff line number Diff line ifeq ($(ISISROOT), $(BLANK)) .SILENT: error: echo "Please set ISISROOT"; else include $(ISISROOT)/make/isismake.objs endif No newline at end of file
isis/src/base/objs/LabelTranslationManager/unitTest.cpp 0 → 100644 +191 −0 Original line number Diff line number Diff line #include <sstream> #include "LabelTranslationManager.h" #include "Preference.h" #include "IException.h" #include "IString.h" #include "Preference.h" using namespace Isis; using namespace std; /** * Child class of LabelTranslationManager to implement pure virtual methods. * * @author 2017-01-11 Jeannie Backer * * @internal * @history 2017-01-11 Jeannie Backer - Original Version. Fixes #4584. * @history 2017-10-16 Kristin Berry - Updated for changes to dependency specification format and * the addition of xml namspaces. References #5202 */ class TestTranslationManager : public LabelTranslationManager { public: TestTranslationManager(const QString &transFile) : LabelTranslationManager() { AddTable(transFile); } TestTranslationManager(std::istream &transStrm) : LabelTranslationManager() { AddTable(transStrm); } ~TestTranslationManager() { } virtual QString Translate(QString nName, int findex = 0) { QString inputValue = "Test Input, Index " + toString(findex); return PvlTranslationTable::Translate(nName, inputValue); } }; int main(void) { Preference::Preferences(true); stringstream trnsStrm; trnsStrm << "Group = NumberOfLines" << endl; trnsStrm << " Auto" << endl; trnsStrm << " OutputName = Lines" << endl; trnsStrm << " OutputPosition = (\"Object\",\"IsisCube\","; trnsStrm << "\"Group\",\"Dimensions\")" << endl; trnsStrm << " InputPosition = (Image,Size)" << endl; trnsStrm << " InputKey = NL" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "Group = NumberOfBands" << endl; trnsStrm << " Auto" << endl; trnsStrm << " Optional" << endl; trnsStrm << " OutputName = Bands" << endl; trnsStrm << " OutputPosition = (\"Object\",\"IsisCube\","; trnsStrm << "\"Group\",\"Dimensions\")" << endl; trnsStrm << " InputPosition = (Image,Size)" << endl; trnsStrm << " InputKey = Nb" << endl; trnsStrm << " InputDefault = 1" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "Group = Bonus" << endl; trnsStrm << " Auto" << endl; trnsStrm << " Optional" << endl; trnsStrm << " InputPosition = (Image,Pixel)" << endl; trnsStrm << " InputKey = Bonus" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "Group = Extra" << endl; trnsStrm << " Optional" << endl; trnsStrm << " InputPosition = (Image,Bogus)" << endl; trnsStrm << " InputKey = Extra" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "Group = PixelResolution" << endl; trnsStrm << " InputPosition = (Image,Pixel)" << endl; trnsStrm << " InputKey = Resolution" << endl; trnsStrm << " InputDefault = 1" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "Group = BandName" << endl; trnsStrm << " Auto" << endl; trnsStrm << " OutputName = Band" << endl; trnsStrm << " OutputPosition = (\"Object\",\"IsisCube\","; trnsStrm << "\"Object\",\"BandBin\")" << endl; trnsStrm << " InputPosition = (Image,BandInfo)" << endl; trnsStrm << " InputKey = Band" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "Group = CenterLongitude" << endl; trnsStrm << " Auto" << endl; trnsStrm << " OutputPosition = (\"Group\",\"Mapping\")" << endl; trnsStrm << " OutputName = CenterLongitude" << endl; trnsStrm << " InputPosition = IMAGE_MAP_PROJECTION" << endl; trnsStrm << " InputPosition = (QUBE,IMAGE_MAP_PROJECTION)" << endl; trnsStrm << " InputPosition = (SPECTRAL_QUBE,IMAGE_MAP_PROJECTION)" << endl; trnsStrm << " InputKey = CENTER_LONGITUDE" << endl; trnsStrm << " Translation = (*,*)" << endl; trnsStrm << "EndGroup" << endl; trnsStrm << "End" << endl; TestTranslationManager transMgr(trnsStrm); try { cout << "Testing LabelTranslationManager object" << endl; cout << endl << "Testing Translate method:" << endl; cout << endl << "Translating Extra: "; cout << transMgr.Translate("Extra") << endl; cout << endl << "Testing Auto method:" << endl; Pvl translatedLabel; transMgr.Auto(translatedLabel); cout << endl << translatedLabel << endl; } catch(IException &e) { e.print(); } try { cout << endl << "Testing parseSpecification method: att@name|value" << endl; transMgr.parseSpecification((QString)"att@name:value"); cout << endl << "Testing parseSpecification method: tag@name|value" << endl; transMgr.parseSpecification((QString)"tag@name|value"); cout << endl << "Testing parseSpecification method: att@name" << endl; transMgr.parseSpecification((QString)"att@name"); cout << endl << "Testing parseSpecification method: new@name" << endl; transMgr.parseSpecification((QString)"new@name"); cout << endl << "Testing parseSpecification method: name|value" << endl; transMgr.parseSpecification((QString)"name|value"); cout << endl << "Testing parseSpecification method: value" << endl; transMgr.parseSpecification((QString)"value"); cout << endl << "Testing parseSpecification method: namespace:name" << endl; transMgr.parseSpecification((QString)"namespace:name"); cout << endl << "Testing parseSpecification method: namespace:name|value" << endl; transMgr.parseSpecification((QString)"namespace:name|value"); cout << endl << "Testing parseSpecification method: att@namespace:name|value" << endl; transMgr.parseSpecification((QString)"att@namepsace:name|value"); cout << endl << "Testing parseSpecification method: tag@name|value" << endl; transMgr.parseSpecification((QString)"tag@namespace:name|value"); } catch(IException &e) { e.print(); } try { cout << endl << "Testing parseSpecification method: att|name|value" << endl; transMgr.parseSpecification((QString)"att|name|value"); } catch(IException &e) { e.print(); } try { cout << endl << "Testing parseSpecification method: att@name@value" << endl; transMgr.parseSpecification((QString)"att@name@value"); } catch(IException &e) { e.print(); } try { cout << endl << "Testing parseSpecification method: not@name|value" << endl; transMgr.parseSpecification((QString)"not@name|value"); } catch(IException &e) { e.print(); } try { cout << endl << "Testing parseSpecification method: att@name|value1|value2" << endl; transMgr.parseSpecification((QString)"att@name|value1|value2"); } catch(IException &e) { e.print(); } return 0; }