OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
Attributes.cpp
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2// $RCSfile: Attributes.cpp,v $
3// ------------------------------------------------------------------------
4// $Revision: 1.2 $
5// ------------------------------------------------------------------------
6// Copyright: see Copyright.readme
7// ------------------------------------------------------------------------
8//
9// Namespace Attributes
10//
11// ------------------------------------------------------------------------
12//
13// $Date: 2002/01/17 22:18:36 $
14// $Author: jsberg $
15//
16// ------------------------------------------------------------------------
17
19
21#include "Attributes/Bool.h"
24#include "Attributes/Place.h"
26#include "Attributes/Range.h"
27#include "Attributes/Real.h"
31#include "Attributes/TableRow.h"
36#include "Expressions/AValue.h"
38#include "Expressions/SValue.h"
40
42#include "Utilities/Util.h"
44
45#include <regex>
46
47using namespace Expressions;
48
49namespace {
50 std::string stringifyVariable(Object* obj) {
51 ValueDefinition* value = dynamic_cast<ValueDefinition*>(obj);
52
53 if (value) {
54 std::ostringstream valueStream;
55 try {
56 double real = value->getReal();
57 valueStream << real;
58 return valueStream.str();
59 } catch (OpalException const& e) {
60 }
61 try {
62 std::string str = value->getString();
63 valueStream << str;
64 return valueStream.str();
65 } catch (OpalException const& e) {
66 }
67
68 try {
69 bool boolean = value->getBool();
70 valueStream << std::boolalpha << boolean;
71 return Util::toUpper(valueStream.str());
72 } catch (OpalException const&) {
73 }
74 }
75
76 throw OpalException(
77 "Attributes::stringifyVariable",
78 "The variable '" + obj->getOpalName() + "' isn't of type REAL, STRING or BOOL");
79 return "";
80 }
81} // namespace
82
83// Namespace Attributes.
84// ------------------------------------------------------------------------
85
86namespace Attributes {
87
88 // ----------------------------------------------------------------------
89 // Boolean value.
90
91 Attribute makeBool(const std::string& name, const std::string& help) {
92 return Attribute(new Bool(name, help), nullptr);
93 }
94
95 Attribute makeBool(const std::string& name, const std::string& help, bool ini) {
96 return Attribute(new Bool(name, help), new SValue<bool>(ini));
97 }
98
99 bool getBool(const Attribute& attr) {
100 if (attr.isBaseAllocated()) {
101 AttributeBase* base = &attr.getBase();
102 if (dynamic_cast<Bool*>(&attr.getHandler())) {
103 return dynamic_cast<SValue<bool>*>(base)->evaluate();
104 } else if (
105 SValue<SRefAttr<bool> >* ref = dynamic_cast<SValue<SRefAttr<bool> >*>(base)) {
106 const SRefAttr<bool>& value = ref->evaluate();
107 return value.evaluate();
108 } else {
109 throw OpalException(
110 "Attributes::getBool()",
111 "Attribute \"" + attr.getName() + "\" is not logical.");
112 }
113 } else {
114 return false;
115 }
116 }
117
118 void setBool(Attribute& attr, bool val) {
120 if (dynamic_cast<const Bool*>(&attr.getHandler())) {
121 attr.set(new SValue<bool>(val));
122 } else if (
123 (attr.isBaseAllocated() == true)
124 && (ref = dynamic_cast<SValue<SRefAttr<bool> >*>(&attr.getBase()))) {
125 const SRefAttr<bool>& value = ref->evaluate();
126 value.set(val);
127 } else {
128 throw OpalException(
129 "Attributes::setBool()",
130 "Attribute \"" + attr.getName() + "\" is not logical.");
131 }
132 }
133
134 // ----------------------------------------------------------------------
135 // Boolean array value.
136 Attribute makeBoolArray(const std::string& name, const std::string& help) {
137 return Attribute(new BoolArray(name, help), nullptr);
138 }
139
140 std::vector<bool> getBoolArray(const Attribute& attr) {
141 if (attr.isBaseAllocated()) {
142 AttributeBase* base = &attr.getBase();
143 if (AValue<bool>* value = dynamic_cast<AValue<bool>*>(base)) {
144 return value->evaluate();
145 } else {
146 throw OpalException(
147 "Attributes::getBoolArray()",
148 "Attribute \"" + attr.getName() + "\" is not a logical array.");
149 }
150 } else {
151 return std::vector<bool>();
152 }
153 }
154
155 void setBoolArray(Attribute& attr, const std::vector<bool>& value) {
156 if (dynamic_cast<const BoolArray*>(&attr.getHandler())) {
157 // Use ADeferred here, since a component may be overridden later
158 // by an expression.
159 attr.set(new ADeferred<bool>(value));
160 } else {
161 throw OpalException(
162 "Attributes::setBoolArray()",
163 "Attribute \"" + attr.getName() + "\" is not a logical array");
164 }
165 }
166
167 // ----------------------------------------------------------------------
168 // Place value.
169
170 Attribute makePlace(const std::string& name, const std::string& help) {
171 return Attribute(new Place(name, help), new SValue<PlaceRep>(PlaceRep("#S")));
172 }
173
175 if (attr.isBaseAllocated()) {
176 if (SValue<PlaceRep>* place = dynamic_cast<SValue<PlaceRep>*>(&attr.getBase())) {
177 return place->evaluate();
178 } else {
179 throw OpalException(
180 "Attributes::getPlace()",
181 "Attribute \"" + attr.getName() + "\" is not a place reference.");
182 }
183 } else {
184 return PlaceRep();
185 }
186 }
187
188 void setPlace(Attribute& attr, const PlaceRep& rep) {
189 if (dynamic_cast<const Place*>(&attr.getHandler())) {
190 attr.set(new SValue<PlaceRep>(rep));
191 } else {
192 throw OpalException(
193 "Attributes::setPlace()",
194 "Attribute \"" + attr.getName() + "\" is not a place reference.");
195 }
196 }
197
198 // ----------------------------------------------------------------------
199 // Range value.
200
201 Attribute makeRange(const std::string& name, const std::string& help) {
202 return Attribute(new Range(name, help), new SValue<RangeRep>(RangeRep()));
203 }
204
206 if (attr.isBaseAllocated()) {
207 if (SValue<RangeRep>* range = dynamic_cast<SValue<RangeRep>*>(&attr.getBase())) {
208 return range->evaluate();
209 } else {
210 throw OpalException(
211 "Attributes::getRange()",
212 "Attribute \"" + attr.getName() + "\" is not a range reference.");
213 }
214 } else {
215 return RangeRep();
216 }
217 }
218
219 void setRange(Attribute& attr, const RangeRep& rep) {
220 if (dynamic_cast<const Range*>(&attr.getHandler())) {
221 attr.set(new SValue<RangeRep>(rep));
222 } else {
223 throw OpalException(
224 "Attributes::setRange()",
225 "Attribute \"" + attr.getName() + "\" is not a range reference.");
226 }
227 }
228
229 // ----------------------------------------------------------------------
230 // Real value.
231
232 Attribute makeReal(const std::string& name, const std::string& help) {
233 return Attribute(new Real(name, help), nullptr);
234 }
235
236 Attribute makeReal(const std::string& name, const std::string& help, double initial) {
237 return Attribute(new Real(name, help), new SValue<double>(initial));
238 }
239
240 double getReal(const Attribute& attr) {
241 if (attr.isBaseAllocated()) {
242 AttributeBase* base = &attr.getBase();
243 if (dynamic_cast<Real*>(&attr.getHandler())) {
244 return dynamic_cast<SValue<double>*>(base)->evaluate();
245 } else if (
246 SValue<SRefAttr<double> >* ref =
247 dynamic_cast<SValue<SRefAttr<double> >*>(base)) {
248 const SRefAttr<double>& value = ref->evaluate();
249 return value.evaluate();
250 } else {
251 throw OpalException(
252 "Attributes::getReal()",
253 "Attribute \"" + attr.getName() + "\" is not real.");
254 }
255 } else {
256 return 0.0;
257 }
258 }
259
260 void setReal(Attribute& attr, double val) {
262 if (dynamic_cast<const Real*>(&attr.getHandler())) {
263 attr.set(new SValue<double>(val));
264 } else if (
265 (attr.isBaseAllocated() == true)
266 && (ref = dynamic_cast<SValue<SRefAttr<double> >*>(&attr.getBase()))) {
267 const SRefAttr<double>& value = ref->evaluate();
268 value.set(val);
269 } else {
270 throw OpalException(
271 "Attributes::setReal()", "Attribute \"" + attr.getName() + "\" is not real.");
272 }
273 }
274
275 // ----------------------------------------------------------------------
276 // Real array value.
277
278 Attribute makeRealArray(const std::string& name, const std::string& help) {
279 return Attribute(new RealArray(name, help), nullptr);
280 }
281
282 std::vector<double> getRealArray(const Attribute& attr) {
283 if (attr.isBaseAllocated()) {
284 if (dynamic_cast<RealArray*>(&attr.getHandler())) {
285 AttributeBase* base = &attr.getBase();
286 return dynamic_cast<AValue<double>*>(base)->evaluate();
287 } else {
288 throw OpalException(
289 "Attributes::getRealArray()",
290 "Attribute \"" + attr.getName() + "\" is not a real array.");
291 }
292 } else {
293 return std::vector<double>();
294 }
295 }
296
297 void setRealArray(Attribute& attr, const std::vector<double>& value) {
298 if (dynamic_cast<const RealArray*>(&attr.getHandler())) {
299 // Use ADeferred here, since a component may be overridden later
300 // by an expression.
301 attr.set(new ADeferred<double>(value));
302 } else {
303 throw OpalException(
304 "Attributes::setRealArray()",
305 "Attribute \"" + attr.getName() + "\" is not a real array.");
306 }
307 }
308
309 // ----------------------------------------------------------------------
310 // Reference value.
311
312 Attribute makeReference(const std::string& name, const std::string& help) {
313 return Attribute(new Reference(name, help), nullptr);
314 }
315
316 // ----------------------------------------------------------------------
317 // String value.
318
319 Attribute makeString(const std::string& name, const std::string& help) {
320 return Attribute(new String(name, help), nullptr);
321 }
322
324 const std::string& name, const std::string& help, const std::string& initial) {
325 return Attribute(new String(name, help), new SValue<std::string>(initial));
326 }
327
328 std::string getString(const Attribute& attr) {
329 if (attr.isBaseAllocated()) {
330 AttributeBase* base = &attr.getBase();
331 std::string expr;
332 if (dynamic_cast<String*>(&attr.getHandler())
333 || dynamic_cast<UpperCaseString*>(&attr.getHandler())
334 || dynamic_cast<PredefinedString*>(&attr.getHandler())) {
335 expr = dynamic_cast<SValue<std::string>*>(base)->evaluate();
336 } else if (
338 dynamic_cast<SValue<SRefAttr<std::string> >*>(base)) {
339 const SRefAttr<std::string>& value = ref->evaluate();
340 expr = value.evaluate();
341 } else {
342 throw OpalException(
343 "Attributes::getString()",
344 "Attribute \"" + attr.getName() + "\" is not string.");
345 }
346
347 auto opal = OpalData::getInstance();
348
349 std::regex variableRE("\\$\\{(.*?)\\}");
350 std::smatch what;
351
352 std::string exprDeref;
353 std::string::const_iterator start = expr.begin();
354 std::string::const_iterator end = expr.end();
355
356 while (std::regex_search(
357 start, end, what, variableRE, std::regex_constants::match_default)) {
358 exprDeref += std::string(start, what[0].first);
359 std::string variable = Util::toUpper(std::string(what[1].first, what[1].second));
360
361 if (Object* obj = opal->find(variable)) {
362 exprDeref += ::stringifyVariable(obj);
363 } else {
364 throw OpalException(
365 "Attributes::getString",
366 "Can't find variable '" + variable + "' in string \"" + expr + "\"");
367 }
368
369 start = what[0].second;
370 }
371 exprDeref += std::string(start, end);
372
373 return exprDeref;
374 } else {
375 return std::string();
376 }
377 }
378
379 void setString(Attribute& attr, const std::string& val) {
381 if (dynamic_cast<const String*>(&attr.getHandler())) {
382 attr.set(new SValue<std::string>(val));
383 } else if (
384 (attr.isBaseAllocated() == true)
385 && (ref = dynamic_cast<SValue<SRefAttr<std::string> >*>(&attr.getBase()))) {
386 const SRefAttr<std::string>& value = ref->evaluate();
387 value.set(val);
388 } else {
389 throw OpalException(
390 "Attributes::setString()",
391 "Attribute \"" + attr.getName() + "\" is not a string.");
392 }
393 }
394
395 // ----------------------------------------------------------------------
396 // Predefined string value.
397
399 const std::string& name, const std::string& help,
400 const std::initializer_list<std::string>& predefinedStrings) {
401 return Attribute(new PredefinedString(name, help, predefinedStrings), nullptr);
402 }
403
405 const std::string& name, const std::string& help,
406 const std::initializer_list<std::string>& predefinedStrings,
407 const std::string& initial) {
408 return Attribute(
409 new PredefinedString(name, help, predefinedStrings, initial),
410 new SValue<std::string>(Util::toUpper(initial)));
411 }
412
413 void setPredefinedString(Attribute& attr, const std::string& val) {
415 std::string upperCaseVal = Util::toUpper(val);
416 if (dynamic_cast<const PredefinedString*>(&attr.getHandler())) {
417 attr.set(new SValue<std::string>(upperCaseVal));
418 } else if (
419 (attr.isBaseAllocated() == true)
420 && (ref = dynamic_cast<SValue<SRefAttr<std::string> >*>(&attr.getBase()))) {
421 const SRefAttr<std::string>& value = ref->evaluate();
422 value.set(upperCaseVal);
423 } else {
424 throw OpalException(
425 "Attributes::setPredefinedString()",
426 "Attribute \"" + attr.getName() + "\" is not a supported string.");
427 }
428 }
429
430 // ----------------------------------------------------------------------
431 // Upper case string value.
432
433 Attribute makeUpperCaseString(const std::string& name, const std::string& help) {
434 return Attribute(new UpperCaseString(name, help), nullptr);
435 }
436
438 const std::string& name, const std::string& help, const std::string& initial) {
439 return Attribute(
440 new UpperCaseString(name, help), new SValue<std::string>(Util::toUpper(initial)));
441 }
442
443 void setUpperCaseString(Attribute& attr, const std::string& val) {
445 if (dynamic_cast<const UpperCaseString*>(&attr.getHandler())) {
446 attr.set(new SValue<std::string>(Util::toUpper(val)));
447 } else if (
448 (attr.isBaseAllocated() == true)
449 && (ref = dynamic_cast<SValue<SRefAttr<std::string> >*>(&attr.getBase()))) {
450 const SRefAttr<std::string>& value = ref->evaluate();
451 value.set(Util::toUpper(val));
452 } else {
453 throw OpalException(
454 "Attributes::setUpperCaseString()",
455 "Attribute \"" + attr.getName() + "\" is not an upper case string.");
456 }
457 }
458
459 // ----------------------------------------------------------------------
460 // String array value.
461 Attribute makeStringArray(const std::string& name, const std::string& help) {
462 return Attribute(new StringArray(name, help), nullptr);
463 }
464
465 std::vector<std::string> getStringArray(const Attribute& attr) {
466 if (attr.isBaseAllocated()) {
467 AttributeBase* base = &attr.getBase();
468 if (dynamic_cast<StringArray*>(&attr.getHandler())
469 || dynamic_cast<UpperCaseStringArray*>(&attr.getHandler())) {
470 auto opal = OpalData::getInstance();
471
472 std::regex variableRE("\\$\\{(.*?)\\}");
473 std::smatch what;
474
475 std::vector<std::string> value =
476 dynamic_cast<AValue<std::string>*>(base)->evaluate();
477 for (auto expr : value) {
478 std::string exprDeref;
479 std::string::const_iterator start = expr.begin();
480 std::string::const_iterator end = expr.end();
481
482 while (std::regex_search(
483 start, end, what, variableRE, std::regex_constants::match_default)) {
484 exprDeref += std::string(start, what[0].first);
485 std::string variable =
486 Util::toUpper(std::string(what[1].first, what[1].second));
487
488 if (Object* obj = opal->find(variable)) {
489 std::ostringstream value;
490
491 RealVariable* real = static_cast<RealVariable*>(obj);
492 real->printValue(value);
493 exprDeref += value.str();
494 } else {
495 exprDeref += std::string(what[0].first, what[0].second);
496 }
497
498 start = what[0].second;
499 }
500 expr = exprDeref + std::string(start, end);
501 }
502
503 return value;
504 } else {
505 throw OpalException(
506 "Attributes::getStringArray()",
507 "Attribute \"" + attr.getName() + "\" is not a string array.");
508 }
509 } else {
510 return std::vector<std::string>();
511 }
512 }
513
514 void setStringArray(Attribute& attr, const std::vector<std::string>& value) {
515 if (dynamic_cast<const StringArray*>(&attr.getHandler())) {
516 // Strings are never expressions, so AValue will do here.
517 attr.set(new AValue<std::string>(value));
518 } else {
519 throw OpalException(
520 "Attributes::setStringArray()",
521 "Attribute \"" + attr.getName() + "\" is not a string array.");
522 }
523 }
524
525 // ----------------------------------------------------------------------
526 // Upper case string array value.
527 Attribute makeUpperCaseStringArray(const std::string& name, const std::string& help) {
528 return Attribute(new UpperCaseStringArray(name, help), nullptr);
529 }
530
531 void setUpperCaseStringArray(Attribute& attr, const std::vector<std::string>& value) {
532 if (dynamic_cast<const UpperCaseStringArray*>(&attr.getHandler())) {
533 // Strings are never expressions, so AValue will do here.
534 std::vector<std::string> uppercase(value.size());
535 std::transform(
536 value.begin(), value.end(), uppercase.begin(),
537 [](std::string val) -> std::string {
538 return Util::toUpper(val);
539 });
540 attr.set(new AValue<std::string>(uppercase));
541 } else {
542 throw OpalException(
543 "Attributes::setUpperCaseStringArray()",
544 "Attribute \"" + attr.getName() + "\" is not an upper case string array.");
545 }
546 }
547
548 // ----------------------------------------------------------------------
549 // Table row reference value.
550
551 Attribute makeTableRow(const std::string& name, const std::string& help) {
552 return Attribute(new TableRow(name, help), nullptr);
553 }
554
556 if (attr.isBaseAllocated()) {
557 if (SValue<TableRowRep>* row = dynamic_cast<SValue<TableRowRep>*>(&attr.getBase())) {
558 return row->evaluate();
559 } else {
560 throw OpalException(
561 "Attributes::getTableRow()",
562 "Attribute \"" + attr.getName() + "\" is not a table row reference.");
563 }
564 } else {
565 return TableRowRep();
566 }
567 }
568
569 void setTableRow(Attribute& attr, const TableRowRep& rep) {
570 if (dynamic_cast<const TableRow*>(&attr.getHandler())) {
571 attr.set(new SValue<TableRowRep>(rep));
572 } else {
573 throw OpalException(
574 "Attributes::setTableRow()",
575 "Attribute \"" + attr.getName() + "\" is not a table row reference.");
576 }
577 }
578
579 // ----------------------------------------------------------------------
580 // Token list value.
581
582 Attribute makeTokenList(const std::string& name, const std::string& help) {
583 return Attribute(new TokenList(name, help), nullptr);
584 }
585
586 std::list<Token> getTokenList(const Attribute& attr) {
587 if (attr.isBaseAllocated()) {
588 AttributeBase* base = &attr.getBase();
589 if (dynamic_cast<TokenList*>(&attr.getHandler())) {
590 return dynamic_cast<SValue<std::list<Token> >*>(base)->evaluate();
591 } else {
592 throw OpalException(
593 "Attributes::getTokenList()",
594 "Attribute \"" + attr.getName() + "\" is not a token list.");
595 }
596 } else {
597 return std::list<Token>();
598 }
599 }
600
601 void setTokenList(Attribute& attr, const std::list<Token>& val) {
602 if (dynamic_cast<const TokenList*>(&attr.getHandler())) {
603 attr.set(new SValue<std::list<Token> >(val));
604 } else {
605 throw OpalException(
606 "Attributes::setTokenList()",
607 "Attribute \"" + attr.getName() + "\" is not a token list.");
608 }
609 }
610
611 // ----------------------------------------------------------------------
612 // Token list array value.
613
614 Attribute makeTokenListArray(const std::string& name, const std::string& help) {
615 return Attribute(new TokenListArray(name, help), nullptr);
616 }
617
618 std::vector<std::list<Token> > getTokenListArray(const Attribute& attr) {
619 if (attr.isBaseAllocated()) {
620 AttributeBase* base = &attr.getBase();
621 if (dynamic_cast<TokenListArray*>(&attr.getHandler())) {
622 return dynamic_cast<AValue<std::list<Token> >*>(base)->evaluate();
623 } else {
624 throw OpalException(
625 "Attributes::getTokenListArray()",
626 "Attribute \"" + attr.getName() + "\" is not a token list array.");
627 }
628 } else {
629 return std::vector<std::list<Token> >();
630 }
631 }
632
633 void setTokenListArray(Attribute& attr, const std::vector<std::list<Token> >& value) {
634 // Token lists are never expressions, so AValue will do here.
635 attr.set(new AValue<std::list<Token> >(value));
636 }
637} // namespace Attributes
Abstract base class for attribute values of different types.
A representation of an Object attribute.
Definition Attribute.h:52
AttributeBase & getBase() const
Return reference to polymorphic value.
Definition Attribute.cpp:52
const std::string & getName() const
Return the attribute name.
Definition Attribute.cpp:62
void set(AttributeBase *newBase)
Define new value.
Definition Attribute.cpp:86
bool isBaseAllocated() const
Definition Attribute.cpp:54
AttributeHandler & getHandler() const
Return a reference to the parser.
Definition Attribute.cpp:56
Parser for an attribute of type logical array.
Definition BoolArray.h:31
Parser for attribute of type logical.
Definition Bool.h:30
Parser for an attribute of type place reference.
Definition Place.h:32
Parser for an attribute of type string.
Parser for an attribute of type range definition.
Definition Range.h:32
Parser for an attribute of type real array.
Definition RealArray.h:31
Parser for an attribute of type real.
Definition Real.h:30
Parser for an attribute of type attribute reference.
Definition Reference.h:32
Parser for an attribute of type string array.
Definition StringArray.h:31
Parser for an attribute of type string.
Definition OpalString.h:30
Parser for an attribute of type table row reference.
Definition TableRow.h:33
Parser for an attribute of type token list array.
Parser for an attribute of type token list.
Definition TokenList.h:36
Parser for an attribute of type string array.
Parser for an attribute of type string.
Object attribute with a `‘deferred’' array value.
Definition ADeferred.h:40
Object attribute with a constant array value.
Definition AValue.h:35
An attribute defined as a reference to a scalar.
Definition SRefAttr.h:47
virtual void set(const T &) const
Store new value.
Definition SRefAttr.h:190
virtual T evaluate() const
Evaluate.
Definition SRefAttr.h:133
Object attribute with a constant scalar value.
Definition SValue.h:34
virtual T evaluate()
Evaluate.
Definition SValue.h:87
The base class for all OPAL objects.
Definition Object.h:45
const std::string & getOpalName() const
Return object name.
Definition Object.cpp:267
static OpalData * getInstance()
Definition OpalData.cpp:193
Representation of a place within a beam line or sequence.
Definition PlaceRep.h:40
Representation of a range within a beam line or sequence.
Definition RangeRep.h:33
virtual void printValue(std::ostream &os) const
Print its value.
Representation of a table row reference.
Definition TableRowRep.h:35
The base class for all OPAL value definitions.
virtual double getReal() const
Return real value.
virtual bool getBool() const
Return logical value.
virtual std::string getString() const
Return string value.
A collection of routines to construct object Attributes and retrieve.
Attribute makePlace(const std::string &name, const std::string &help)
Create a place attribute.
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
double getReal(const Attribute &attr)
Return real value.
void setBoolArray(Attribute &attr, const std::vector< bool > &value)
Set logical array value.
void setUpperCaseStringArray(Attribute &attr, const std::vector< std::string > &value)
Set upper case string array value.
Attribute makeUpperCaseStringArray(const std::string &name, const std::string &help)
Make uppercase string array attribute.
void setRealArray(Attribute &attr, const std::vector< double > &value)
Set array value.
void setBool(Attribute &attr, bool val)
Set logical value.
std::list< Token > getTokenList(const Attribute &attr)
Return token list value.
void setTableRow(Attribute &attr, const TableRowRep &rep)
Set table row value.
Attribute makeUpperCaseString(const std::string &name, const std::string &help)
Make uppercase string attribute.
Attribute makeStringArray(const std::string &name, const std::string &help)
Create a string array attribute.
void setUpperCaseString(Attribute &attr, const std::string &val)
Set uppercase string value.
Attribute makePredefinedString(const std::string &name, const std::string &help, const std::initializer_list< std::string > &predefinedStrings)
Make predefined string attribute.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
Attribute makeTableRow(const std::string &name, const std::string &help)
Create a table row attribute.
Attribute makeReference(const std::string &name, const std::string &help)
Create a reference attribute.
void setRange(Attribute &attr, const RangeRep &rep)
Set range value.
void setString(Attribute &attr, const std::string &val)
Set string value.
Attribute makeRange(const std::string &name, const std::string &help)
Create a range attribute.
Attribute makeTokenListArray(const std::string &name, const std::string &help)
Make token list attribute.
std::vector< bool > getBoolArray(const Attribute &attr)
Get logical array value.
bool getBool(const Attribute &attr)
Return logical value.
TableRowRep getTableRow(const Attribute &attr)
Get table row value.
Attribute makeTokenList(const std::string &name, const std::string &help)
Make token list attribute.
void setTokenListArray(Attribute &attr, const std::vector< std::list< Token > > &value)
Set token list array value.
void setReal(Attribute &attr, double val)
Set real value.
Attribute makeRealArray(const std::string &name, const std::string &help)
Create real array attribute.
void setStringArray(Attribute &attr, const std::vector< std::string > &value)
Set string array value.
PlaceRep getPlace(const Attribute &attr)
Get place value.
std::vector< double > getRealArray(const Attribute &attr)
Get array value.
std::vector< std::string > getStringArray(const Attribute &attr)
Get string array value.
void setPredefinedString(Attribute &attr, const std::string &val)
Set predefined string value.
std::string getString(const Attribute &attr)
Get string value.
Attribute makeBoolArray(const std::string &name, const std::string &help)
Create a logical array attribute.
std::vector< std::list< Token > > getTokenListArray(const Attribute &attr)
Return token list array value.
void setTokenList(Attribute &attr, const std::list< Token > &val)
Set token list value.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
RangeRep getRange(const Attribute &attr)
Get range value.
void setPlace(Attribute &attr, const PlaceRep &rep)
Set place value.
Representation objects and parsers for attribute expressions.
std::string toUpper(const std::string &str)
Definition Util.cpp:141