Isis 3 Programmer Reference
IsisAml.h
Go to the documentation of this file.
1 #ifndef IsisAml_h
2 #define IsisAml_h
3 
27 #include <string>
28 #include <vector>
29 
30 #include <QString>
31 
32 #include <xercesc/sax2/SAX2XMLReader.hpp>
33 
34 #include "IsisXMLApplication.h"
35 #include "IsisAmlData.h"
36 #include "Pvl.h"
37 
38 class QString;
39 
154 class IsisAml : protected IsisAmlData {
155 
156 // Public section
157  public:
158 
159  IsisAml(const QString &xmlfile);
160 
161  ~IsisAml();
162 
163 
164  // Methods for searching and retrieving application info
165  // via the parameter name
166 
167  void PutAsString(const QString &paramName, const QString &value);
168  void PutAsString(const QString &paramName, const std::vector<QString> &value);
169 
170  void PutFileName(const QString &paramName, const QString &value);
171  void PutFileName(const QString &paramName, const std::vector<QString> &value);
172 
173  void PutDouble(const QString &paramName, const double &value);
174  void PutDouble(const QString &paramName, const std::vector<double> &value);
175 
176  void PutInteger(const QString &paramName, const int &value);
177  void PutInteger(const QString &paramName, const std::vector<int> &value);
178 
179  void PutBoolean(const QString &paramName, const bool &value);
180  void PutBoolean(const QString &paramName, const std::vector<bool> &value);
181 
182  void PutString(const QString &paramName, const QString &value);
183  void PutString(const QString &paramName, const std::vector<QString> &value);
184 
185  QString GetAsString(const QString &paramName) const;
186  void GetAsString(const QString &paramName, std::vector<QString> &values) const;
187 
188  QString GetFileName(const QString &paramName, QString extension = "") const;
189  void GetFileName(const QString &paramName, std::vector<QString> &values) const;
190 
191  QString GetString(const QString &paramName) const;
192  void GetString(const QString &paramName, std::vector<QString> &values) const;
193 
194  int GetInteger(const QString &paramName) const;
195  void GetInteger(const QString &paramName, std::vector<int> &values) const;
196 
197  bool GetBoolean(const QString &paramName) const;
198 
199  void GetBoolean(const QString &paramName, std::vector<bool> &values) const;
200 
201  double GetDouble(const QString &paramName) const;
202  void GetDouble(const QString &paramName, std::vector<double> &values) const;
203 
204  bool WasEntered(const QString &paramName) const;
205  void Clear(const QString &paramName);
206 
207  Isis::CubeAttributeInput &GetInputAttribute(const QString &paramName);
208  Isis::CubeAttributeOutput &GetOutputAttribute(const QString &paramName);
209 
210  // Methods for retrieving application info not inside a group
211 
212  QString ProgramName() const;
213  QString Brief() const;
214  QString Description() const;
215 
216  // Methods for searching and retrieving application info
217  // via the index into groups and parameters
218 
219  int NumGroups() const;
220 
221  QString GroupName(const int &group) const;
222 
224  int GroupIndex(const QString & grpName) const;
225 
226  int NumParams(const int &) const;
227 
228  QString ParamName(const int &group, const int &param) const;
229 
230  QString ParamType(const int &group, const int &param) const;
231 
232  QString ParamBrief(const int &group, const int &param) const;
233 
234  QString ParamDescription(const int &group, const int &param) const;
235 
236  QString ParamMinimum(const int &group, const int &param) const;
237 
238  QString ParamMinimumInclusive(const int &group, const int &param) const;
239 
240  QString ParamMaximum(const int &group, const int &param) const;
241 
242  QString ParamMaximumInclusive(const int &group, const int &param) const;
243 
244  QString ParamOdd(const int &group, const int &param) const;
245 
246  int ParamGreaterThanSize(const int &group, const int &param) const;
247 
248  int ParamGreaterThanOrEqualSize(const int &group, const int &param) const;
249 
250  int ParamLessThanSize(const int &group, const int &param) const;
251 
252  int ParamLessThanOrEqualSize(const int &group, const int &param) const;
253 
254  int ParamNotEqualSize(const int &group, const int &param) const;
255 
256  QString ParamGreaterThan(const int &group, const int &param,
257  const int &great) const;
258 
259  QString ParamGreaterThanOrEqual(const int &group, const int &param,
260  const int &great) const;
261 
262  QString ParamLessThan(const int &group, const int &param,
263  const int &great) const;
264 
265  QString ParamLessThanOrEqual(const int &group, const int &param,
266  const int &les) const;
267 
268  QString ParamNotEqual(const int &group, const int &param,
269  const int &notEq) const;
270 
271  int ParamListSize(const int &group, const int &param) const;
272 
273  QString ParamListValue(const int &group, const int &param,
274  const int &option) const;
275 
276  QString ParamListBrief(const int &group, const int &param,
277  const int &option) const;
278 
279  QString ParamListDescription(const int &group, const int &param,
280  const int &option) const;
281 
282  int ParamListExcludeSize(const int &group, const int &param,
283  const int &option) const;
284 
285  QString ParamListExclude(const int &group, const int &param,
286  const int &option, const int &exclude) const;
287 
288  int ParamListIncludeSize(const int &group, const int &param,
289  const int &option) const;
290 
291  QString ParamListInclude(const int &group, const int &param,
292  const int &option, const int &include) const;
293 
294  QString ParamDefault(const int &group, const int &param) const;
295 
296  QString ParamInternalDefault(const int &group, const int &param) const;
297 
298  QString ParamFilter(const int &group, const int &param) const;
299 
300  QString ParamPath(const int &group, const int &param) const;
301 
302  QString ParamFileMode(const int &group, const int &param) const;
303 
304  int ParamExcludeSize(const int &group, const int &param) const;
305 
306  QString ParamExclude(const int &group, const int &param,
307  const int &exclude) const;
308  int ParamIncludeSize(const int &group, const int &param) const;
309 
310  QString ParamInclude(const int &group, const int &param,
311  const int &include) const;
312 
313  QString PixelType(const int &group, const int &param) const;
314 
315  int HelpersSize(const int &group, const int &param) const;
316 
317  QString HelperButtonName(const int &group, const int &param,
318  const int &helper) const;
319 
320  QString HelperFunction(const int &group, const int &param,
321  const int &helper) const;
322 
323  QString HelperBrief(const int &group, const int &param,
324  const int &helper) const;
325 
326  QString HelperDescription(const int &group, const int &param,
327  const int &helper) const;
328 
329  QString HelperIcon(const int &group, const int &param,
330  const int &helper) const;
331 
334  bool IsParamInPvlInclude(QString & paramName, std::vector<QString> & exclude);
335 
337  void CreatePVL(Isis::Pvl &pvlDef , QString guiGrpName, QString pvlObjName,
338  QString pvlGrpName, std::vector<QString> & exclude);
339 
340  // Test all parameters for valid values and conditions
341  void VerifyAll();
342 
343  bool StringToBool(QString value) const;
344 
345  void CommandLine(Isis::Pvl &lab) const;
346 
347  QString Version() const;
348 
349 
350  protected:
351  const IsisParameterData *ReturnParam(const QString &paramName) const;
352 
353 
354  private:
356  XERCES::SAX2XMLReader *parser;
359 
360  // Member functions
361  void StartParser(const char *xmlfile);
362 
363 
364  void Verify(const IsisParameterData *param);
365 
366  void CheckFileNamePreference(QString filename, QString paramname);
367 };
368 
369 
370 #endif
Manipulate and parse attributes of input cube filenames.
int NumParams(const int &) const
Returns the number of parameters in a group.
Definition: IsisAml.cpp:1223
QString ParamListBrief(const int &group, const int &param, const int &option) const
Returns the brief description for a specific option to a parameter.
Definition: IsisAml.cpp:1646
int ParamLessThanOrEqualSize(const int &group, const int &param) const
Returns the number of values in the parameters less than or equal list.
Definition: IsisAml.cpp:1377
QString ProgramName() const
Returns the Program name.
Definition: IsisAml.cpp:1073
QString GetFileName(const QString &paramName, QString extension="") const
Allows the retrieval of a value for a parameter of type "filename".
Definition: IsisAml.cpp:623
int NumGroups() const
Returns the number of groups found in the XML.
Definition: IsisAml.cpp:1103
bool IsParamInPvlInclude(QString &paramName, std::vector< QString > &exclude)
Verify whether Parameter name is in the Include list Used in creation of DefFile. ...
Definition: IsisAml.cpp:1207
int ParamListSize(const int &group, const int &param) const
Returns the number of options in the specified parameter&#39;s list.
Definition: IsisAml.cpp:1617
int ParamGreaterThanSize(const int &group, const int &param) const
Returns the number of values in the parameters greater than list.
Definition: IsisAml.cpp:1340
int HelpersSize(const int &group, const int &param) const
Returns the number of helpers the parameter has.
Definition: IsisAml.cpp:1771
bool StringToBool(QString value) const
Returns a boolean value based on the QString contents.
Definition: IsisAml.cpp:2883
int ParamListExcludeSize(const int &group, const int &param, const int &option) const
Returns the number of items in a parameters list exclude section.
Definition: IsisAml.cpp:1676
QString Description() const
Returns the full description of the program.
Definition: IsisAml.cpp:1094
QString ParamMaximum(const int &group, const int &param) const
Returns the maximum value of a parameter in a specified group.
Definition: IsisAml.cpp:1287
IsisAml(const QString &xmlfile)
Constructs an IsisAml object and internalizes the XML data in the given file name.
Definition: IsisAml.cpp:54
QString GetAsString(const QString &paramName) const
Allows the retrieval of a value for a parameter of any type.
Definition: IsisAml.cpp:553
void PutAsString(const QString &paramName, const QString &value)
Allows the insertion of a value for any parameter.
Definition: IsisAml.cpp:81
void CreatePVL(Isis::Pvl &pvlDef, QString guiGrpName, QString pvlObjName, QString pvlGrpName, std::vector< QString > &exclude)
Create Pvl with the parameters in a user defined group given the Pvl object and group name...
Definition: IsisAml.cpp:1150
bool GetBoolean(const QString &paramName) const
Allows the retrieval of a value for a parameter of type "boolean".
Definition: IsisAml.cpp:989
int ParamIncludeSize(const int &group, const int &param) const
Returns the number of parameters included in this parameter&#39;s inclusions.
Definition: IsisAml.cpp:1747
void PutInteger(const QString &paramName, const int &value)
Allows the insertion of a value for a parameter of type "integer".
Definition: IsisAml.cpp:291
const IsisParameterData * ReturnParam(const QString &paramName) const
Returns a pointer to a parameter whose name starts with paramName.
Definition: IsisAml.cpp:1981
QString ParamType(const int &group, const int &param) const
Returns the parameter type of a parameter in a specified group.
Definition: IsisAml.cpp:1508
QString Version() const
Returns the application version date.
Definition: IsisAml.cpp:3003
int ParamListIncludeSize(const int &group, const int &param, const int &option) const
Returns the number of items in a parameters list include section.
Definition: IsisAml.cpp:1706
QString GroupName(const int &group) const
Returns the group name of group[index].
Definition: IsisAml.cpp:1114
void StartParser(const char *xmlfile)
Starts parsing an application xml file.
Definition: IsisAml.cpp:3019
QString ParamInternalDefault(const int &group, const int &param) const
Returns the internal default for a parameter in a specified group.
Definition: IsisAml.cpp:1540
QString PixelType(const int &group, const int &param) const
Returns the default pixel type from the XML.
Definition: IsisAml.cpp:1759
QString ParamListExclude(const int &group, const int &param, const int &option, const int &exclude) const
Returns the parameter name to be excluded if this option is selected.
Definition: IsisAml.cpp:1691
XERCES::SAX2XMLReader * parser
The XML file parser.
Definition: IsisAml.h:356
QString ParamGreaterThanOrEqual(const int &group, const int &param, const int &great) const
Returns the name of the specified greaterThanOrEqual parameter.
Definition: IsisAml.cpp:1418
QString ParamNotEqual(const int &group, const int &param, const int &notEq) const
Returns the name of the specified notEqual parameter.
Definition: IsisAml.cpp:1463
QString HelperButtonName(const int &group, const int &param, const int &helper) const
Returns the name of the helper button.
Definition: IsisAml.cpp:1784
QString ParamOdd(const int &group, const int &param) const
Returns whether the selected parameter has a restriction on odd values or not.
Definition: IsisAml.cpp:1327
QString Brief() const
Returns the brief description of the program.
Definition: IsisAml.cpp:1084
QString ParamListInclude(const int &group, const int &param, const int &option, const int &include) const
Returns the parameter name to be included if this option is selected.
Definition: IsisAml.cpp:1721
void PutBoolean(const QString &paramName, const bool &value)
Allows the insertion of a value for a parameter of type "boolean".
Definition: IsisAml.cpp:462
QString ParamPath(const int &group, const int &param) const
Returns the default path for a filename/cube parameter.
Definition: IsisAml.cpp:1578
QString HelperDescription(const int &group, const int &param, const int &helper) const
Returns the long description of the helper button.
Definition: IsisAml.cpp:1826
void PutFileName(const QString &paramName, const QString &value)
Allows the insertion of a value for a parameter of type "filename".
Definition: IsisAml.cpp:211
Manipulate and parse attributes of output cube filenames.
void PutString(const QString &paramName, const QString &value)
Allows the insertion of a value for any parameter.
Definition: IsisAml.cpp:144
QString ParamFilter(const int &group, const int &param) const
Returns the parameter filter for a parameter in a specified group.
Definition: IsisAml.cpp:1559
QString HelperFunction(const int &group, const int &param, const int &helper) const
Returns the name of the helper function.
Definition: IsisAml.cpp:1798
Isis::CubeAttributeInput & GetInputAttribute(const QString &paramName)
Gets the attributes for an input cube.
Definition: IsisAml.cpp:1890
double GetDouble(const QString &paramName) const
Allows the retrieval of a value for a parameter of type "double".
Definition: IsisAml.cpp:907
int ParamLessThanSize(const int &group, const int &param) const
Returns the number of values in the parameters less than list.
Definition: IsisAml.cpp:1365
void Clear(const QString &paramName)
Clears the value(s) in the named parameter.
Definition: IsisAml.cpp:1868
void Verify(const IsisParameterData *param)
Throws an Isis::iExceptionXxxxxxxx if the parameter value(s) is invalid.
Definition: IsisAml.cpp:2033
void CommandLine(Isis::Pvl &lab) const
Creates a QString which could be used as a command line.
Definition: IsisAml.cpp:2926
Container for cube-like labels.
Definition: Pvl.h:135
~IsisAml()
Destructs an IsisAml object.
Definition: IsisAml.cpp:61
QString ParamMaximumInclusive(const int &group, const int &param) const
Returns whether the maximum value is inclusive or not.
Definition: IsisAml.cpp:1313
QString ParamMinimum(const int &group, const int &param) const
Returns the minimum value of a parameter in a specified group.
Definition: IsisAml.cpp:1274
int GroupIndex(const QString &grpName) const
Given the group name get its index in group array.
Definition: IsisAml.cpp:1128
Application program XML file parameter manager.
Definition: IsisAml.h:154
int GetInteger(const QString &paramName) const
Allows the retrieval of a value for a parameter of type "integer".
Definition: IsisAml.cpp:823
Isis::CubeAttributeOutput & GetOutputAttribute(const QString &paramName)
Gets the attributes for an output cube.
Definition: IsisAml.cpp:1935
IsisXMLApplication * appHandler
The application handler.
Definition: IsisAml.h:358
int ParamExcludeSize(const int &group, const int &param) const
Returns the number of parameters excluded in this parameter&#39;s exclusions.
Definition: IsisAml.cpp:1735
int ParamGreaterThanOrEqualSize(const int &group, const int &param) const
Returns the number of values in the parameters greater than or equal list.
Definition: IsisAml.cpp:1352
QString ParamFileMode(const int &group, const int &param) const
Returns the file mode for a parameter in a specified group.
Definition: IsisAml.cpp:1597
void VerifyAll()
Verify all parameters.
Definition: IsisAml.cpp:2403
QString ParamDefault(const int &group, const int &param) const
Returns the default for a parameter in a specified group.
Definition: IsisAml.cpp:1521
QString ParamListDescription(const int &group, const int &param, const int &option) const
Returns the full description for a specific option to a parameter.
Definition: IsisAml.cpp:1661
QString ParamLessThanOrEqual(const int &group, const int &param, const int &les) const
Returns the name of the specified lessThanOrEqual parameter.
Definition: IsisAml.cpp:1448
QString ParamMinimumInclusive(const int &group, const int &param) const
Returns whether the minimum value is inclusive or not.
Definition: IsisAml.cpp:1300
void CheckFileNamePreference(QString filename, QString paramname)
This method checks whether the user preferences are set to allow overwrites of existing files...
Definition: IsisAml.cpp:2383
QString ParamBrief(const int &group, const int &param) const
Returns the brief description of a parameter in a specified group.
Definition: IsisAml.cpp:1248
QString ParamGreaterThan(const int &group, const int &param, const int &great) const
Returns the name of the specified greaterThan parameter.
Definition: IsisAml.cpp:1403
QString ParamName(const int &group, const int &param) const
Returns the parameter name.
Definition: IsisAml.cpp:1235
QString ParamDescription(const int &group, const int &param) const
Returns the long description of a parameter in a specified group.
Definition: IsisAml.cpp:1261
QString ParamLessThan(const int &group, const int &param, const int &great) const
Returns the name of the specified lessThan parameter.
Definition: IsisAml.cpp:1433
QString GetString(const QString &paramName) const
Allows the retrieval of a value for a parameter of type "string".
Definition: IsisAml.cpp:708
QString ParamListValue(const int &group, const int &param, const int &option) const
Returns the option value for a specific option to a parameter.
Definition: IsisAml.cpp:1631
QString ParamExclude(const int &group, const int &param, const int &exclude) const
Returns the name of the specified excluded parameter.
Definition: IsisAml.cpp:1478
void PutDouble(const QString &paramName, const double &value)
Allows the insertion of a value for a parameter of type "double".
Definition: IsisAml.cpp:377
bool WasEntered(const QString &paramName) const
Returns a true if the parameter has a value, and false if it does not.
Definition: IsisAml.cpp:1852
int ParamNotEqualSize(const int &group, const int &param) const
Returns the number of values in the not equal list.
Definition: IsisAml.cpp:1390
QString ParamInclude(const int &group, const int &param, const int &include) const
Returns the name of the specified included parameter.
Definition: IsisAml.cpp:1493
QString HelperBrief(const int &group, const int &param, const int &helper) const
Returns the brief description of the helper button.
Definition: IsisAml.cpp:1812
QString HelperIcon(const int &group, const int &param, const int &helper) const
Returns the name of the icon for the helper button.
Definition: IsisAml.cpp:1840