Isis 3 Programmer Reference
IsisAml.h
1 #ifndef IsisAml_h
2 #define IsisAml_h
3 
9 /* SPDX-License-Identifier: CC0-1.0 */
10 
11 #include <string>
12 #include <vector>
13 
14 #include <QString>
15 
16 #include <xercesc/sax2/SAX2XMLReader.hpp>
17 
18 #include "IsisXMLApplication.h"
19 #include "IsisAmlData.h"
20 #include "Pvl.h"
21 
22 class QString;
23 
138 class IsisAml : protected IsisAmlData {
139 
140 // Public section
141  public:
142 
143  IsisAml(const QString &xmlfile);
144 
145  ~IsisAml();
146 
147 
148  // Methods for searching and retrieving application info
149  // via the parameter name
150 
151  void PutAsString(const QString &paramName, const QString &value);
152  void PutAsString(const QString &paramName, const std::vector<QString> &value);
153 
154  void PutFileName(const QString &paramName, const QString &value);
155  void PutFileName(const QString &paramName, const std::vector<QString> &value);
156 
157  void PutDouble(const QString &paramName, const double &value);
158  void PutDouble(const QString &paramName, const std::vector<double> &value);
159 
160  void PutInteger(const QString &paramName, const int &value);
161  void PutInteger(const QString &paramName, const std::vector<int> &value);
162 
163  void PutBoolean(const QString &paramName, const bool &value);
164  void PutBoolean(const QString &paramName, const std::vector<bool> &value);
165 
166  void PutString(const QString &paramName, const QString &value);
167  void PutString(const QString &paramName, const std::vector<QString> &value);
168 
169  QString GetAsString(const QString &paramName) const;
170  void GetAsString(const QString &paramName, std::vector<QString> &values) const;
171 
172  QString GetFileName(const QString &paramName, QString extension = "") const;
173  void GetFileName(const QString &paramName, std::vector<QString> &values) const;
174 
175  QString GetString(const QString &paramName) const;
176  void GetString(const QString &paramName, std::vector<QString> &values) const;
177 
178  int GetInteger(const QString &paramName) const;
179  void GetInteger(const QString &paramName, std::vector<int> &values) const;
180 
181  bool GetBoolean(const QString &paramName) const;
182 
183  void GetBoolean(const QString &paramName, std::vector<bool> &values) const;
184 
185  double GetDouble(const QString &paramName) const;
186  void GetDouble(const QString &paramName, std::vector<double> &values) const;
187 
188  bool WasEntered(const QString &paramName) const;
189  void Clear(const QString &paramName);
190 
191  Isis::CubeAttributeInput &GetInputAttribute(const QString &paramName);
192  Isis::CubeAttributeOutput &GetOutputAttribute(const QString &paramName);
193 
194  // Methods for retrieving application info not inside a group
195 
196  QString ProgramName() const;
197  QString Brief() const;
198  QString Description() const;
199 
200  // Methods for searching and retrieving application info
201  // via the index into groups and parameters
202 
203  int NumGroups() const;
204 
205  QString GroupName(const int &group) const;
206 
208  int GroupIndex(const QString & grpName) const;
209 
210  int NumParams(const int &) const;
211 
212  QString ParamName(const int &group, const int &param) const;
213 
214  QString ParamType(const int &group, const int &param) const;
215 
216  QString ParamBrief(const int &group, const int &param) const;
217 
218  QString ParamDescription(const int &group, const int &param) const;
219 
220  QString ParamMinimum(const int &group, const int &param) const;
221 
222  QString ParamMinimumInclusive(const int &group, const int &param) const;
223 
224  QString ParamMaximum(const int &group, const int &param) const;
225 
226  QString ParamMaximumInclusive(const int &group, const int &param) const;
227 
228  QString ParamOdd(const int &group, const int &param) const;
229 
230  int ParamGreaterThanSize(const int &group, const int &param) const;
231 
232  int ParamGreaterThanOrEqualSize(const int &group, const int &param) const;
233 
234  int ParamLessThanSize(const int &group, const int &param) const;
235 
236  int ParamLessThanOrEqualSize(const int &group, const int &param) const;
237 
238  int ParamNotEqualSize(const int &group, const int &param) const;
239 
240  QString ParamGreaterThan(const int &group, const int &param,
241  const int &great) const;
242 
243  QString ParamGreaterThanOrEqual(const int &group, const int &param,
244  const int &great) const;
245 
246  QString ParamLessThan(const int &group, const int &param,
247  const int &great) const;
248 
249  QString ParamLessThanOrEqual(const int &group, const int &param,
250  const int &les) const;
251 
252  QString ParamNotEqual(const int &group, const int &param,
253  const int &notEq) const;
254 
255  int ParamListSize(const int &group, const int &param) const;
256 
257  QString ParamListValue(const int &group, const int &param,
258  const int &option) const;
259 
260  QString ParamListBrief(const int &group, const int &param,
261  const int &option) const;
262 
263  QString ParamListDescription(const int &group, const int &param,
264  const int &option) const;
265 
266  int ParamListExcludeSize(const int &group, const int &param,
267  const int &option) const;
268 
269  QString ParamListExclude(const int &group, const int &param,
270  const int &option, const int &exclude) const;
271 
272  int ParamListIncludeSize(const int &group, const int &param,
273  const int &option) const;
274 
275  QString ParamListInclude(const int &group, const int &param,
276  const int &option, const int &include) const;
277 
278  QString ParamDefault(const int &group, const int &param) const;
279 
280  QString ParamInternalDefault(const int &group, const int &param) const;
281 
282  QString ParamFilter(const int &group, const int &param) const;
283 
284  QString ParamPath(const int &group, const int &param) const;
285 
286  QString ParamFileMode(const int &group, const int &param) const;
287 
288  int ParamExcludeSize(const int &group, const int &param) const;
289 
290  QString ParamExclude(const int &group, const int &param,
291  const int &exclude) const;
292  int ParamIncludeSize(const int &group, const int &param) const;
293 
294  QString ParamInclude(const int &group, const int &param,
295  const int &include) const;
296 
297  QString PixelType(const int &group, const int &param) const;
298 
299  int HelpersSize(const int &group, const int &param) const;
300 
301  QString HelperButtonName(const int &group, const int &param,
302  const int &helper) const;
303 
304  QString HelperFunction(const int &group, const int &param,
305  const int &helper) const;
306 
307  QString HelperBrief(const int &group, const int &param,
308  const int &helper) const;
309 
310  QString HelperDescription(const int &group, const int &param,
311  const int &helper) const;
312 
313  QString HelperIcon(const int &group, const int &param,
314  const int &helper) const;
315 
318  bool IsParamInPvlInclude(QString & paramName, std::vector<QString> & exclude);
319 
321  void CreatePVL(Isis::Pvl &pvlDef , QString guiGrpName, QString pvlObjName,
322  QString pvlGrpName, std::vector<QString> & exclude);
323 
324  // Test all parameters for valid values and conditions
325  void VerifyAll();
326 
327  bool StringToBool(QString value) const;
328 
329  void CommandLine(Isis::Pvl &lab) const;
330 
331  QString Version() const;
332 
333 
334  protected:
335  const IsisParameterData *ReturnParam(const QString &paramName) const;
336 
337 
338  private:
340  XERCES::SAX2XMLReader *parser;
343 
344  // Member functions
345  void StartParser(const char *xmlfile);
346 
347 
348  void Verify(const IsisParameterData *param);
349 
350  void CheckFileNamePreference(QString filename, QString paramname);
351 };
352 
353 
354 #endif
IsisAml::HelperIcon
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:1824
IsisAml::GetOutputAttribute
Isis::CubeAttributeOutput & GetOutputAttribute(const QString &paramName)
Gets the attributes for an output cube.
Definition: IsisAml.cpp:1919
IsisXMLApplication
This is free and unencumbered software released into the public domain.
Definition: IsisXMLApplication.h:19
IsisAml::PutAsString
void PutAsString(const QString &paramName, const QString &value)
Allows the insertion of a value for any parameter.
Definition: IsisAml.cpp:65
IsisAml::PutFileName
void PutFileName(const QString &paramName, const QString &value)
Allows the insertion of a value for a parameter of type "filename".
Definition: IsisAml.cpp:195
IsisAml::ParamListSize
int ParamListSize(const int &group, const int &param) const
Returns the number of options in the specified parameter's list.
Definition: IsisAml.cpp:1601
IsisAml::HelperDescription
QString HelperDescription(const int &group, const int &param, const int &helper) const
Returns the long description of the helper button.
Definition: IsisAml.cpp:1810
IsisAml::CheckFileNamePreference
void CheckFileNamePreference(QString filename, QString paramname)
This method checks whether the user preferences are set to allow overwrites of existing files.
Definition: IsisAml.cpp:2367
IsisAml::parser
XERCES::SAX2XMLReader * parser
The XML file parser.
Definition: IsisAml.h:340
IsisAml::GetAsString
QString GetAsString(const QString &paramName) const
Allows the retrieval of a value for a parameter of any type.
Definition: IsisAml.cpp:537
IsisAml::ParamListValue
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:1615
IsisAml::NumGroups
int NumGroups() const
Returns the number of groups found in the XML.
Definition: IsisAml.cpp:1087
IsisAml::ParamMinimumInclusive
QString ParamMinimumInclusive(const int &group, const int &param) const
Returns whether the minimum value is inclusive or not.
Definition: IsisAml.cpp:1284
IsisAml::appHandler
IsisXMLApplication * appHandler
The application handler.
Definition: IsisAml.h:342
IsisAml::CreatePVL
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:1134
IsisAml::ParamBrief
QString ParamBrief(const int &group, const int &param) const
Returns the brief description of a parameter in a specified group.
Definition: IsisAml.cpp:1232
IsisAml::ParamGreaterThanOrEqual
QString ParamGreaterThanOrEqual(const int &group, const int &param, const int &great) const
Returns the name of the specified greaterThanOrEqual parameter.
Definition: IsisAml.cpp:1402
IsisAml::HelpersSize
int HelpersSize(const int &group, const int &param) const
Returns the number of helpers the parameter has.
Definition: IsisAml.cpp:1755
IsisAml::GetFileName
QString GetFileName(const QString &paramName, QString extension="") const
Allows the retrieval of a value for a parameter of type "filename".
Definition: IsisAml.cpp:607
IsisParameterData
Definition: IsisAmlData.h:53
IsisAml::GetDouble
double GetDouble(const QString &paramName) const
Allows the retrieval of a value for a parameter of type "double".
Definition: IsisAml.cpp:891
IsisAml::PutString
void PutString(const QString &paramName, const QString &value)
Allows the insertion of a value for any parameter.
Definition: IsisAml.cpp:128
IsisAml::ParamMaximum
QString ParamMaximum(const int &group, const int &param) const
Returns the maximum value of a parameter in a specified group.
Definition: IsisAml.cpp:1271
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::CubeAttributeOutput
Manipulate and parse attributes of output cube filenames.
Definition: CubeAttribute.h:473
IsisAml::HelperFunction
QString HelperFunction(const int &group, const int &param, const int &helper) const
Returns the name of the helper function.
Definition: IsisAml.cpp:1782
IsisAml::PutBoolean
void PutBoolean(const QString &paramName, const bool &value)
Allows the insertion of a value for a parameter of type "boolean".
Definition: IsisAml.cpp:446
IsisAml::ParamListDescription
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:1645
IsisAml::StartParser
void StartParser(const char *xmlfile)
Starts parsing an application xml file.
Definition: IsisAml.cpp:3003
IsisAml::ParamGreaterThan
QString ParamGreaterThan(const int &group, const int &param, const int &great) const
Returns the name of the specified greaterThan parameter.
Definition: IsisAml.cpp:1387
IsisAml::ParamDefault
QString ParamDefault(const int &group, const int &param) const
Returns the default for a parameter in a specified group.
Definition: IsisAml.cpp:1505
IsisAmlData
Definition: IsisAmlData.h:124
IsisAml::IsParamInPvlInclude
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:1191
IsisAml::ParamListBrief
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:1630
IsisAml::GetInputAttribute
Isis::CubeAttributeInput & GetInputAttribute(const QString &paramName)
Gets the attributes for an input cube.
Definition: IsisAml.cpp:1874
IsisAml::ParamIncludeSize
int ParamIncludeSize(const int &group, const int &param) const
Returns the number of parameters included in this parameter's inclusions.
Definition: IsisAml.cpp:1731
IsisAml::ParamType
QString ParamType(const int &group, const int &param) const
Returns the parameter type of a parameter in a specified group.
Definition: IsisAml.cpp:1492
IsisAml::ParamInternalDefault
QString ParamInternalDefault(const int &group, const int &param) const
Returns the internal default for a parameter in a specified group.
Definition: IsisAml.cpp:1524
IsisAml::ParamListExcludeSize
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:1660
IsisAml::ParamPath
QString ParamPath(const int &group, const int &param) const
Returns the default path for a filename/cube parameter.
Definition: IsisAml.cpp:1562
IsisAml::GetBoolean
bool GetBoolean(const QString &paramName) const
Allows the retrieval of a value for a parameter of type "boolean".
Definition: IsisAml.cpp:973
IsisAml::GroupName
QString GroupName(const int &group) const
Returns the group name of group[index].
Definition: IsisAml.cpp:1098
IsisAml::VerifyAll
void VerifyAll()
Verify all parameters.
Definition: IsisAml.cpp:2387
IsisAml::ParamNotEqualSize
int ParamNotEqualSize(const int &group, const int &param) const
Returns the number of values in the not equal list.
Definition: IsisAml.cpp:1374
IsisAml::GroupIndex
int GroupIndex(const QString &grpName) const
Given the group name get its index in group array.
Definition: IsisAml.cpp:1112
IsisAml::HelperBrief
QString HelperBrief(const int &group, const int &param, const int &helper) const
Returns the brief description of the helper button.
Definition: IsisAml.cpp:1796
IsisAml::IsisAml
IsisAml(const QString &xmlfile)
Constructs an IsisAml object and internalizes the XML data in the given file name.
Definition: IsisAml.cpp:38
IsisAml::~IsisAml
~IsisAml()
Destructs an IsisAml object.
Definition: IsisAml.cpp:45
IsisAml
Application program XML file parameter manager.
Definition: IsisAml.h:138
IsisAml::ParamDescription
QString ParamDescription(const int &group, const int &param) const
Returns the long description of a parameter in a specified group.
Definition: IsisAml.cpp:1245
IsisAml::ParamExclude
QString ParamExclude(const int &group, const int &param, const int &exclude) const
Returns the name of the specified excluded parameter.
Definition: IsisAml.cpp:1462
IsisAml::ParamFileMode
QString ParamFileMode(const int &group, const int &param) const
Returns the file mode for a parameter in a specified group.
Definition: IsisAml.cpp:1581
IsisAml::ParamNotEqual
QString ParamNotEqual(const int &group, const int &param, const int &notEq) const
Returns the name of the specified notEqual parameter.
Definition: IsisAml.cpp:1447
IsisAml::ParamListInclude
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:1705
IsisAml::ParamMinimum
QString ParamMinimum(const int &group, const int &param) const
Returns the minimum value of a parameter in a specified group.
Definition: IsisAml.cpp:1258
IsisAml::ParamExcludeSize
int ParamExcludeSize(const int &group, const int &param) const
Returns the number of parameters excluded in this parameter's exclusions.
Definition: IsisAml.cpp:1719
IsisAml::ParamListExclude
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:1675
IsisAml::ParamInclude
QString ParamInclude(const int &group, const int &param, const int &include) const
Returns the name of the specified included parameter.
Definition: IsisAml.cpp:1477
IsisAml::ReturnParam
const IsisParameterData * ReturnParam(const QString &paramName) const
Returns a pointer to a parameter whose name starts with paramName.
Definition: IsisAml.cpp:1965
IsisAml::PixelType
QString PixelType(const int &group, const int &param) const
Returns the default pixel type from the XML.
Definition: IsisAml.cpp:1743
IsisAml::ParamGreaterThanOrEqualSize
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:1336
IsisAml::ParamGreaterThanSize
int ParamGreaterThanSize(const int &group, const int &param) const
Returns the number of values in the parameters greater than list.
Definition: IsisAml.cpp:1324
IsisAml::ParamLessThan
QString ParamLessThan(const int &group, const int &param, const int &great) const
Returns the name of the specified lessThan parameter.
Definition: IsisAml.cpp:1417
IsisAml::Version
QString Version() const
Returns the application version date.
Definition: IsisAml.cpp:2987
IsisAml::StringToBool
bool StringToBool(QString value) const
Returns a boolean value based on the QString contents.
Definition: IsisAml.cpp:2867
IsisAml::ParamListIncludeSize
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:1690
IsisAml::Clear
void Clear(const QString &paramName)
Clears the value(s) in the named parameter.
Definition: IsisAml.cpp:1852
IsisAml::WasEntered
bool WasEntered(const QString &paramName) const
Returns a true if the parameter has a value, and false if it does not.
Definition: IsisAml.cpp:1836
IsisAml::ParamLessThanSize
int ParamLessThanSize(const int &group, const int &param) const
Returns the number of values in the parameters less than list.
Definition: IsisAml.cpp:1349
IsisAml::Brief
QString Brief() const
Returns the brief description of the program.
Definition: IsisAml.cpp:1068
IsisAml::GetInteger
int GetInteger(const QString &paramName) const
Allows the retrieval of a value for a parameter of type "integer".
Definition: IsisAml.cpp:807
IsisAml::ParamLessThanOrEqualSize
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:1361
IsisAml::Description
QString Description() const
Returns the full description of the program.
Definition: IsisAml.cpp:1078
IsisAml::GetString
QString GetString(const QString &paramName) const
Allows the retrieval of a value for a parameter of type "string".
Definition: IsisAml.cpp:692
IsisAml::HelperButtonName
QString HelperButtonName(const int &group, const int &param, const int &helper) const
Returns the name of the helper button.
Definition: IsisAml.cpp:1768
IsisAml::CommandLine
void CommandLine(Isis::Pvl &lab) const
Creates a QString which could be used as a command line.
Definition: IsisAml.cpp:2910
IsisAml::PutInteger
void PutInteger(const QString &paramName, const int &value)
Allows the insertion of a value for a parameter of type "integer".
Definition: IsisAml.cpp:275
Isis::CubeAttributeInput
Manipulate and parse attributes of input cube filenames.
Definition: CubeAttribute.h:381
IsisAml::ParamLessThanOrEqual
QString ParamLessThanOrEqual(const int &group, const int &param, const int &les) const
Returns the name of the specified lessThanOrEqual parameter.
Definition: IsisAml.cpp:1432
IsisAml::PutDouble
void PutDouble(const QString &paramName, const double &value)
Allows the insertion of a value for a parameter of type "double".
Definition: IsisAml.cpp:361
IsisAml::ParamFilter
QString ParamFilter(const int &group, const int &param) const
Returns the parameter filter for a parameter in a specified group.
Definition: IsisAml.cpp:1543
IsisAml::Verify
void Verify(const IsisParameterData *param)
Throws an Isis::iExceptionXxxxxxxx if the parameter value(s) is invalid.
Definition: IsisAml.cpp:2017
IsisAml::ParamMaximumInclusive
QString ParamMaximumInclusive(const int &group, const int &param) const
Returns whether the maximum value is inclusive or not.
Definition: IsisAml.cpp:1297
IsisAml::ProgramName
QString ProgramName() const
Returns the Program name.
Definition: IsisAml.cpp:1057
IsisAml::ParamOdd
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:1311
IsisAml::ParamName
QString ParamName(const int &group, const int &param) const
Returns the parameter name.
Definition: IsisAml.cpp:1219
IsisAml::NumParams
int NumParams(const int &) const
Returns the number of parameters in a group.
Definition: IsisAml.cpp:1207