USGS

Isis 3.0 Object Programmers' Reference

Home

IsisAml.cpp

Go to the documentation of this file.
00001 
00023 using namespace std;
00024 
00025 #include <sstream>
00026 #include <xercesc/util/PlatformUtils.hpp>
00027 #include <xercesc/util/TransService.hpp>
00028 #include <xercesc/sax2/XMLReaderFactory.hpp>
00029 
00030 #include "iException.h"
00031 #include "IsisAml.h"
00032 #include "IsisXMLChTrans.h"
00033 #include "Filename.h"
00034 #include "iString.h"
00035 
00040 namespace XERCES = XERCES_CPP_NAMESPACE;
00041 
00048 IsisAml::IsisAml (const std::string &xmlfile) {
00049   StartParser (xmlfile.c_str());
00050 }
00051 
00055 IsisAml::~IsisAml () {
00056 }
00057 
00075 void IsisAml::PutAsString (const std::string &paramName,
00076                            const std::string &value) {
00077 
00078   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
00079 
00080   if (param->values.size () > 0) {
00081     string message = "A value for this parameter [" + paramName + "] has "
00082                      "already been entered.";
00083     throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
00084   }
00085 
00086   param->values.clear();
00087   param->values.push_back (value);
00088 
00089 }
00090 
00103 void IsisAml::PutAsString (const std::string &paramName,
00104                            const std::vector<std::string> &value) {
00105 
00106   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
00107 
00108   if (param->values.size () > 0) {
00109     string message = "A value for this parameter [" + paramName + "] has "
00110                      "already been entered.";
00111     throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
00112   }
00113 
00114   param->values.resize(value.size());
00115   param->values = value;
00116 
00117 }
00118 
00119 
00120 // Public: Sets the value member of a parameter of type string whos name
00121 // starts with paramName
00122 
00138 void IsisAml::PutString (const std::string &paramName, const std::string &value) {
00139 
00140   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
00141 
00142   if (param->type != "string") {
00143     string message = "Parameter [" + paramName + "] is not a string.";
00144     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00145   }
00146 
00147   if (param->values.size () > 0) {
00148     string message = "A value for this parameter [" + paramName + "] has "
00149                      "already been saved (possibly by IsisGui). If you need to "
00150                      "change the value use \"Clear\" before the Put.";
00151     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00152   }
00153 
00154   param->values.clear();
00155   param->values.push_back (value);
00156 
00157   Verify (param);
00158 }
00159 
00160 
00161 // Public: Sets the value member of a parameter of type string whos name
00162 // starts with paramName
00170 void IsisAml::PutString (const std::string &paramName,
00171                          const std::vector<std::string> &value) {
00172 
00173   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
00174 
00175   if (param->type != "string") {
00176     string message = "Parameter [" + paramName + "] is not a string.";
00177     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00178   }
00179 
00180   if (param->values.size () > 0) {
00181     string message = "A value for this parameter [" + paramName + "] has "
00182                      "already been saved (possibly by IsisGui). If you need to "
00183                      "change the value use \"Clear\" before the Put.";
00184     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00185   }
00186 
00187   param->values.resize(value.size());
00188   param->values = value;
00189 
00190   Verify (param);
00191 }
00192 
00193 
00194 // Public: Sets the value member of a parameter of type filename whos name
00195 // starts with paramName
00196 
00205 void IsisAml::PutFilename (const std::string &paramName,
00206                            const std::string &value) {
00207 
00208   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
00209 
00210   if ((param->type != "filename") && (param->type != "cube")) {
00211     string message = "Parameter [" + paramName + "] is not a filename.";
00212     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00213   }
00214 
00215   if (param->values.size () > 0) {
00216     string message = "A value for this parameter [" + paramName + "] has "
00217                      "already been saved (possibly by IsisGui). If you need to "
00218                      "change the value use \"Clear\" before the Put.";
00219     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00220   }
00221 
00222   param->values.clear();
00223   param->values.push_back (value);
00224 
00225   Verify (param);
00226 }
00227 
00228 
00229 // Public: Sets the value member of a parameter of type filename whos name
00230 // starts with paramName
00231 
00247 void IsisAml::PutFilename (const std::string &paramName,
00248                            const std::vector<std::string> &value) {
00249 
00250   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
00251 
00252   if ((param->type != "filename") && (param->type != "cube")) {
00253     string message = "Parameter [" + paramName + "] is not a filename.";
00254     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00255   }
00256 
00257   if (param->values.size () > 0) {
00258     string message = "A value for this parameter [" + paramName + "] has "
00259                      "already been saved (possibly by IsisGui). If you need to "
00260                      "change the value use \"Clear\" before the Put.";
00261     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00262   }
00263 
00264   param->values.resize(value.size());
00265   param->values = value;
00266 
00267   Verify (param);
00268 }
00269 
00270 
00271 // Public: Sets the value member of a parameter of type integer whos name
00272 // starts with paramName
00273 
00285 void IsisAml::PutInteger (const std::string &paramName,
00286                           const int &value) {
00287 
00288   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
00289 
00290   if (param->type != "integer") {
00291     string message = "Parameter [" + paramName + "] is not an integer.";
00292     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00293   }
00294 
00295   if (param->values.size () > 0) {
00296     string message = "A value for this parameter [" + paramName + "] has "
00297                      "already been saved (possibly by IsisGui). If you need to "
00298                      "change the value use \"Clear\" before the Put.";
00299     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00300   }
00301   
00302   param->values.clear();
00303   param->values.push_back (Isis::iString(value));
00304 
00305   Verify (param);
00306 }
00307 
00308 
00309 // Public: Sets the value member of a parameter of type integer whos name
00310 // starts with paramName
00311 
00326 void IsisAml::PutInteger (const std::string &paramName,
00327                           const std::vector<int> &value) {
00328 
00329   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
00330 
00331   if (param->type != "integer") {
00332     string message = "Parameter [" + paramName + "] is not an integer.";
00333     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00334   }
00335 
00336   if (param->values.size () > 0) {
00337     string message = "A value for this parameter [" + paramName + "] has "
00338                      "already been saved (possibly by IsisGui). If you need to "
00339                      "change the value use \"Clear\" before the Put.";
00340     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00341   }
00342 
00343   param->values.resize (value.size());
00344   for (unsigned int i = 0; i < value.size(); i++) {
00345     param->values[i] = Isis::iString(value[i]);
00346   }
00347 
00348   Verify (param);
00349 }
00350 
00351 
00352 
00353 
00354 // Public: Sets the value member of a parameter of type double whos name
00355 // starts with paramName
00371 void IsisAml::PutDouble (const std::string &paramName,
00372                          const double &value) {
00373 
00374   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
00375 
00376   if (param->type != "double") {
00377     string message = "Parameter [" + paramName + "] is not a double.";
00378     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00379   }
00380 
00381   if (param->values.size () > 0) {
00382     string message = "A value for this parameter [" + paramName + "] has "
00383                      "already been saved (possibly by IsisGui). If you need to "
00384                      "change the value use \"Clear\" before the Put.";
00385     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00386   }
00387 
00388   param->values.clear();
00389   param->values.push_back (Isis::iString(value));
00390 
00391   Verify (param);
00392 }
00393 
00394 
00395 // Public: Sets the value member of a parameter of type double whos name
00396 // starts with paramName
00412 void IsisAml::PutDouble (const std::string &paramName,
00413                          const std::vector<double> &value) {
00414 
00415   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
00416 
00417   if (param->type != "double") {
00418     string message = "Parameter [" + paramName + "] is not a double.";
00419     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00420   }
00421 
00422   if (param->values.size () > 0) {
00423     string message = "A value for this parameter [" + paramName + "] has "
00424                      "already been saved (possibly by IsisGui). If you need to "
00425                      "change the value use \"Clear\" before the Put.";
00426     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00427   }
00428 
00429   param->values.resize (value.size());
00430   for (unsigned int i = 0; i < value.size(); i++) {
00431     param->values[i] = Isis::iString(value[i]);
00432   }
00433 
00434   Verify (param);
00435 }
00436 
00437 
00438 
00439 // Public: Sets the value member of a parameter of type boolean whos name
00440 // starts with paramName
00456 void IsisAml::PutBoolean (const std::string &paramName,
00457                           const bool &value) {
00458 
00459   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
00460 
00461   if (param->type != "boolean") {
00462     string message = "Parameter [" + paramName + "] is not a boolean.";
00463     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00464   }
00465 
00466   if (param->values.size () > 0) {
00467     string message = "A value for this parameter [" + paramName + "] has "
00468                      "already been saved (possibly by IsisGui). If you need to "
00469                      "change the value use \"Clear\" before the Put.";
00470     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00471   }
00472 
00473   param->values.clear();
00474   if (value) {
00475     param->values.push_back ("YES");
00476   }
00477   else {
00478     param->values.push_back ("NO");
00479   }
00480 
00481   Verify (param);
00482 }
00483 
00484 
00485 // Public: Sets the value member of a parameter of type boolean whos name
00486 // starts with paramName
00502 void IsisAml::PutBoolean (const std::string &paramName,
00503                           const std::vector<bool> &value) {
00504 
00505   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
00506 
00507   if (param->type != "boolean") {
00508     string message = "Parameter [" + paramName + "] is not a boolean.";
00509     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00510   }
00511 
00512   if (param->values.size () > 0) {
00513     string message = "A value for this parameter [" + paramName + "] has "
00514                      "already been saved (possibly by IsisGui). If you need to "
00515                      "change the value use \"Clear\" before the Put.";
00516     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00517   }
00518 
00519   param->values.resize (value.size());
00520   for (unsigned int i = 0; i < value.size(); i++) {
00521     if (value[i]) {
00522       param->values.push_back ("YES");
00523     }
00524     else {
00525       param->values.push_back ("NO");
00526     }
00527   }
00528 
00529   Verify (param);
00530 }
00531 
00532 
00533 // Accessor methods for getting the value(s) of a parameter
00534 
00535 // Public: Returns the first element of the value member of a parameter whos
00536 // name starts with paramName as a string. Any type can be retrieve with this member.
00547 string IsisAml::GetAsString (const std::string &paramName) const {
00548 
00549   const IsisParameterData *param = ReturnParam (paramName);
00550   string value;
00551   if (param->values.size() == 0) {
00552     if (param->defaultValues.size() == 0) {
00553       string message = "Parameter [" + paramName + "] has no value.";
00554       throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00555     }
00556     else {
00557       value = param->defaultValues[0];
00558     }
00559   }
00560   else {
00561     value = param->values[0];
00562   }
00563 
00564   return value;
00565 }
00566 
00567 // Public: Returns the value member of a parameter whos name starts with paramName
00568 // as a vector<string>
00579 void IsisAml::GetAsString (const std::string &paramName,
00580                            std::vector<std::string> &values) const{
00581 
00582   const IsisParameterData *param = ReturnParam (paramName);
00583 
00584   values.clear();
00585   string value;
00586   if (param->values.size() == 0) {
00587     if (param->defaultValues.size() == 0) {
00588       string message = "Parameter [" + paramName + "] has no value.";
00589       throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
00590     }
00591     else {
00592       for (unsigned int i = 0; i<param->defaultValues.size(); i++)
00593         values.push_back (param->defaultValues[i]);
00594     }
00595   }
00596   else {
00597     for (unsigned int i = 0; i<param->values.size(); i++)
00598       values.push_back (param->values[i]);
00599   }
00600 
00601   return;
00602 }
00603 
00604 
00605 // Public: Returns the first element of the value member of a parameter whos
00606 // name starts with paramName as a string/filename
00617 string IsisAml::GetFilename (const std::string &paramName, std::string extension) const {
00618 
00619   const IsisParameterData *param = ReturnParam (paramName);
00620 
00621   if ((param->type != "filename") && (param->type != "cube")) {
00622     string message = "Parameter [" + paramName + "] is not a filename.";
00623     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00624   }
00625 
00626   string value;
00627   if (param->values.size() == 0) {
00628     if (param->defaultValues.size() == 0) {
00629       string message = "Parameter [" + paramName + "] has no value.";
00630       throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
00631     }
00632     else {
00633       value = param->defaultValues[0];
00634     }
00635   }
00636   else {
00637     value = param->values[0];
00638   }
00639 
00640   Isis::Filename name(value);
00641   if (extension != "") name.AddExtension(extension);
00642   value = name.Expanded();
00643 
00644   return value;
00645 }
00646 
00647 
00648 // Public: Returns the value member of a parameter whos name starts with paramName
00649 // as a vector<string/filename>
00657 void IsisAml::GetFilename (const std::string &paramName,
00658                            std::vector<std::string> &values) const {
00659 
00660   const IsisParameterData *param = ReturnParam (paramName);
00661 
00662   if ((param->type != "filename") && (param->type != "cube")) {
00663     string message = "Parameter [" + paramName + "] is not a filename.";
00664     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00665   }
00666 
00667   values.clear();
00668   if (param->values.size() == 0) {
00669     if (param->defaultValues.size() == 0) {
00670       string message = "Parameter [" + paramName + "] has no value.";
00671       throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
00672     }
00673     else {
00674       for (unsigned int i=0; i<param->defaultValues.size(); i++) {
00675         Isis::Filename name(param->defaultValues[i]);
00676         values.push_back (name.Expanded());
00677       }
00678     }
00679   }
00680   else {
00681     for (unsigned int i=0; i<param->values.size(); i++) {
00682       Isis::Filename name(param->values[i]);
00683       values.push_back (name.Expanded());
00684     }
00685   }
00686 
00687   return;
00688 }
00689 
00690 
00691 // Public: Returns the first element of the value member of a parameter whos
00692 // name starts with paramName as a string
00702 string IsisAml::GetString (const std::string &paramName) const {
00703 
00704   const IsisParameterData *param = ReturnParam (paramName);
00705   Isis::iString value;
00706 
00707   if (param->type != "string") {
00708     string message = "Parameter [" + paramName + "] is not a string.";
00709     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00710   }
00711 
00712   if (param->values.size() == 0) {
00713     if (param->defaultValues.size() == 0) {
00714       string message = "Parameter [" + paramName + "] has no value.";
00715       throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
00716     }
00717     else {
00718       value = param->defaultValues[0];
00719     }
00720   }
00721   else {
00722     value = param->values[0];
00723     // If there is a list of legal values return the list option that matches
00724     // or begins with what was entered rather than exactly what was entered
00725     if (param->listOptions.size () > 0) {
00726       value = value.UpCase();
00727       int found = -1;
00728       for (unsigned int p=0; p<param->listOptions.size (); p++) {
00729         Isis::iString option = param->listOptions[p].value;
00730         option = option.UpCase();
00731         if (value == option) {
00732           return value;
00733         }
00734         else if (value.compare(0, min(value.size(), option.size()),
00735                                option ,0, min(value.size(), option.size())) == 0) {
00736           if (found != -1) {
00737             string message = "Value [" + value + "] for parameter [" +
00738                              paramName + "] is not unique.";
00739             throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
00740           }
00741           found = p;
00742         }
00743       }
00744       return param->listOptions[found].value;
00745     }
00746 
00747     // Just return what is in the value
00748     else {
00749       value = param->values[0];
00750     }
00751   }
00752   return value;
00753 }
00754 
00755 
00756 // Public: Returns the value member of a parameter whos name starts with paramName
00757 // as a vector<string>
00768 void IsisAml::GetString (const std::string &paramName,
00769                          std::vector<std::string> &values) const {
00770 
00771   const IsisParameterData *param = ReturnParam (paramName);
00772 
00773   if (param->type != "string") {
00774     string message = "Parameter [" + paramName + "] is not a string.";
00775     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00776   }
00777 
00778   values.clear();
00779   string value;
00780   if (param->values.size() == 0) {
00781     if (param->defaultValues.size() == 0) {
00782       string message = "Parameter [" + paramName + "] has no value.";
00783       throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
00784     }
00785     else {
00786       for (unsigned int i = 0; i<param->defaultValues.size(); i++)
00787         values.push_back (param->defaultValues[i]);
00788     }
00789   }
00790   else {
00791     for (unsigned int i = 0; i<param->values.size(); i++)
00792       values.push_back (param->values[i]);
00793   }
00794 
00795   return;
00796 }
00797 
00798 
00799 
00800 // Public: Returns the first element of the value member of a parameter whos
00801 // name starts with paramName as an integer
00811 int IsisAml::GetInteger (const std::string &paramName) const {
00812 
00813   const IsisParameterData *param = ReturnParam (paramName);
00814 
00815   if (param->type != "integer") {
00816     string message = "Parameter [" + paramName + "] is not an integer.";
00817     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00818   }
00819 
00820   Isis::iString value;
00821   if (param->values.size() == 0) {
00822     if (param->defaultValues.size() == 0) {
00823       string message = "Parameter [" + paramName + "] has no value.";
00824       throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
00825     }
00826     else {
00827       value = param->defaultValues[0];
00828     }
00829   }
00830   else {
00831     value = param->values[0];
00832   }
00833 
00834   return value.ToInteger();
00835 }
00836 
00837 
00838 // Public: Returns the value member of a parameter whos name starts with paramName
00839 // as a vector<int>
00850 void IsisAml::GetInteger (const std::string &paramName,
00851                           std::vector<int> &values) const {
00852 
00853   const IsisParameterData *param = ReturnParam (paramName);
00854 
00855   if (param->type != "integer") {
00856     string message = "Parameter [" + paramName + "] is not an integer.";
00857     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00858   }
00859 
00860   values.clear();
00861   Isis::iString value;
00862   if (param->values.size() == 0) {
00863     if (param->defaultValues.size() == 0) {
00864       string message = "Parameter [" + paramName + "] has no value.";
00865       throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
00866     }
00867     else {
00868       for (unsigned int i = 0; i<param->defaultValues.size(); i++)
00869         value = param->defaultValues[i];
00870         values.push_back (value.ToInteger());
00871     }
00872   }
00873   else {
00874     for (unsigned int i = 0; i<param->values.size(); i++)
00875       value = param->values[i];
00876       values.push_back (value.ToInteger());
00877   }
00878 
00879   return;
00880 }
00881 
00882 
00883 
00884   // Public: Returns the first element of the value member of a parameter whos
00885   // name starts with paramName as a doubble
00895 double IsisAml::GetDouble (const std::string &paramName) const {
00896 
00897   const IsisParameterData *param = ReturnParam (paramName);
00898 
00899   if (param->type != "double") {
00900     string message = "Parameter [" + paramName + "] is not a double.";
00901     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00902   }
00903 
00904   Isis::iString value;
00905   if (param->values.size() == 0) {
00906     if (param->defaultValues.size() == 0) {
00907       string message = "Parameter [" + paramName + "] has no value.";
00908       throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
00909     }
00910     else {
00911       value = param->defaultValues[0];
00912     }
00913   }
00914   else {
00915     value = param->values[0];
00916   }
00917 
00918   return value.ToDouble();
00919 }
00920 
00921 // Public: Returns the value member of a parameter whos name starts with paramName
00922 // as a vector<doubble>
00933 void IsisAml::GetDouble (const std::string &paramName,
00934                          std::vector<double> &values) const {
00935 
00936   const IsisParameterData *param = ReturnParam (paramName);
00937 
00938   if (param->type != "double") {
00939     string message = "Parameter [" + paramName + "] is not a double.";
00940     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00941   }
00942 
00943   values.clear();
00944   Isis::iString value;
00945   if (param->values.size() == 0) {
00946     if (param->defaultValues.size() == 0) {
00947       string message = "Parameter [" + paramName + "] has no value.";
00948       throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
00949     }
00950     else {
00951       for (unsigned int i = 0; i<param->defaultValues.size(); i++)
00952         value = param->defaultValues[i];
00953         values.push_back (value.ToDouble());
00954     }
00955   }
00956   else {
00957     for (unsigned int i = 0; i<param->values.size(); i++)
00958       value = param->values[i];
00959       values.push_back (value.ToDouble());
00960   }
00961 
00962   return;
00963 }
00964 
00965 
00966 // Public: Returns the first element of the value member of a parameter whos
00967 // name starts with paramName as a bool
00977 bool IsisAml::GetBoolean (const std::string &paramName) const {
00978 
00979   const IsisParameterData *param = ReturnParam (paramName);
00980 
00981   if (param->type != "boolean") {
00982     string message = "Parameter [" + paramName + "] is not a boolean.";
00983     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
00984   }
00985 
00986   Isis::iString value;
00987   if (param->values.size() == 0) {
00988     if (param->defaultValues.size() == 0) {
00989       string message = "Parameter [" + paramName + "] has no value.";
00990       throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
00991     }
00992     else {
00993       value = param->defaultValues[0];
00994     }
00995   }
00996   else {
00997     value = param->values[0];
00998   }
00999 
01000   return StringToBool (value);
01001 
01002 }
01003 
01004 
01005 // Public: Returns the value member of a parameter whos name starts with paramName
01006 // as a vector<bool>
01017 void IsisAml::GetBoolean (const std::string &paramName,
01018                           std::vector<bool> &values) const {
01019 
01020   const IsisParameterData *param = ReturnParam (paramName);
01021 
01022   if (param->type != "boolean") {
01023     string message = "Parameter [" + paramName + "] is not a boolean.";
01024     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
01025   }
01026 
01027   values.clear();
01028   vector <string> value;
01029   Isis::iString tmp;
01030   if (param->values.size() == 0) {
01031     if (param->defaultValues.size() == 0) {
01032       string message = "Parameter [" + paramName + "] has no value.";
01033       throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
01034     }
01035     else {
01036       for (unsigned int i = 0; i<param->defaultValues.size(); i++) {
01037         tmp = param->defaultValues[i];
01038         tmp.UpCase();
01039         value.push_back (tmp);
01040       }
01041     }
01042   }
01043   else {
01044     for (unsigned int i = 0; i<param->values.size(); i++) {
01045       tmp = param->values[i];
01046       tmp.UpCase();
01047       value.push_back (tmp);
01048     }
01049   }
01050 
01051   for (unsigned int i = 0; i<value.size(); i++) {
01052     values.push_back (StringToBool (value[i]));
01053 
01054   }
01055 
01056   return;
01057 }
01063 string IsisAml::ProgramName () const {
01064   string tmp = name;
01065   return tmp;
01066 }
01067 
01068 
01074 string IsisAml::Brief () const {
01075   return brief;
01076 }
01077 
01078 
01084 string IsisAml::Description () const {
01085   return description;
01086 }
01087 
01093 int IsisAml::NumGroups () const {
01094   return groups.size();
01095 }
01096 
01104 string IsisAml::GroupName (const int &index) const {
01105   string s = groups[index].name;
01106   return s;
01107 }
01108 
01116 int IsisAml::NumParams (const int &group) const {
01117   return groups[group].parameters.size();
01118 }
01119 
01128 string IsisAml::ParamName (const int &group, const int &param) const {
01129    string s = groups[group].parameters[param].name;
01130   return s;
01131 }
01132 
01141 string IsisAml::ParamBrief (const int &group, const int &param) const {
01142   string s = groups[group].parameters[param].brief;
01143  return s;
01144 }
01145 
01154 string IsisAml::ParamDescription (const int &group, const int &param) const {
01155   string s = groups[group].parameters[param].description;
01156   return s;
01157 }
01158 
01167 string IsisAml::ParamMinimum (const int &group, const int &param) const {
01168   string s = groups[group].parameters[param].minimum;
01169   return s;
01170 }
01171 
01180 string IsisAml::ParamMaximum (const int &group, const int &param) const {
01181   string s = groups[group].parameters[param].maximum;
01182   return s;
01183 }
01184 
01193 string IsisAml::ParamMinimumInclusive (const int &group, const int &param) const {
01194   string s = groups[group].parameters[param].minimum_inclusive;
01195   return s;
01196 }
01197 
01206 string IsisAml::ParamMaximumInclusive (const int &group, const int &param) const {
01207   string s = groups[group].parameters[param].maximum_inclusive;
01208   return s;
01209 }
01210 
01220 string IsisAml::ParamOdd (const int &group, const int &param) const {
01221   string s = groups[group].parameters[param].odd;
01222   return s;
01223 }
01224 
01233 int IsisAml::ParamGreaterThanSize (const int &group, const int &param) const {
01234   return groups[group].parameters[param].greaterThan.size();
01235 }
01236 
01245 int IsisAml::ParamGreaterThanOrEqualSize (const int &group, 
01246                                              const int &param) const {
01247   return groups[group].parameters[param].greaterThanOrEqual.size();
01248 }
01249 
01258 int IsisAml::ParamLessThanSize (const int &group, const int &param) const {
01259   return groups[group].parameters[param].lessThan.size();
01260 }
01261 
01270 int IsisAml::ParamLessThanOrEqualSize (const int &group, 
01271                                           const int &param) const {
01272   return groups[group].parameters[param].lessThanOrEqual.size();
01273 }
01274 
01283 int IsisAml::ParamNotEqualSize (const int &group, const int &param) const {
01284   return groups[group].parameters[param].notEqual.size();
01285 }
01286 
01296 string IsisAml::ParamGreaterThan (const int &group, const int &param,
01297                      const int &great) const {
01298   string s = groups[group].parameters[param].greaterThan[great];
01299   return s;
01300 }
01301 
01311 string IsisAml::ParamGreaterThanOrEqual (const int &group, const int &param,
01312                      const int &great) const {
01313   string s = groups[group].parameters[param].greaterThanOrEqual[great];
01314   return s;
01315 }
01316 
01326 string IsisAml::ParamLessThan (const int &group, const int &param,
01327                      const int &les) const {
01328   string s = groups[group].parameters[param].lessThan[les];
01329   return s;
01330 }
01331 
01341 string IsisAml::ParamLessThanOrEqual (const int &group, const int &param,
01342                      const int &les) const {
01343   string s = groups[group].parameters[param].lessThanOrEqual[les];
01344   return s;
01345 }
01346 
01356 string IsisAml::ParamNotEqual (const int &group, const int &param,
01357                      const int &notEq) const {
01358   string s = groups[group].parameters[param].notEqual[notEq];
01359   return s;
01360 }
01361 
01371 string IsisAml::ParamExclude (const int &group, const int &param,
01372                      const int &exclude) const {
01373   string s = groups[group].parameters[param].exclude[exclude];
01374   return s;
01375 }
01376 
01386 string IsisAml::ParamInclude (const int &group, const int &param,
01387                      const int &include) const {
01388   string s = groups[group].parameters[param].include[include];
01389   return s;
01390 }
01391 
01392 
01401 string IsisAml::ParamType (const int &group, const int &param) const {
01402    string s = groups[group].parameters[param].type;
01403   return s;
01404 }
01405 
01414 string IsisAml::ParamDefault (const int &group, const int &param) const {
01415   string s;
01416   if (groups[group].parameters[param].defaultValues.size() == 0) {
01417     s = "";
01418   }
01419   else {
01420     s = groups[group].parameters[param].defaultValues[0];
01421   }
01422   return s;
01423 }
01424 
01433 string IsisAml::ParamInternalDefault (const int &group, const int &param) const {
01434   string s;
01435   if (groups[group].parameters[param].internalDefault.size() == 0) {
01436     s = "";
01437   }
01438   else {
01439     s = groups[group].parameters[param].internalDefault;
01440   }
01441   return s;
01442 }
01443 
01452 string IsisAml::ParamFilter (const int &group, const int &param) const {
01453   string s;
01454   if (groups[group].parameters[param].filter.size() == 0) {
01455     s = "";
01456   }
01457   else {
01458     s = groups[group].parameters[param].filter;
01459   }
01460   return s;
01461 }
01462 
01471 string IsisAml::ParamPath (const int &group, const int &param) const {
01472   string s;
01473   if (groups[group].parameters[param].path.size() == 0) {
01474     s = "";
01475   }
01476   else {
01477     s = groups[group].parameters[param].path;
01478   }
01479   return s;
01480 }
01481 
01490 string IsisAml::ParamFileMode (const int &group, const int &param) const {
01491   string s;
01492   if (groups[group].parameters[param].fileMode.size() == 0) {
01493     s = "";
01494   }
01495   else {
01496     s = groups[group].parameters[param].fileMode;
01497   }
01498   return s;
01499 }
01500 
01510 int IsisAml::ParamListSize (const int &group, const int &param) const {
01511   return groups[group].parameters[param].listOptions.size();
01512 }
01513 
01514 
01524 string IsisAml::ParamListValue (const int &group, const int &param,
01525                                 const int &option) const {
01526   string s = groups[group].parameters[param].listOptions[option].value;
01527   return s;
01528 }
01529 
01539 string IsisAml::ParamListBrief (const int &group, const int &param,
01540                                 const int &option) const {
01541   string s = groups[group].parameters[param].listOptions[option].brief;
01542   return s;
01543 }
01544 
01554 string IsisAml::ParamListDescription (const int &group, const int &param,
01555                                       const int &option) const {
01556   string s = groups[group].parameters[param].listOptions[option].description;
01557   return s;
01558 }
01559 
01569 int IsisAml::ParamListExcludeSize (const int &group, const int &param,
01570                                    const int &option) const {
01571   return groups[group].parameters[param].listOptions[option].exclude.size();
01572 }
01573 
01584 string IsisAml::ParamListExclude (const int &group, const int &param,
01585                                   const int &option, const int &exclude) const {
01586   string s = groups[group].parameters[param].listOptions[option].exclude[exclude];
01587   return s;
01588 }
01589 
01599 int IsisAml::ParamListIncludeSize (const int &group, const int &param,
01600                                    const int &option) const {
01601   return groups[group].parameters[param].listOptions[option].include.size();
01602 }
01603 
01614 string IsisAml::ParamListInclude (const int &group, const int &param,
01615                                   const int &option, const int &include) const {
01616   string s = groups[group].parameters[param].listOptions[option].include[include];
01617   return s;
01618 }
01619 
01628 int IsisAml::ParamExcludeSize (const int &group, const int &param) const {
01629   return groups[group].parameters[param].exclude.size();
01630 }
01631 
01640 int IsisAml::ParamIncludeSize (const int &group, const int &param) const {
01641   return groups[group].parameters[param].include.size();
01642 }
01643 
01652 string IsisAml::PixelType (const int &group, const int &param) const {
01653   return groups[group].parameters[param].pixelType;
01654 }
01655 
01664 int IsisAml::HelpersSize (const int &group, const int &param) const {
01665   return groups[group].parameters[param].helpers.size();
01666 }
01667 
01677 string IsisAml::HelperButtonName (const int &group, const int &param, 
01678                                const int &helper) const {
01679   return groups[group].parameters[param].helpers[helper].name;
01680 }
01681 
01691 string IsisAml::HelperFunction (const int &group, const int &param, 
01692                              const int &helper) const {
01693   return groups[group].parameters[param].helpers[helper].function;
01694 }
01695 
01705 string IsisAml::HelperBrief (const int &group, const int &param, 
01706                              const int &helper) const {
01707   return groups[group].parameters[param].helpers[helper].brief;
01708 }
01709 
01719 string IsisAml::HelperDescription (const int &group, const int &param, 
01720                                    const int &helper) const {
01721   return groups[group].parameters[param].helpers[helper].description;
01722 }
01723 
01733 string IsisAml::HelperIcon (const int &group, const int &param, 
01734                          const int &helper) const {
01735   return groups[group].parameters[param].helpers[helper].icon;
01736 }
01737 
01745 bool IsisAml::WasEntered (const std::string &paramName) const {
01746 
01747   const IsisParameterData *param = ReturnParam (paramName);
01748 
01749   if (param->values.size() == 0) {
01750     return false;
01751   }
01752 
01753   return true;
01754 }
01755 
01761 void IsisAml::Clear (const std::string &paramName) {
01762 
01763   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
01764   param->values.clear();
01765 
01766   param->outCubeAtt.Reset();
01767   param->outCubeAtt.Set("+"+param->pixelType);
01768   param->inCubeAtt.Reset();
01769 
01770   return;
01771 }
01772 
01773 
01784 Isis::CubeAttributeInput& IsisAml::GetInputAttribute (const std::string &paramName) {
01785 
01786   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
01787 
01788   if (param->type != "cube") {
01789     string message = "Parameter [" + paramName + "] is not a cube.";
01790     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
01791   }
01792 
01793   string value;
01794   if (param->values.size() == 0) {
01795     if (param->defaultValues.size() == 0) {
01796       value.clear();
01797 //      string message = "Parameter [" + paramName + "] has no value.";
01798 //      throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
01799     }
01800     else {
01801       value = param->defaultValues[0];
01802     }
01803   }
01804   else {
01805     value = param->values[0];
01806   }
01807   if (param->fileMode == "input") {
01808     param->inCubeAtt.Reset();
01809     param->inCubeAtt.Set(value);
01810   }
01811   else {
01812     string message = "Parameter [" + paramName + "] does not contain an [input] file";
01813     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
01814   }
01815   return param->inCubeAtt;
01816 }
01817 
01828 Isis::CubeAttributeOutput& IsisAml::GetOutputAttribute (const std::string &paramName) {
01829 
01830   IsisParameterData *param = const_cast <IsisParameterData *> (ReturnParam (paramName));
01831 
01832   if (param->type != "cube") {
01833     string message = "Parameter [" + paramName + "] is not a cube.";
01834     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
01835   }
01836 
01837   string value;
01838   if (param->values.size() == 0) {
01839     if (param->defaultValues.size() == 0) {
01840       value.clear();
01841 //      string message = "Parameter [" + paramName + "] has no value.";
01842 //      throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
01843     }
01844     else {
01845       value = param->defaultValues[0];
01846     }
01847   }
01848   else {
01849     value = param->values[0];
01850   }
01851   if (param->fileMode == "output") {
01852     param->outCubeAtt.Reset();
01853     param->outCubeAtt.Set("+"+param->pixelType);
01854     param->outCubeAtt.Set(value);
01855   }
01856   else {
01857     string message = "Parameter [" + paramName + "] does not contain an [output] file";
01858     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
01859   }
01860   return param->outCubeAtt;
01861 }
01862 
01873 const IsisParameterData *IsisAml::ReturnParam (const std::string &paramName) const {
01874   Isis::iString pn = paramName;
01875   pn.UpCase();
01876   int found = 0;
01877   bool exact = false;
01878   const IsisParameterData *param = NULL;
01879   Isis::iString cur_pn;
01880 
01881   for (unsigned int g=0; g<groups.size(); g++) {
01882     for (unsigned int p=0; p<groups[g].parameters.size(); p++) {
01883       cur_pn = groups[g].parameters[p].name;
01884       cur_pn.UpCase();
01885       if (cur_pn.find(pn) == 0) {
01886         if (cur_pn == pn) {
01887           if (exact) {
01888             string message = "Parameter [" + paramName + "] is not unique.";
01889             throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
01890           }
01891           else {
01892             exact = true;
01893             found = 0;
01894             param = &(groups[g].parameters[p]);
01895           }
01896         }
01897         else if (!exact) {
01898           found++;
01899           param = &(groups[g].parameters[p]);
01900         }
01901       }
01902     }
01903   }
01904   if (param == NULL) {
01905     string message = "Unknown parameter [" + paramName + "].";
01906     throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
01907   }
01908   else if ((found > 1) && (!exact)) {
01909       string message = "Parameter [" + paramName + "] is not unique.";
01910       throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
01911   }
01912   return param;
01913 }
01914 
01922 void IsisAml::Verify (const IsisParameterData *param) {
01923 
01924   // Check to make sure the value string can be converted to the correct type
01925   for (unsigned int i=0; i<param->values.size (); i++) {
01926     if (param->type == "integer") {
01927       try {
01928         Isis::iString value (param->values[i]);
01929         value.ToInteger();
01930       }
01931       catch (Isis::iException &e) {
01932         string message = "Unable to convert [" + param->values[i] + "] to an integer,"
01933                          " parameter [" + param->name + "].";
01934         throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
01935       }
01936     }
01937     else if (param->type == "double") {
01938       try {
01939         Isis::iString value (param->values[i]);
01940         value.ToDouble();
01941       }
01942       catch (Isis::iException &e) {
01943         string message = "Unable to convert [" + param->values[i] + "] to a double,"
01944                          " parameter [" + param->name + "].";
01945         throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
01946       }
01947     }
01948     else if (param->type == "boolean") {
01949       Isis::iString v = param->values[i];
01950       v.UpCase();
01951 
01952       try {
01953         StringToBool (v);
01954       }
01955       catch (Isis::iException &e) {
01956         string message = "Illegal value for [" + param->name + "], [" + param->values[i] + "].";
01957         throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
01958       }
01959     }
01960     else if (param->type == "filename") {
01961       // Put something here once we figure out what to do with filenames
01962     }
01963   }
01964 
01965   // Check the default values if there were no values
01966   if (param->values.size () == 0) {
01967     for (unsigned int i=0; i<param->defaultValues.size (); i++) {
01968       // Check to make sure the DefaultValue string can be converted to the
01969       // correct type
01970       if (param->type == "integer") {
01971         try {
01972           Isis::iString value (param->defaultValues[i]);
01973           value.ToInteger();
01974         }
01975         catch (Isis::iException &e) {
01976           string message = "Unable to convert default [" + param->defaultValues[i] +
01977                            "] to an integer, parameter [" + param->name + "].";
01978           throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
01979         }
01980       }
01981       else if (param->type == "double") {
01982         try {
01983           Isis::iString value (param->defaultValues[i]);
01984           value.ToDouble();
01985         }
01986         catch (Isis::iException &e) {
01987           string message = "Unable to convert default [" + param->defaultValues[i] +
01988                            "] to a double, parameter [" + param->name + "].";
01989           throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
01990         }
01991       }
01992       else if (param->type == "boolean") {
01993         Isis::iString v = param->defaultValues[i];
01994         v.UpCase();
01995 
01996         try {
01997           StringToBool (v);
01998         }
01999         catch (Isis::iException &e) {
02000           string message = "Illegal default value for [" + param->name + "], [" 
02001             + param->defaultValues[i] + "].";
02002           throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02003         }
02004       }
02005       else if (param->type == "filename") {
02006         // Put something here once we figure out what to do with filenames
02007       }
02008     }
02009   }
02010 
02011   // Check the values against the values list if there is one
02012   if (param->listOptions.size () > 0) {
02013     for (unsigned int i=0; i<param->values.size (); i++) {
02014       Isis::iString value = param->values[i];
02015       value = value.UpCase();
02016       int partial = 0;
02017       bool exact = false;
02018       for (unsigned int p=0; p<param->listOptions.size (); p++) {
02019         Isis::iString option = param->listOptions[p].value;
02020         option = option.UpCase();
02021         // Check to see if the value matches the list option exactly
02022         if (value == option) {
02023           // If we already have one exact match then there is an error
02024           if (exact) {
02025             string message = "Duplicate list options [" +
02026                              param->listOptions[p].value +
02027                              "] in parameter [" + param->name + "].";
02028             throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
02029           }
02030           exact = true;
02031         }
02032         // Check for a partial match
02033         // Compare the shorter of the two (values[i]) to a substring of the
02034         // longer string (listOptions[p].value)
02035         else if (option.compare(0, min(value.size(),option.size()),
02036                                 value, 0, min(value.size(),option.size())) == 0) {
02037           partial++;
02038         }
02039       }
02040       if (!exact && partial == 0) {
02041         string message = "Value of [" + param->name + "] must be one of [" +
02042                          param->listOptions[0].value;
02043         for (unsigned int p=1; p<param->listOptions.size (); p++) {
02044           message += ", " + param->listOptions[p].value;
02045         }
02046         message += "].";
02047         throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02048       }
02049       else if (!exact && partial > 1) {
02050         string msg = "Value of [" + param->name +
02051                      "] does not match a list option uniquely.";
02052         throw Isis::iException::Message(Isis::iException::Programmer,msg, _FILEINFO_);
02053       }
02054     }
02055   }
02056 
02057   // Check the values against the minimum
02058   if (param->minimum.length () > 0) {
02059     Isis::iString incl = param->minimum_inclusive;
02060     for (unsigned int i=0; i<param->values.size (); i++) {
02061       if (param->type == "integer") {
02062         Isis::iString value (param->values[i]);
02063         int temp = value.ToInteger();
02064         value = param->minimum;
02065         int min = value.ToInteger();
02066         if (StringToBool(incl) && (temp < min)) {
02067           string message = "Parameter [" + param->name + 
02068             "] must be greater than or equal to [" + param->minimum + "].";
02069           throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02070         }
02071         else if (!StringToBool(incl) && (temp <= min)) {
02072           string message = "Parameter [" + param->name + 
02073             "] must be greater than [" + param->minimum + "].";
02074           throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02075         }
02076       }
02077       else if (param->type == "double") {
02078         Isis::iString value (param->values[i]);
02079         double temp = value.ToDouble();
02080         value = param->minimum;
02081         double min = value.ToDouble();
02082         if (StringToBool(incl) && (temp < min)) {
02083           string message = "Parameter [" + param->name + 
02084             "] must be greater than or equal to [" + param->minimum + "].";
02085           throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02086         }
02087         else if (!StringToBool(incl) && (temp <= min)) {
02088           string message = "Parameter [" + param->name + 
02089             "] must be greater than [" + param->minimum + "].";
02090           throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02091         }
02092       }
02093     }
02094     if (param->values.size () == 0) {
02095       for (unsigned int i=0; i<param->defaultValues.size (); i++) {
02096         if (param->type == "integer") {
02097           Isis::iString value (param->defaultValues[i]);
02098           int temp = value.ToInteger();
02099           value = param->minimum;
02100           int min = value.ToInteger();
02101           if (StringToBool(incl) && (temp < min)) {
02102             string message = "Parameter [" + param->name + 
02103               "] must be greater than or equal to [" + param->minimum + "].";
02104             throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02105           }
02106           else if (!StringToBool(incl) && (temp <= min)) {
02107             string message = "Parameter [" + param->name + 
02108               "] must be greater than [" + param->minimum + "].";
02109             throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02110           }
02111         }
02112         else if (param->type == "double") {
02113           Isis::iString value (param->defaultValues[i]);
02114           double temp = value.ToDouble();
02115           value = param->minimum;
02116           double min = value.ToDouble();
02117           if (StringToBool(incl) && (temp < min)) {
02118             string message = "Parameter [" + param->name + 
02119               "] must be greater than or equal to [" + param->minimum + "].";
02120             throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02121           }
02122           else if (!StringToBool(incl) && (temp <= min)) {
02123             string message = "Parameter [" + param->name + 
02124               "] must be greater than [" + param->minimum + "].";
02125             throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02126           }
02127         }
02128       }
02129     }
02130   }
02131 
02132   // Check the values against the maximum
02133   if (param->maximum.length () > 0) {
02134     Isis::iString incl = param->maximum_inclusive;
02135     incl.DownCase();
02136     for (unsigned int i=0; i<param->values.size (); i++) {
02137       if (param->type == "integer") {
02138         Isis::iString value (param->values[i]);
02139         int temp = value.ToInteger();
02140         value = param->maximum;
02141         int max = value.ToInteger();
02142         if (StringToBool(incl) && (temp > max)) {
02143           string message = "Parameter [" + param->name + 
02144             "] must be less than or equal to [" + param->maximum + "].";
02145           throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02146         }
02147         else if (!StringToBool(incl) && (temp >= max)) {
02148           string message = "Parameter [" + param->name + 
02149             "] must be less than [" + param->maximum + "].";
02150           throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02151         }
02152       }
02153       else if (param->type == "double") {
02154         Isis::iString value (param->values[i]);
02155         double temp = value.ToDouble();
02156         value = param->maximum;
02157         double max = value.ToDouble();
02158         if (StringToBool(incl) && (temp > max)) {
02159           string message = "Parameter [" + param->name + 
02160             "] must be less than or equal to [" + param->maximum + "].";
02161           throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02162         }
02163         else if (!StringToBool(incl) && (temp >= max)) {
02164           string message = "Parameter [" + param->name + 
02165             "] must be less than [" + param->maximum + "].";
02166           throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02167         }
02168       }
02169     }
02170     if (param->values.size () == 0) {
02171       for (unsigned int i=0; i<param->defaultValues.size (); i++) {
02172         if (param->type == "integer") {
02173           Isis::iString value (param->defaultValues[i]);
02174           int temp = value.ToInteger();
02175           value = param->maximum;
02176           int max = value.ToInteger();
02177           if (StringToBool(incl) && (temp > max)) {
02178             string message = "Parameter [" + param->name + 
02179               "] must be less than or equal to [" + param->maximum + "].";
02180             throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02181           }
02182           else if (!StringToBool(incl) && (temp >= max)) {
02183             string message = "Parameter [" + param->name + 
02184               "] must be less than [" + param->maximum + "].";
02185             throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02186           }
02187         }
02188         else if (param->type == "double") {
02189           Isis::iString value (param->defaultValues[i]);
02190           double temp = value.ToDouble();
02191           value = param->maximum;
02192           double max = value.ToDouble();
02193           if (StringToBool(incl) && (temp > max)) {
02194             string message = "Parameter [" + param->name + 
02195               "] must be less than or equal to [" + param->maximum + "].";
02196             throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02197           }
02198           else if (!StringToBool(incl) && (temp >= max)) {
02199             string message = "Parameter [" + param->name + 
02200               "] must be less than [" + param->maximum + "].";
02201             throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02202           }
02203         }
02204       }
02205     }
02206   }
02207 
02208   // Check the value for an odd test
02209   Isis::iString odd = param->odd;
02210   odd.DownCase();
02211 
02212   if ((odd != "") || StringToBool(odd)) {
02213     if (param->type != "integer") {
02214       string message = "Parameter [" + param->name + 
02215         "] must be of type integer to have an [odd] test.";
02216       throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
02217     }
02218     else {
02219       for (unsigned int i=0; i<param->values.size (); i++) {
02220         Isis::iString value (param->values[i]);
02221         if ((value.ToInteger() % 2) != 1) {
02222           string message = "Value for [" + param->name + "] must be odd.";
02223           throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02224         }
02225       }
02226     }
02227   }
02228   return;
02229 }
02230 
02231 
02233 void IsisAml::VerifyAll () {
02234   for (unsigned int g=0; g<groups.size(); g++) {
02235     for (unsigned int p=0; p<groups[g].parameters.size(); p++) {
02236       IsisParameterData *param = &(this->groups[g].parameters[p]);
02237 
02238       Verify (param);
02239 
02240       // Check the values for inclusive clauses
02241       for (unsigned int item=0; item<param->include.size(); item++) {
02242         // If this parameter is a boolean and it is true/yes
02243         // all included parameters must have some type of value
02244         if (param->type == "boolean") {
02245           if (((param->values.size() > 0) && StringToBool(param->values[0])) ||
02246               ((param->values.size() == 0) && (param->defaultValues.size() > 0) 
02247                && StringToBool(param->defaultValues[0]))) {
02248 
02249             const IsisParameterData *param2 = ReturnParam (param->include[item]);
02250             if ((param2->values.size()) == 0 &&
02251                 (param2->defaultValues.size() == 0) &&
02252                 (param2->internalDefault.size() == 0)) {
02253               string message = "Parameter [" + param2->name +
02254                                "] must be used if parameter [" +
02255                                param->name + "] equates to true.";
02256               throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02257             }
02258           }
02259         }
02260         // This parameter is NOT a boolean but the other one might be
02261         else {
02262           // If the other parameter is a boolean and it is true/yes
02263           // then this parameter must have some type of value
02264           const IsisParameterData *param2 = ReturnParam (param->include[item]);
02265           if (param2->type == "boolean") {
02266             if (((param2->values.size() > 0) && StringToBool(param2->values[0])) ||
02267                 ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
02268                 StringToBool(param2->defaultValues[0]))) {
02269               if ((param->values.size()) == 0 &&
02270                   (param->defaultValues.size() == 0) &&
02271                   (param->internalDefault.size() == 0)) {
02272                 string message = "Parameter [" + param2->name +
02273                                  "] must be used if parameter [" +
02274                                  param->name + "] is used.";
02275                 throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02276               }
02277             }
02278           }
02279           // Neithter parameter is a boolean so
02280           // If this one has a value the other parameter must have some type of value
02281           else {
02282             if (param->values.size() > 0 &&
02283                 param2->values.size() == 0 &&
02284                 param2->defaultValues.size() == 0 &&
02285                 param2->internalDefault.size() == 0) {
02286               string message = "Parameter [" + param2->name +
02287                                "] must be used if parameter [" +
02288                                param->name + "] is used.";
02289               throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02290             }
02291           }
02292         }
02293       }
02294       // Check the values for exclusive clauses
02295       for (unsigned int item=0; item<param->exclude.size(); item++) {
02296         // If this parameter is a boolean that is true/yes
02297         // the other parameter should not have a value
02298         if (param->type == "boolean") {
02299           if (((param->values.size() > 0) && StringToBool(param->values[0])) ||
02300               ((param->values.size() == 0) && (param->defaultValues.size() > 0) &&
02301               StringToBool(param->defaultValues[0]))) {
02302 
02303             const IsisParameterData *param2 = ReturnParam (param->exclude[item]);
02304             if (param2->values.size() > 0) {
02305               string message = "Parameter [" + param2->name +
02306                                "] must NOT be used if parameter [" +
02307                                param->name + "] equates to true.";
02308               throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02309             }
02310           }
02311         }
02312         // This parameter is NOT a boolean but the other one might be
02313         else {
02314           const IsisParameterData *param2 = ReturnParam (param->exclude[item]);
02315           if (param2->type == "boolean") {
02316             if (((param2->values.size() > 0) && StringToBool(param2->values[0])) ||
02317                 ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
02318                 StringToBool(param2->defaultValues[0]))) {
02319               if (param->values.size() > 0) {
02320                 string message = "Parameter [" + param2->name +
02321                                  "] must be used if parameter [" +
02322                                  param->name + "] is used.";
02323                 throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02324               }
02325             }
02326           }
02327           // Neither parameter is a boolean
02328           else {
02329             if (param->values.size() > 0 && param2->values.size() > 0) {
02330               string message = "Parameter [" + param2->name +
02331                                "] must NOT be used if parameter [" +
02332                                param->name + "] is used.";
02333               throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02334             }
02335           }
02336         }
02337       }
02338 
02339       // Check the values for greaterThan clauses
02340       if (param->values.size() > 0) {
02341         for (unsigned int item=0; item<param->greaterThan.size(); item++) {
02342           const IsisParameterData *param2 = ReturnParam (param->greaterThan[item]);
02343           if (param2->values.size() != 0) {
02344             double double1, double2;
02345             if (param->type == "integer") {
02346               double1 = (double) GetInteger (param->name);
02347             }
02348             else if (param->type == "double") {
02349               double1 = GetDouble (param->name);
02350             }
02351             else {
02352               string msg = "Parameter is not INTEGER or DOUBLE type [" +
02353                            param->name + "]";
02354               throw Isis::iException::Message(Isis::iException::Programmer,msg,_FILEINFO_);
02355             }
02356 
02357             if (param2->type == "integer") {
02358               double2 = GetInteger (param2->name);
02359             }
02360             else if (param2->type == "double") {
02361               double2 = GetDouble (param2->name);
02362             }
02363             else {
02364               string msg = "Parameter is not INTEGER or DOUBLE type [" +
02365                            param->name + "]";
02366               throw Isis::iException::Message(Isis::iException::Programmer,msg,_FILEINFO_);
02367             }
02368 
02369             if (double2 >= double1) {
02370               string message = "Parameter [" + param->name +
02371                                "] must be greater than parameter [" +
02372                                param2->name + "].";
02373               throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02374             }
02375           }
02376         }
02377       }
02378 
02379       // Check the values for greaterThanOrEqual clauses
02380       if (param->values.size() > 0) {
02381         for (unsigned int item=0; item<param->greaterThanOrEqual.size(); item++) {
02382           const IsisParameterData *param2 =
02383                                   ReturnParam(param->greaterThanOrEqual[item]);
02384           if (param2->values.size() != 0) {
02385             double double1, double2;
02386             if (param->type == "integer") {
02387               double1 = (double) GetInteger (param->name);
02388             }
02389             else if (param->type == "double") {
02390               double1 = GetDouble (param->name);
02391             }
02392             else {
02393               string msg = "Parameter is not INTEGER or DOUBLE type [" +
02394                            param->name + "]";
02395               throw Isis::iException::Message(Isis::iException::Programmer,msg,_FILEINFO_);
02396             }
02397 
02398             if (param2->type == "integer") {
02399               double2 = GetInteger (param2->name);
02400             }
02401             else if (param2->type == "double") {
02402               double2 = GetDouble (param2->name);
02403             }
02404             else {
02405               string msg = "Parameter is not INTEGER or DOUBLE type [" +
02406                            param->name + "]";
02407               throw Isis::iException::Message(Isis::iException::Programmer,msg,_FILEINFO_);
02408             }
02409 
02410             if (double2 > double1) {
02411               string message = "Parameter [" + param->name +
02412                                "] must be greater than or equal to parameter [" +
02413                                param2->name + "].";
02414               throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02415             }
02416           }
02417         }
02418       }
02419       // Check the values for lessThan clauses
02420       if (param->values.size() > 0) {
02421         for (unsigned int item=0; item<param->lessThan.size(); item++) {
02422           const IsisParameterData *param2 = ReturnParam (param->lessThan[item]);
02423           if (param2->values.size() != 0) {
02424             double double1, double2;
02425             if (param->type == "integer") {
02426               double1 = (double) GetInteger (param->name);
02427             }
02428             else if (param->type == "double") {
02429               double1 = GetDouble (param->name);
02430             }
02431             else {
02432               string msg = "Parameter is not INTEGER or DOUBLE type [" +
02433                            param->name + "]";
02434               throw Isis::iException::Message(Isis::iException::Programmer,msg,_FILEINFO_);
02435             }
02436 
02437             if (param2->type == "integer") {
02438               double2 = GetInteger (param2->name);
02439             }
02440             else if (param2->type == "double") {
02441               double2 = GetDouble (param2->name);
02442             }
02443             else {
02444               string msg = "Parameter is not INTEGER or DOUBLE type [" +
02445                            param->name + "]";
02446               throw Isis::iException::Message(Isis::iException::Programmer,msg,_FILEINFO_);
02447             }
02448 
02449             if (double2 <= double1) {
02450               string message = "Parameter [" + param->name +
02451                                "] must be less than parameter [" +
02452                                param2->name + "].";
02453               throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02454             }
02455           }
02456         }
02457       }
02458 
02459       // Check the values for lessThanOrEqual clauses
02460       if (param->values.size() > 0) {
02461         for (unsigned int item=0; item<param->lessThanOrEqual.size(); item++) {
02462           const IsisParameterData *param2 =
02463                                   ReturnParam(param->lessThanOrEqual[item]);
02464           if (param2->values.size() != 0) {
02465             double double1, double2;
02466             if (param->type == "integer") {
02467               double1 = (double) GetInteger (param->name);
02468             }
02469             else if (param->type == "double") {
02470               double1 = GetDouble (param->name);
02471             }
02472             else {
02473               string msg = "Parameter is not INTEGER or DOUBLE type [" +
02474                            param->name + "]";
02475               throw Isis::iException::Message(Isis::iException::Programmer,msg,_FILEINFO_);
02476             }
02477 
02478             if (param2->type == "integer") {
02479               double2 = GetInteger (param2->name);
02480             }
02481             else if (param2->type == "double") {
02482               double2 = GetDouble (param2->name);
02483             }
02484             else {
02485               string msg = "Parameter is not INTEGER or DOUBLE type [" +
02486                            param->name + "]";
02487               throw Isis::iException::Message(Isis::iException::Programmer,msg,_FILEINFO_);
02488             }
02489 
02490             if (double2 < double1) {
02491               string message = "Parameter [" + param->name +
02492                                "] must be less than or equal to parameter [" +
02493                                param2->name + "].";
02494               throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02495             }
02496           }
02497         }
02498       }
02499 
02500       // Check the values for notEqual clauses
02501       if (param->values.size() > 0) {
02502         for (unsigned int item=0; item<param->notEqual.size(); item++) {
02503           const IsisParameterData *param2 = ReturnParam (param->notEqual[item]);
02504           if (param2->values.size() != 0) {
02505             double double1, double2;
02506             if (param->type == "integer") {
02507               double1 = (double) GetInteger (param->name);
02508             }
02509             else if (param->type == "double") {
02510               double1 = GetDouble (param->name);
02511             }
02512             else {
02513               string msg = "Parameter is not INTEGER or DOUBLE type [" +
02514                            param->name + "]";
02515               throw Isis::iException::Message(Isis::iException::Programmer,msg,_FILEINFO_);
02516             }
02517 
02518             if (param2->type == "integer") {
02519               double2 = GetInteger (param2->name);
02520             }
02521             else if (param2->type == "double") {
02522               double2 = GetDouble (param2->name);
02523             }
02524             else {
02525               string msg = "Parameter is not INTEGER or DOUBLE type [" +
02526                            param->name + "]";
02527               throw Isis::iException::Message(Isis::iException::Programmer,msg,_FILEINFO_);
02528             }
02529 
02530             if (double2 == double1) {
02531               string message = "Parameter [" + param->name +
02532                                "] must NOT be equal to parameter [" +
02533                                param2->name + "].";
02534               throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02535             }
02536           }
02537         }
02538       }
02539 
02540       // If this parameter has a value, and a list/option/exclude, make sure
02541       // the excluded parameter has NO value
02542       if (((param->values.size() > 0) || (param->defaultValues.size())) > 0) {
02543         for (unsigned int o2=0; o2<param->listOptions.size(); o2++) {
02544           Isis::iString value, option;
02545           if (param->type == "string") {
02546             value = GetString (param->name);
02547             value = value.UpCase ();
02548             option = param->listOptions[o2].value;
02549             option = option.UpCase ();
02550           }
02551           else if (param->type == "integer") {
02552             value = GetAsString (param->name);
02553             value = value.Trim ("\n\r\t\f\v\b");
02554             option = param->listOptions[o2].value;
02555             option = option.Trim ("\n\r\t\f\v\b");
02556           }
02557           if (value == option) {
02558             for (unsigned int e2=0;e2<param->listOptions[o2].exclude.size();e2++) {
02559               const IsisParameterData *param2 =
02560                   ReturnParam (param->listOptions[o2].exclude[e2]);
02561               if (param2->values.size() > 0) {
02562                 string message = "Parameter [" + param2->name +
02563                                  "] can not be entered if parameter [" +
02564                                  param->name + "] is equal to [" +
02565                                  value + "]";
02566                 throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02567               }
02568             }
02569           }
02570         }
02571       }
02572 
02573       // If this parameter has a value, and a list/option/include, make sure
02574       // the included parameter has a value
02575       if (((param->values.size() > 0) || (param->defaultValues.size())) > 0) {
02576         for (unsigned int o2=0; o2<param->listOptions.size(); o2++) {
02577           Isis::iString value, option;
02578           if (param->type == "string") {
02579             value = GetString (param->name);
02580             value = value.UpCase ();
02581             option = param->listOptions[o2].value;
02582             option = option.UpCase ();
02583           }
02584           else if (param->type == "integer") {
02585             value = GetAsString (param->name);
02586             value = value.Trim ("\n\r\t\f\v\b");
02587             option = param->listOptions[o2].value;
02588             option = option.Trim ("\n\r\t\f\v\b");
02589           }
02590           if (value == option) {
02591             for (unsigned int e2=0;e2<param->listOptions[o2].include.size();e2++) {
02592               const IsisParameterData *param2 =
02593                   ReturnParam (param->listOptions[o2].include[e2]);
02594               if ((param2->values.size() == 0) &&
02595                   (param2->defaultValues.size() == 0)) {
02596                 string message = "Parameter [" + param2->name +
02597                                  "] must be entered if parameter [" +
02598                                  param->name + "] is equal to [" +
02599                                  value + "]";
02600                 throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02601               }
02602             }
02603           }
02604         }
02605       }
02606 
02607       // If this parameter has no value, default value or internal default
02608       // value then it must be excluded by some other parameter with an
02609       // exclude or list/option/exclude
02610       //   OR
02611       // it must include a boolean which is false
02612       if ((param->values.size() == 0) && (param->defaultValues.size() == 0) &&
02613           (param->internalDefault.size() == 0)) {
02614         bool excluded = false;
02615         // See if another parameter has a list option excluding this parameter
02616         for (unsigned int g2=0; g2<groups.size(); g2++) {
02617           for (unsigned int p2=0; p2<groups[g2].parameters.size(); p2++) {
02618             for (unsigned int o2=0;
02619                  o2<groups[g2].parameters[p2].listOptions.size(); o2++) {
02620               for (unsigned int e2=0;
02621                    e2<groups[g2].parameters[p2].listOptions[o2].exclude.size();
02622                    e2++) {
02623                 string excl =
02624                     this->groups[g2].parameters[p2].listOptions[o2].exclude[e2];
02625                 if (excl == param->name) {
02626                   excluded = true;
02627                   break;
02628                 }
02629               }
02630             }
02631 
02632             if(groups[g2].parameters[p2].type == "boolean") {
02633               const IsisParameterData *param2 = &groups[g2].parameters[p2];
02634               if (((param2->values.size() > 0) && !StringToBool(param2->values[0])) ||
02635                   ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
02636                   !StringToBool(param2->defaultValues[0]))) {
02637                 for(unsigned int e2=0; e2<groups[g2].parameters[p2].include.size();
02638                      e2++) {
02639                   string incl =
02640                       this->groups[g2].parameters[p2].include[e2];
02641                   if (incl == param->name) {
02642                     excluded = true;
02643                   }
02644                 }
02645               }
02646               else if (((param2->values.size() > 0) && StringToBool(param2->values[0])) ||
02647                   ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
02648                   StringToBool(param2->defaultValues[0]))) {
02649                 for(unsigned int e2=0; e2<groups[g2].parameters[p2].exclude.size();
02650                      e2++) {
02651                   string excl =
02652                       this->groups[g2].parameters[p2].exclude[e2];
02653                   if (excl == param->name) {
02654                     excluded = true;
02655                   }
02656                 }
02657               }
02658             }
02659           }
02660         }
02661 
02662         // See if this parameter excludes any other (this implies the other
02663         // one also excludes this one too
02664         for (unsigned int item=0; item<param->exclude.size(); item++) {
02665           const IsisParameterData *param2 = ReturnParam(param->exclude[item]);
02666           if ((param2->values.size() != 0) ||
02667               (param2->defaultValues.size() != 0) ||
02668               (param2->internalDefault.size() != 0)) {
02669             if (param2->type != "boolean") {
02670               excluded = true;
02671             }
02672             else {
02673               if (((param2->values.size() > 0) && !StringToBool(param2->values[0])) ||
02674                   ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
02675                   !StringToBool(param2->defaultValues[0]))) {
02676                 excluded = true;
02677               }
02678             }
02679           }
02680         }
02681 
02682         // See if this parameter includes a boolean that is false
02683         // then it doesn't need a value
02684         for (unsigned int item=0; item<param->include.size(); item++) {
02685           const IsisParameterData *param2 = ReturnParam(param->include[item]);
02686           if (param2->type == "boolean") {
02687             if (((param2->values.size() > 0) && !StringToBool(param2->values[0])) ||
02688                 ((param2->values.size() == 0) && (param2->defaultValues.size() > 0) &&
02689                 !StringToBool(param2->defaultValues[0]))) {
02690               excluded = true;
02691             }
02692           }
02693         }
02694 
02695         if (!excluded) {
02696           string message = "Parameter [" + param->name + "] must be entered.";
02697           throw Isis::iException::Message(Isis::iException::User,message, _FILEINFO_);
02698         }
02699       }
02700     }
02701   }
02702 }
02703 
02713 bool IsisAml::StringToBool (Isis::iString value) const {
02714 
02715   value.UpCase ();
02716   if (value == "") {
02717     return false;
02718   }
02719   else if (!value.compare ("NO")) {
02720     return false;
02721   }
02722   else if (!value.compare ("FALSE")) {
02723     return false;
02724   }
02725   else if (!value.compare ("F")) {
02726     return false;
02727   }
02728   else if (!value.compare ("N")) {
02729     return false;
02730   }
02731   else if (!value.compare ("YES")) {
02732     return true;
02733   }
02734   else if (!value.compare ("TRUE")) {
02735     return true;
02736   }
02737   else if (!value.compare ("Y")) {
02738     return true;
02739   }
02740   else if (!value.compare ("T")) {
02741     return true;
02742   }
02743   else {
02744     string message = "Invalid boolean value [" + value + "].";
02745     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
02746   }
02747   return false;
02748 }
02749 
02750 
02756 void IsisAml::CommandLine (Isis::Pvl &cont) const {
02757   Isis::PvlGroup group("UserParameters");
02758 
02759   // Add appropriate keywords
02760   for (unsigned int g=0; g<groups.size(); g++) {
02761     for (unsigned int p=0; p<groups[g].parameters.size(); p++) {
02762       const IsisParameterData *param = ReturnParam (ParamName(g, p));
02763       // If this param has a value add it to the command line
02764       if (param->values.size() > 0) {
02765         group += Isis::PvlKeyword(param->name, param->values[0]);
02766       }
02767 
02768       // Or if it has a default value add it to the command line
02769       else if (param->defaultValues.size() > 0) {
02770         group += Isis::PvlKeyword(param->name, param->defaultValues[0]);
02771       }
02772     }
02773   }
02774   // Remove excluded keywords
02775   for (unsigned int g=0; g<groups.size(); g++) {
02776     for (unsigned int p=0; p<groups[g].parameters.size(); p++) {
02777       const IsisParameterData *param = ReturnParam (ParamName(g, p));
02778 
02779       if (((param->values.size() > 0) || (param->defaultValues.size())) > 0) {
02780         for (unsigned int o2=0; o2<param->listOptions.size(); o2++) {
02781           Isis::iString value, option;
02782           if (param->type == "string") {
02783             value = GetAsString (param->name);
02784             value = value.UpCase ();
02785             option = param->listOptions[o2].value;
02786             option = option.UpCase ();
02787           }
02788           else if (param->type == "integer") {
02789             value = GetAsString (param->name);
02790             value = value.Trim ("\n\r\t\f\v\b");
02791             option = param->listOptions[o2].value;
02792             option = option.Trim ("\n\r\t\f\v\b");
02793           }
02794           if (value == option) {
02795             for (unsigned int e2=0;e2<param->listOptions[o2].exclude.size();e2++) {
02796               const IsisParameterData *param2 =
02797                   ReturnParam (param->listOptions[o2].exclude[e2]);
02798               if (group.HasKeyword(param2->name)) {
02799                 group.DeleteKeyword(param2->name);
02800               }
02801             }
02802           }
02803         }
02804       }
02805     }
02806   }
02807 
02808   cont.Clear();
02809   cont.AddGroup(group);
02810   return;
02811 }
02812 
02813 
02819 string IsisAml::Version () const {
02820   string st = "000-00-00";
02821   for (unsigned int i=0; i<changes.size(); i++) {
02822     if (changes[i].date > st ) st = changes[i].date;
02823   }
02824   return st;
02825 }
02826 
02827 
02835 void IsisAml::StartParser (const char *xmlfile) {
02836 
02837   // Initialize the XML system
02838   try {
02839     XERCES::XMLPlatformUtils::Initialize();
02840   }
02841 
02842   catch (const XERCES::XMLException& toCatch) {
02843     string message = "Error during XML parser initialization" +
02844                      (string)XERCES::XMLString::transcode(toCatch.getMessage());
02845     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
02846     return;
02847   }
02848 
02849   //
02850   //  Create a SAX parser object. Then, set it to validate for an IsisAml file
02851   //
02852   parser = XERCES::XMLReaderFactory::createXMLReader();
02853 
02854 //  SAX2XMLReader::ValSchemes valScheme = SAX2XMLReader::Val_Auto;
02855   XERCES::SAX2XMLReader::ValSchemes valScheme = XERCES::SAX2XMLReader::Val_Never;
02856   if (valScheme == XERCES::SAX2XMLReader::Val_Auto) {
02857     parser->setFeature(XERCES::XMLString::transcode("http://xml.org/sax/features/validation"), true);
02858     parser->setFeature(XERCES::XMLString::transcode("http://apache.org/xml/features/validation/dynamic"), true);
02859   }
02860   else if (valScheme == XERCES::SAX2XMLReader::Val_Never) {
02861     parser->setFeature(XERCES::XMLString::transcode("http://xml.org/sax/features/validation"), false);
02862   }
02863 
02864   else if (valScheme == XERCES::SAX2XMLReader::Val_Always) {
02865     parser->setFeature(XERCES::XMLString::transcode("http://xml.org/sax/features/validation"), true);
02866     parser->setFeature(XERCES::XMLString::transcode("http://apache.org/xml/features/validation/dynamic"), false);
02867   }
02868 
02869 //  bool doSchema = true;
02870   bool doSchema = false;
02871   parser->setFeature(XERCES::XMLString::transcode("http://apache.org/xml/features/validation/schema"), doSchema);
02872 
02873   bool schemaFullChecking = false;
02874   parser->setFeature(XERCES::XMLString::transcode("http://apache.org/xml/features/validation/schema-full-checking"), schemaFullChecking);
02875 
02876   //  Create the handler object for an application
02877   //  Then parse the file
02878   char* encodingName = "LATIN1";
02879   bool expandNamespaces = false ;
02880 
02881   try {
02882     IsisAmlData *mydata = this;
02883     appHandler = new IsisXMLApplication (encodingName, expandNamespaces, parser, mydata);
02884     parser->parse(xmlfile);
02885   }
02886   catch (const XERCES::XMLException& toCatch) {
02887     string message = "Error in application XML file: " +
02888                      (string)XERCES::XMLString::transcode(toCatch.getMessage());
02889     throw Isis::iException::Message(Isis::iException::Programmer,message, _FILEINFO_);
02890     XERCES::XMLPlatformUtils::Terminate();
02891     return;
02892   }
02893 
02894   //  Delete the parser
02895   delete parser;
02896   XERCES::XMLPlatformUtils::Terminate();
02897   delete appHandler;
02898   return;
02899 }
02900