Isis Developer Reference
IsisAml.h
Go to the documentation of this file.
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 <nlohmann/json.hpp>
19
20#include "IsisXMLApplication.h"
21#include "IsisAmlData.h"
22#include "Pvl.h"
23
24class QString;
25
140class IsisAml : protected IsisAmlData {
141
142// Public section
143 public:
144
145 IsisAml(const QString &xmlfile);
146
147 ~IsisAml();
148
149
150 // Methods for searching and retrieving application info
151 // via the parameter name
152
153 void PutAsString(const QString &paramName, const QString &value);
154 void PutAsString(const QString &paramName, const std::vector<QString> &value);
155
156 void PutFileName(const QString &paramName, const QString &value);
157 void PutFileName(const QString &paramName, const std::vector<QString> &value);
158
159 void PutCubeName(const QString &paramName, const QString &value);
160
161 void PutDouble(const QString &paramName, const double &value);
162 void PutDouble(const QString &paramName, const std::vector<double> &value);
163
164 void PutInteger(const QString &paramName, const int &value);
165 void PutInteger(const QString &paramName, const std::vector<int> &value);
166
167 void PutBoolean(const QString &paramName, const bool &value);
168 void PutBoolean(const QString &paramName, const std::vector<bool> &value);
169
170 void PutString(const QString &paramName, const QString &value);
171 void PutString(const QString &paramName, const std::vector<QString> &value);
172
173 QString GetAsString(const QString &paramName) const;
174 void GetAsString(const QString &paramName, std::vector<QString> &values) const;
175
176 QString GetFileName(const QString &paramName, QString extension = "") const;
177 void GetFileName(const QString &paramName, std::vector<QString> &values) const;
178
179 QString GetCubeName(const QString &paramName, QString extension = "") const;
180
181 QString GetString(const QString &paramName) const;
182 void GetString(const QString &paramName, std::vector<QString> &values) const;
183
184 int GetInteger(const QString &paramName) const;
185 void GetInteger(const QString &paramName, std::vector<int> &values) const;
186
187 bool GetBoolean(const QString &paramName) const;
188
189 void GetBoolean(const QString &paramName, std::vector<bool> &values) const;
190
191 double GetDouble(const QString &paramName) const;
192 void GetDouble(const QString &paramName, std::vector<double> &values) const;
193
194 bool WasEntered(const QString &paramName) const;
195 void Clear(const QString &paramName);
196
197 Isis::CubeAttributeInput &GetInputAttribute(const QString &paramName);
198 Isis::CubeAttributeOutput &GetOutputAttribute(const QString &paramName);
199
200 // Methods for retrieving application info not inside a group
201
202 QString ProgramName() const;
203 QString Brief() const;
204 QString Description() const;
205
206 // Methods for searching and retrieving application info
207 // via the index into groups and parameters
208
209 int NumGroups() const;
210
211 QString GroupName(const int &group) const;
212
214 int GroupIndex(const QString & grpName) const;
215
216 nlohmann::json GetParams();
217
218 int NumParams(const int &) const;
219
220 QString ParamName(const int &group, const int &param) const;
221
222 QString ParamType(const int &group, const int &param) const;
223
224 QString ParamBrief(const int &group, const int &param) const;
225
226 QString ParamDescription(const int &group, const int &param) const;
227
228 QString ParamMinimum(const int &group, const int &param) const;
229
230 QString ParamMinimumInclusive(const int &group, const int &param) const;
231
232 QString ParamMaximum(const int &group, const int &param) const;
233
234 QString ParamMaximumInclusive(const int &group, const int &param) const;
235
236 QString ParamOdd(const int &group, const int &param) const;
237
238 int ParamGreaterThanSize(const int &group, const int &param) const;
239
240 int ParamGreaterThanOrEqualSize(const int &group, const int &param) const;
241
242 int ParamLessThanSize(const int &group, const int &param) const;
243
244 int ParamLessThanOrEqualSize(const int &group, const int &param) const;
245
246 int ParamNotEqualSize(const int &group, const int &param) const;
247
248 QString ParamGreaterThan(const int &group, const int &param,
249 const int &great) const;
250
251 QString ParamGreaterThanOrEqual(const int &group, const int &param,
252 const int &great) const;
253
254 QString ParamLessThan(const int &group, const int &param,
255 const int &great) const;
256
257 QString ParamLessThanOrEqual(const int &group, const int &param,
258 const int &les) const;
259
260 QString ParamNotEqual(const int &group, const int &param,
261 const int &notEq) const;
262
263 int ParamListSize(const int &group, const int &param) const;
264
265 QString ParamListValue(const int &group, const int &param,
266 const int &option) const;
267
268 QString ParamListBrief(const int &group, const int &param,
269 const int &option) const;
270
271 QString ParamListDescription(const int &group, const int &param,
272 const int &option) const;
273
274 int ParamListExcludeSize(const int &group, const int &param,
275 const int &option) const;
276
277 QString ParamListExclude(const int &group, const int &param,
278 const int &option, const int &exclude) const;
279
280 int ParamListIncludeSize(const int &group, const int &param,
281 const int &option) const;
282
283 QString ParamListInclude(const int &group, const int &param,
284 const int &option, const int &include) const;
285
286 QString ParamDefault(const int &group, const int &param) const;
287
288 QString ParamInternalDefault(const int &group, const int &param) const;
289
290 QString ParamFilter(const int &group, const int &param) const;
291
292 QString ParamPath(const int &group, const int &param) const;
293
294 QString ParamFileMode(const int &group, const int &param) const;
295
296 int ParamExcludeSize(const int &group, const int &param) const;
297
298 QString ParamExclude(const int &group, const int &param,
299 const int &exclude) const;
300 int ParamIncludeSize(const int &group, const int &param) const;
301
302 QString ParamInclude(const int &group, const int &param,
303 const int &include) const;
304
305 QString PixelType(const int &group, const int &param) const;
306
307 int HelpersSize(const int &group, const int &param) const;
308
309 QString HelperButtonName(const int &group, const int &param,
310 const int &helper) const;
311
312 QString HelperFunction(const int &group, const int &param,
313 const int &helper) const;
314
315 QString HelperBrief(const int &group, const int &param,
316 const int &helper) const;
317
318 QString HelperDescription(const int &group, const int &param,
319 const int &helper) const;
320
321 QString HelperIcon(const int &group, const int &param,
322 const int &helper) const;
323
326 bool IsParamInPvlInclude(QString & paramName, std::vector<QString> & exclude);
327
329 void CreatePVL(Isis::Pvl &pvlDef , QString guiGrpName, QString pvlObjName,
330 QString pvlGrpName, std::vector<QString> & exclude);
331
332 // Test all parameters for valid values and conditions
333 void VerifyAll();
334
335 bool StringToBool(QString value) const;
336
337 void CommandLine(Isis::Pvl &lab) const;
338
339 QString Version() const;
340
341
342 protected:
343 const IsisParameterData *ReturnParam(const QString &paramName) const;
344
345
346 private:
348 XERCES::SAX2XMLReader *parser;
350 IsisXMLApplication *appHandler;
351
352 // Member functions
353 void StartParser(const char *xmlfile);
354
355
356 void Verify(const IsisParameterData *param);
357
358 void CheckFileNamePreference(QString filename, QString paramname);
359};
360
361
362#endif
Manipulate and parse attributes of input cube filenames.
Definition CubeAttribute.h:381
Manipulate and parse attributes of output cube filenames.
Definition CubeAttribute.h:473
Container for cube-like labels.
Definition Pvl.h:119
Definition IsisAmlData.h:124
Application program XML file parameter manager.
Definition IsisAml.h:140
void PutDouble(const QString &paramName, const std::vector< double > &value)
double GetDouble(const QString &paramName) const
Allows the retrieval of a value for a parameter of type "double".
Definition IsisAml.cpp:966
void CommandLine(Isis::Pvl &lab) const
Creates a QString which could be used as a command line.
Definition IsisAml.cpp:3099
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:1461
int ParamExcludeSize(const int &group, const int &param) const
Returns the number of parameters excluded in this parameter's exclusions.
Definition IsisAml.cpp:1894
Isis::CubeAttributeInput & GetInputAttribute(const QString &paramName)
Gets the attributes for an input cube.
Definition IsisAml.cpp:2059
int GetInteger(const QString &paramName) const
Allows the retrieval of a value for a parameter of type "integer".
Definition IsisAml.cpp:883
QString ParamLessThan(const int &group, const int &param, const int &great) const
Returns the name of the specified lessThan parameter.
Definition IsisAml.cpp:1575
QString ParamLessThanOrEqual(const int &group, const int &param, const int &les) const
Returns the name of the specified lessThanOrEqual parameter.
Definition IsisAml.cpp:1591
QString ParamBrief(const int &group, const int &param) const
Returns the brief description of a parameter in a specified group.
Definition IsisAml.cpp:1376
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:1879
QString ParamDescription(const int &group, const int &param) const
Returns the long description of a parameter in a specified group.
Definition IsisAml.cpp:1390
bool StringToBool(QString value) const
Returns a boolean value based on the QString contents.
Definition IsisAml.cpp:3056
void PutCubeName(const QString &paramName, const QString &value)
Allows the insertion of a value for a parameter of type "cubename".
Definition IsisAml.cpp:273
void GetInteger(const QString &paramName, std::vector< int > &values) const
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:1863
void PutBoolean(const QString &paramName, const bool &value)
Allows the insertion of a value for a parameter of type "boolean".
Definition IsisAml.cpp:479
QString GetFileName(const QString &paramName, QString extension="") const
Allows the retrieval of a value for a parameter of type "filename".
Definition IsisAml.cpp:641
void PutString(const QString &paramName, const std::vector< QString > &value)
void PutBoolean(const QString &paramName, const std::vector< bool > &value)
bool WasEntered(const QString &paramName) const
Returns a true if the parameter has a value, and false if it does not.
Definition IsisAml.cpp:2020
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:1783
int NumGroups() const
Returns the number of groups found in the XML.
Definition IsisAml.cpp:1164
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:1831
QString PixelType(const int &group, const int &param) const
Returns the default pixel type from the XML.
Definition IsisAml.cpp:1920
QString GetString(const QString &paramName) const
Allows the retrieval of a value for a parameter of type "string".
Definition IsisAml.cpp:769
bool GetBoolean(const QString &paramName) const
Allows the retrieval of a value for a parameter of type "boolean".
Definition IsisAml.cpp:1049
nlohmann::json GetParams()
Creates a json object which could be used as a command line.
Definition IsisAml.cpp:1205
int ParamGreaterThanSize(const int &group, const int &param) const
Returns the number of values in the parameters greater than list.
Definition IsisAml.cpp:1475
QString ParamNotEqual(const int &group, const int &param, const int &notEq) const
Returns the name of the specified notEqual parameter.
Definition IsisAml.cpp:1607
void PutInteger(const QString &paramName, const int &value)
Allows the insertion of a value for a parameter of type "integer".
Definition IsisAml.cpp:311
int HelpersSize(const int &group, const int &param) const
Returns the number of helpers the parameter has.
Definition IsisAml.cpp:1933
void GetFileName(const QString &paramName, std::vector< QString > &values) const
QString ParamGreaterThanOrEqual(const int &group, const int &param, const int &great) const
Returns the name of the specified greaterThanOrEqual parameter.
Definition IsisAml.cpp:1559
void GetBoolean(const QString &paramName, std::vector< bool > &values) const
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:1273
QString GetCubeName(const QString &paramName, QString extension="") const
Retrieves of a value for a parameter of type "cubename".
Definition IsisAml.cpp:724
QString ParamMaximumInclusive(const int &group, const int &param) const
Returns whether the maximum value is inclusive or not.
Definition IsisAml.cpp:1446
QString Description() const
Returns the full description of the program.
Definition IsisAml.cpp:1154
QString ParamType(const int &group, const int &param) const
Returns the parameter type of a parameter in a specified group.
Definition IsisAml.cpp:1654
int ParamListSize(const int &group, const int &param) const
Returns the number of options in the specified parameter's list.
Definition IsisAml.cpp:1769
int NumParams(const int &) const
Returns the number of parameters in a group.
Definition IsisAml.cpp:1349
QString Version() const
Returns the application version date.
Definition IsisAml.cpp:3176
QString GroupName(const int &group) const
Returns the group name of group[index].
Definition IsisAml.cpp:1176
QString ParamExclude(const int &group, const int &param, const int &exclude) const
Returns the name of the specified excluded parameter.
Definition IsisAml.cpp:1623
QString HelperFunction(const int &group, const int &param, const int &helper) const
Returns the name of the helper function.
Definition IsisAml.cpp:1962
void PutAsString(const QString &paramName, const std::vector< QString > &value)
QString HelperButtonName(const int &group, const int &param, const int &helper) const
Returns the name of the helper button.
Definition IsisAml.cpp:1947
QString Brief() const
Returns the brief description of the program.
Definition IsisAml.cpp:1144
const IsisParameterData * ReturnParam(const QString &paramName) const
Returns a pointer to a parameter whose name starts with paramName.
Definition IsisAml.cpp:2152
IsisAml(const QString &xmlfile)
Constructs an IsisAml object and internalizes the XML data in the given file name.
Definition IsisAml.cpp:41
QString ParamFilter(const int &group, const int &param) const
Returns the parameter filter for a parameter in a specified group.
Definition IsisAml.cpp:1708
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:1847
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:1515
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:1799
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:1815
QString ParamDefault(const int &group, const int &param) const
Returns the default for a parameter in a specified group.
Definition IsisAml.cpp:1668
void GetAsString(const QString &paramName, std::vector< QString > &values) const
int ParamLessThanSize(const int &group, const int &param) const
Returns the number of values in the parameters less than list.
Definition IsisAml.cpp:1502
QString HelperBrief(const int &group, const int &param, const int &helper) const
Returns the brief description of the helper button.
Definition IsisAml.cpp:1977
QString ParamInclude(const int &group, const int &param, const int &include) const
Returns the name of the specified included parameter.
Definition IsisAml.cpp:1639
QString GetAsString(const QString &paramName) const
Allows the retrieval of a value for a parameter of any type.
Definition IsisAml.cpp:570
int GroupIndex(const QString &grpName) const
Given the group name get its index in group array.
Definition IsisAml.cpp:1191
void PutDouble(const QString &paramName, const double &value)
Allows the insertion of a value for a parameter of type "double".
Definition IsisAml.cpp:395
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:1488
QString ParamInternalDefault(const int &group, const int &param) const
Returns the internal default for a parameter in a specified group.
Definition IsisAml.cpp:1688
int ParamNotEqualSize(const int &group, const int &param) const
Returns the number of values in the not equal list.
Definition IsisAml.cpp:1529
QString ProgramName() const
Returns the Program name.
Definition IsisAml.cpp:1133
int ParamIncludeSize(const int &group, const int &param) const
Returns the number of parameters included in this parameter's inclusions.
Definition IsisAml.cpp:1907
QString ParamMinimumInclusive(const int &group, const int &param) const
Returns whether the minimum value is inclusive or not.
Definition IsisAml.cpp:1432
void PutString(const QString &paramName, const QString &value)
Allows the insertion of a value for any parameter.
Definition IsisAml.cpp:131
QString ParamGreaterThan(const int &group, const int &param, const int &great) const
Returns the name of the specified greaterThan parameter.
Definition IsisAml.cpp:1543
QString ParamMinimum(const int &group, const int &param) const
Returns the minimum value of a parameter in a specified group.
Definition IsisAml.cpp:1404
QString ParamFileMode(const int &group, const int &param) const
Returns the file mode for a parameter in a specified group.
Definition IsisAml.cpp:1748
void PutInteger(const QString &paramName, const std::vector< int > &value)
Isis::CubeAttributeOutput & GetOutputAttribute(const QString &paramName)
Gets the attributes for an output cube.
Definition IsisAml.cpp:2105
void GetDouble(const QString &paramName, std::vector< double > &values) const
void GetString(const QString &paramName, std::vector< QString > &values) const
void Clear(const QString &paramName)
Clears the value(s) in the named parameter.
Definition IsisAml.cpp:2037
QString ParamPath(const int &group, const int &param) const
Returns the default path for a filename/cube parameter.
Definition IsisAml.cpp:1728
QString HelperDescription(const int &group, const int &param, const int &helper) const
Returns the long description of the helper button.
Definition IsisAml.cpp:1992
void VerifyAll()
Verify all parameters.
Definition IsisAml.cpp:2575
QString ParamName(const int &group, const int &param) const
Returns the parameter name.
Definition IsisAml.cpp:1362
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:2007
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:1331
void PutAsString(const QString &paramName, const QString &value)
Allows the insertion of a value for any parameter.
Definition IsisAml.cpp:68
~IsisAml()
Destructs an IsisAml object.
Definition IsisAml.cpp:48
void PutFileName(const QString &paramName, const QString &value)
Allows the insertion of a value for a parameter of type "filename".
Definition IsisAml.cpp:198
QString ParamMaximum(const int &group, const int &param) const
Returns the maximum value of a parameter in a specified group.
Definition IsisAml.cpp:1418
void PutFileName(const QString &paramName, const std::vector< QString > &value)
Definition IsisAmlData.h:53
This is free and unencumbered software released into the public domain.
Definition IsisXMLApplication.h:19