OpenASIP  2.0
CmdLineOptionParser.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file CmdLineOptionParser.cc
26  *
27  * Definitions of CmdLineOptionParser classes.
28  *
29  * @author Jussi Nyk�nen 2003 (nykanen-no.spam-cs.tut.fi)
30  * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
31  * @author Henry Linjamäki 2017 (henry.linjamaki-no.spam-tut.fi)
32  * @note reviewed 3 December 2003 by jn, kl, ao
33  * @note rating: red
34  */
35 
36 #include <cstdio>
37 #include <iostream>
38 #include <string>
39 #include <sstream>
40 
41 #include "Application.hh"
42 #include "CmdLineOptionParser.hh"
43 #include "Exception.hh"
44 #include "OptionValue.hh"
45 
46 using std::cerr;
47 using std::endl;
48 using std::string;
49 using std::istringstream;
50 
51 //////////////////////////////////////////////////////////////////////////////
52 // CmdLineOptionParser
53 //////////////////////////////////////////////////////////////////////////////
54 
55 /**
56  * Constructor.
57  *
58  * @param name The name of the option.
59  * @param desc The description of the option.
60  * @param alias The short name of the option.
61  */
63  std::string name,
64  std::string desc,
65  std::string alias,
66  bool hidden) :
67  longName_(name), shortName_(alias), desc_(desc), hidden_(hidden),
68  defined_(false) {
69 }
70 
71 /**
72  * Destructor.
73  */
75 }
76 
77 /**
78  * This implementation should never be called.
79  *
80  * @return Nothing.
81  * @exception WrongSubclass Called for a wrong subclass.
82  */
83 int
85  throw WrongSubclass(__FILE__, __LINE__, __func__);
86  return 0;
87 }
88 
89 unsigned
91  throw WrongSubclass(__FILE__, __LINE__, __func__);
92  return 0;
93 }
94 
95 /**
96  * This implementation should be never called.
97  *
98  * @return Nothing.
99  * @exception WrongSubclass Called for a wrong subclass.
100  */
101 std::string
103  throw WrongSubclass(__FILE__, __LINE__, __func__);
104  return "";
105 }
106 
107 /**
108  * This implementation should never be called.
109  *
110  * @return Nothing.
111  * @exception WrongSubclass Called for a wrong subclass.
112  */
113 double
115  throw WrongSubclass(__FILE__, __LINE__, __func__);
116  return 0;
117 }
118 
119 /**
120  * This implementation should never be called.
121  *
122  * @return Nothing.
123  * @exception WrongSubclass Called for a wrong subclass.
124  */
125 bool
127  throw WrongSubclass(__FILE__, __LINE__, __func__);
128  return false;
129 }
130 
131 /**
132  * This implementation should never be called.
133  *
134  * @return Nothing.
135  * @exception WrongSubclass Called for a wrong subclass.
136  */
137 bool
139  throw WrongSubclass(__FILE__, __LINE__, __func__);
140  return false;
141 }
142 
143 /**
144  * This implementation should never be called.
145  *
146  * @return Nothing.
147  * @exception WrongSubclass Called for a wrong subclass.
148  */
149 int
151  throw WrongSubclass(__FILE__, __LINE__, __func__);
152  return 0;
153 }
154 
155 /**
156  * Sets the CmdLineOptionParser to be defined in the parsed command line.
157  */
158 void
160  defined_ = true;
161 }
162 
163 /**
164  * Returns true if the option was defined in the command line.
165  *
166  * @return True if the option was defined in the command line.
167  */
168 bool
170  return defined_;
171 }
172 
173 //////////////////////////////////////////////////////////////////////////////
174 // IntegerCmdLineOptionParser
175 //////////////////////////////////////////////////////////////////////////////
176 
177 /**
178  * Constructor.
179  *
180  * @param name The name of the option.
181  * @param desc The description of the option.
182  * @param alias The short name of the option.
183  */
185  std::string name,
186  std::string desc,
187  std::string alias) : CmdLineOptionParser(name, desc, alias), value_(0) {
188 }
189 
190 /**
191  * Destructor.
192  */
194 }
195 
196 /**
197  * Copies the option value into a OptionValue object.
198  *
199  * Client is responsible of deallocating the memeory reserved for the
200  * returned object.
201  *
202  * @return A copy of the option value.
203  */
207  return copy;
208 }
209 
210 /**
211  * Parses the integer option value.
212  *
213  * @param arguments The arguments of option.
214  * @param prefix The prefix of option.
215  * @return True when parsing is ready.
216  * @exception IllegalCommandLine If the arguments of option are erronous.
217  */
218 bool
220  std::string arguments, std::string prefix) {
221  if (prefix != "") {
222  string msg = "Illegal prefix for integer option";
223  string method = "IntegerCmdLineOptionParser::parseValue()";
224  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
225  }
226 
227  if (arguments == "") {
228  string msg = "Missing value for integer option.";
229  string method = "IntegerCmdLineOptionParser::parseValue()";
230  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
231  }
232 
233  istringstream istream(arguments);
234  if((!(istream >> value_)) || istream.peek() != EOF) {
235  string msg = "Format of " + longName() + " option value was wrong: "
236  + arguments;
237  string method = "IntegerCmdLineOptionParser::parseValue()";
238  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
239  }
240 
241  setDefined();
242  return true;
243 }
244 
245 /**
246  * Returns the value of integer option.
247  *
248  * @param index This must be zero for integer option.
249  * @return The value of integer option.
250  * @exception WrongSubclass Is never thrown by this function.
251  */
252 int
254  assert(index == 0);
255  return value_;
256 }
257 
258 //////////////////////////////////////////////////////////////////////////////
259 // IntegerCmdLineOptionParser
260 //////////////////////////////////////////////////////////////////////////////
261 
262 /**
263  * Constructor.
264  *
265  * @param name The name of the option.
266  * @param desc The description of the option.
267  * @param alias The short name of the option.
268  */
270  std::string name,
271  std::string desc,
272  std::string alias) :
273  CmdLineOptionParser(name, desc, alias), value_(0) {
274 }
275 
276 /**
277  * Destructor.
278  */
280 }
281 
285  return copy;
286 }
287 
288 /**
289  * Parses the unsigned integer option value.
290  *
291  * @param arguments The arguments of option.
292  * @param prefix The prefix of option.
293  * @return True when parsing is ready.
294  * @exception IllegalCommandLine If the arguments of option are erronous.
295  */
296 bool
298  std::string arguments, std::string prefix) {
299  if (prefix != "") {
300  string msg = "Illegal prefix for unsigned integer option";
301  string method = "UnsignedIntegerCmdLineOptionParser::parseValue()";
302  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
303  }
304 
305  if (arguments == "") {
306  string msg = "Missing value for unsigned integer option.";
307  string method = "UnsignedIntegerCmdLineOptionParser::parseValue()";
308  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
309  }
310 
311  istringstream istream(arguments);
312  if((!(istream >> value_)) || istream.peek() != EOF) {
313  string msg = "Format of " + longName() + " option value was wrong: "
314  + arguments;
315  string method = "unsignedIntegerCmdLineOptionParser::parseValue()";
316  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
317  }
318 
319  setDefined();
320  return true;
321 }
322 
323 /**
324  * Returns the value of the unsigned integer option.
325  *
326  * @param index This must be zero for usigned integer option.
327  * @return The value of usigned integer option.
328  * @exception WrongSubclass Is never thrown by this function.
329  */
330 unsigned
332  assert(index == 0);
333  return value_;
334 }
335 
336 //////////////////////////////////////////////////////////////////////////////
337 // StringCmdLineOptionParser
338 //////////////////////////////////////////////////////////////////////////////
339 
340 /**
341  * Constructor.
342  *
343  * @param name The name of the option.
344  * @param desc The description of the option.
345  * @param alias The short name of the option.
346  */
348  std::string name,
349  std::string desc,
350  std::string alias) : CmdLineOptionParser(name, desc, alias), value_("") {
351 }
352 
353 /**
354  * Destructor.
355  */
357 }
358 
359 /**
360  * Copies the option value into a OptionValue object.
361  *
362  * Client is responsible of deallocating the memery reserved for the
363  * returned object.
364  *
365  * @return A copy of the option value.
366  */
370  return copy;
371 }
372 
373 /**
374  * Parses the value of option.
375  *
376  * @param arguments The arguments of option.
377  * @param prefix The prefix of option.
378  * @return True when parsing is ready.
379  * @exception IllegalCommandLine Not thrown.
380  */
381 bool
383  std::string arguments, std::string prefix) {
384  if (prefix != "") {
385  string msg = "Illegal prefix for string option";
386  string method = "StringCmdLineOptionParser::parseValue()";
387  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
388  }
389 
390  if (arguments == "") {
391  string msg = "Missing value for string option.";
392  string method = "StringCmdLineOptionParser::parseValue()";
393  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
394  }
395 
396  value_ = arguments;
397 
398  setDefined();
399  return true;
400 }
401 
402 string
404  assert(index == 0);
405  return value_;
406 }
407 
408 //////////////////////////////////////////////////////////////////////////////
409 // OptionalStringCmdLineOptionParser
410 //////////////////////////////////////////////////////////////////////////////
411 
412 /**
413  * Constructor.
414  *
415  * @param name The name of the option.
416  * @param desc The description of the option.
417  * @param alias The short name of the option.
418  */
420  std::string name, std::string desc, std::string alias)
421  : CmdLineOptionParser(name, desc, alias), value_(""), flag_(false) {
422 }
423 
424 /**
425  * Destructor.
426  */
428 }
429 
430 /**
431  * Copies the option value into a OptionValue object.
432  *
433  * Client is responsible of deallocating the memeory reserved for the
434  * returned object.
435  *
436  * @return A copy of the option value.
437  */
441  return copy;
442 }
443 
444 /**
445  * Parses the value of option.
446  *
447  * @param arguments The arguments of option.
448  * @param prefix The prefix of option.
449  * @return True when parsing is ready.
450  * @exception IllegalCommandLine Not thrown.
451  */
452 bool
454  std::string arguments, std::string prefix) {
455  if (prefix != "") {
456  string msg = "Illegal prefix for string option";
457  string method = "StringCmdLineOptionParser::parseValue()";
458  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
459  }
460 
461  value_ = arguments;
462  flag_ = true;
463 
464  setDefined();
465  return true;
466 }
467 
468 string
470  assert(index == 0);
471  return value_;
472 }
473 
474 /**
475  * Returns true if the flag is set.
476  *
477  * @return The boolean flag value.
478  * @exception WrongSubclass Is never thrown by this function.
479  */
480 bool
482  return flag_;
483 }
484 
485 /**
486  * Returns true if the flag is not set.
487  *
488  * @return Inverse of the boolean flag.
489  * @exception WrongSubclass Is never thrown by this function.
490  */
491 bool
493  return !flag_;
494 }
495 
496 //////////////////////////////////////////////////////////////////////////////
497 // RealCmdLineOptionParser
498 //////////////////////////////////////////////////////////////////////////////
499 
500 /**
501  * Constructor.
502  *
503  * @param name The name of the option.
504  * @param desc The description of the option.
505  * @param alias The short name of the option.
506  */
508  std::string name,
509  std::string desc,
510  std::string alias) :
511  CmdLineOptionParser(name, desc, alias), value_(0) {
512 }
513 
514 /**
515  * Destructor.
516  */
518 }
519 
520 /**
521  * Copies the option value into a OptionValue object.
522  *
523  * Client is responsible of deallocating the memeory reserved for the
524  * returned object.
525  *
526  * @return A copy of the option value.
527  */
531  return copy;
532 }
533 
534 /**
535  * Parses the value of option.
536  *
537  * @param arguments The arguments of option.
538  * @param prefix The prefix of option.
539  * @return True when parsing is ready.
540  * @exception IllegalCommandLine If the argument is erronous.
541  */
542 bool
543 RealCmdLineOptionParser::parseValue(std::string arguments, std::string prefix) {
544  if (prefix != "") {
545  string msg = "Illegal prefix for real option";
546  string method = "RealCmdLineOptionParser::parseValue()";
547  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
548  }
549 
550  // string must not contain anything else than numbers and a dot.
551  if (arguments == "") {
552  string msg = "Missing value for real option.";
553  string method = "RealCmdLineOptionParser::parseValue()";
554  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
555  }
556 
557  istringstream istream(arguments);
558  if((!(istream >> value_)) || istream.peek() != EOF) {
559  string msg = "Format of " + longName() + " option value was wrong: "
560  + arguments;
561  string method = "RealCmdLineOptionParser::parseValue()";
562  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
563  }
564 
565  setDefined();
566  return true;
567 }
568 
569 /**
570  * Returns the real value.
571  *
572  * @return The real value.
573  * @exception WrongSubclass Is never thrown by this function.
574  */
575 double
577  return value_;
578 }
579 
580 //////////////////////////////////////////////////////////////////////////////
581 // BoolCmdLineOptionParser
582 //////////////////////////////////////////////////////////////////////////////
583 
584 /**
585  * Constructor.
586  *
587  * @param name The name of the option.
588  * @param desc The description of the option.
589  * @param alias The short name of the option.
590  */
592  std::string name,
593  std::string desc,
594  std::string alias,
595  bool hidden) :
596  CmdLineOptionParser(name, desc, alias, hidden), value_(false) {
597 }
598 
599 /**
600  * Destructor.
601  */
603 }
604 
605 /**
606  * Copies the option value into a OptionValue object.
607  *
608  * Client is responsible of deallocating the memeory reserved for the
609  * returned object.
610  *
611  * @return A copy of the option value.
612  */
616  return copy;
617 }
618 
619 /**
620  * Parses the value of option.
621  *
622  * @param arguments The arguments for option.
623  * @param prefix The prefix of option.
624  * @return True if parsing is ready, otherwise false.
625  * @exception IllegalCommandLine If the prefix or arguments are invalid.
626  */
627 bool
628 BoolCmdLineOptionParser::parseValue(std::string arguments, std::string prefix) {
629  if (prefix == "no-") {
630  value_ = false;
631  } else if (prefix == "") {
632  value_ = true;
633  } else {
634  string msg = "Illegal prefix for boolean option " + longName() +
635  ": " + prefix;
636  string method = "BoolCmdLineOptionParser::parseValue()";
637  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
638  }
639 
640  if (arguments != "") {
641  return false;
642  } else {
643  setDefined();
644  return true;
645  }
646 }
647 
648 /**
649  * Returns true if the flag is set.
650  *
651  * @return The boolean flag value.
652  * @exception WrongSubclass Is never thrown by this function.
653  */
654 bool
656  return value_;
657 }
658 
659 /**
660  * Returns true if the flag is not set.
661  *
662  * @return Inverse of the boolean flag.
663  * @exception WrongSubclass Is never thrown by this function.
664  */
665 bool
667  return !value_;
668 }
669 
670 //////////////////////////////////////////////////////////////////////////////
671 // IntegerListCmdLineOptionParser
672 //////////////////////////////////////////////////////////////////////////////
673 
674 /**
675  * Constructor.
676  *
677  * @param name The name of the option.
678  * @param desc The description of the option.
679  * @param alias The short name of the option.
680  */
682  std::string name,
683  std::string desc,
684  std::string alias) : CmdLineOptionParser(name, desc, alias) {
685 }
686 
687 /**
688  * Destructor.
689  */
691  values_.clear();
692 }
693 
694 /**
695  * Copies the option value into a OptionValue object.
696  *
697  * Client is responsible of deallocating the memeory reserved for the
698  * returned object.
699  *
700  * @return A copy of the option value.
701  */
705  return copy;
706 }
707 
708 /**
709  * Parses the value of integer set.
710  *
711  * Value should be integers separated by commas.
712  *
713  * @param arguments The arguments of option.
714  * @param prefix The prefix of option.
715  * @return True when parsing is ready.
716  * @exception IllegalCommandLine If argument is invalid.
717  */
718 bool
720  std::string arguments, std::string prefix) {
721  if (prefix != "") {
722  string msg = "Illegal prefix for integer list option";
723  string method = "IntegerListCmdLineOptionParser::parseValue()";
724  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
725  }
726 
727  if (arguments == "") {
728  string msg = "Missing value for option " + longName();
729  string method = "IntegerSetCmdLineOptionParser::parseValue()";
730  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
731  }
732 
733  int number;
734  char comma;
735  istringstream istream(arguments);
736  // there must be at least one number
737  if (!(istream >> number)) {
738  string msg = "Format of " + longName() + "option value was wrong";
739  string method = "IntegerSetCmdLineOptionParser::parseValue()";
740  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
741  }
742  values_.push_back(number);
743 
744  while (istream.peek() != EOF) {
745 
746  // now there must be comma
747  if (!(istream >> comma) || comma != ',') {
748  string msg = "Format of " + longName() + "option value was wrong";
749  string method = "IntegerSetCmdLineOptionParser::parseValue()";
750  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
751  }
752 
753  if (!(istream >> number)) {
754  string msg = "Format of " + longName() + "option value was wrong";
755  string method = "IntegerSetCmdLineOptionParser::parseValue()";
756  throw IllegalCommandLine(__FILE__, __LINE__, method, msg);
757  }
758  values_.push_back(number);
759  }
760  setDefined();
761  return true;
762 }
763 
764 /**
765  * Returns a particular value of integer list option.
766  *
767  * @param index The index of list element that is wanted.
768  * @return The value of a particular element in list.
769  * @exception WrongSubclass Is never thrown by this function.
770  */
771 int
773  assert(index > 0 && static_cast<unsigned>(index) <= values_.size());
774  return values_[index - 1];
775 }
776 
777 /**
778  * Returns the number of list elements.
779  *
780  * @return The number of list elements.
781  * @exception WrongSubclass Is never thrown by this function.
782  */
783 int
785  return values_.size();
786 }
787 
788 //////////////////////////////////////////////////////////////////////////////
789 // StringListCmdLineOptionParser
790 //////////////////////////////////////////////////////////////////////////////
791 
792 /**
793  * Constructor.
794  *
795  * @param name The name of the option.
796  * @param desc The description of the option.
797  * @param alias The short name of the option.
798  */
800  std::string name,
801  std::string desc,
802  std::string alias) : CmdLineOptionParser(name, desc, alias) {
803 }
804 
805 /**
806  * Destructor.
807  */
809  values_.clear();
810 }
811 
812 /**
813  * Copies the option value into a OptionValue object.
814  *
815  * Client is responsible of deallocating the memeory reserved for the
816  * returned object.
817  *
818  * @return A copy of the option value.
819  */
823  return copy;
824 }
825 
826 /**
827  * Parses the value of string set.
828  *
829  * Value should be strings separated by commas.
830  *
831  * @param arguments The arguments of option.
832  * @param prefix The prefix of option.
833  * @return True when parsing is ready.
834  * @exception IllegalCommandLine If argument is invalid.
835  */
836 bool
838  std::string arguments, std::string prefix) {
839  if (prefix != "") {
840  string msg = "Illegal prefix for string list option";
841  throw IllegalCommandLine(__FILE__, __LINE__, __func__, msg);
842  }
843 
844  if (arguments == "") {
845  string msg = "Missing value for option " + longName();
846  throw IllegalCommandLine(__FILE__, __LINE__, __func__, msg);
847  }
848 
849  string comma = ",";
850  string::size_type commaPosition = 0;
851  string::size_type lastPosition = 0;
852  while (commaPosition < arguments.size()) {
853  commaPosition = arguments.find(comma, lastPosition);
854  if (commaPosition == string::npos) {
855  values_.push_back(
856  arguments.substr(lastPosition, arguments.size()));
857  break;
858  } else {
859  values_.push_back(
860  arguments.substr(lastPosition, commaPosition-lastPosition));
861  lastPosition = commaPosition + 1;
862  }
863  }
864 
865  setDefined();
866  return true;
867 }
868 
869 /**
870  * Returns a particular value of string list option.
871  *
872  * @param index The index of list element that is wanted.
873  * @return The value of a particular element in list.
874  * @exception WrongSubclass Is never thrown by this function.
875  */
876 std::string
878  assert(index > 0 && static_cast<unsigned>(index) <= values_.size());
879  return values_[index - 1];
880 }
881 
882 /**
883  * Returns the number of list elements.
884  *
885  * @return The number of list elements.
886  * @exception WrongSubclass Is never thrown by this function.
887  */
888 int
890  return values_.size();
891 }
UnsignedIntegerCmdLineOptionParser::UnsignedIntegerCmdLineOptionParser
UnsignedIntegerCmdLineOptionParser(std::string name, std::string desc, std::string alias="")
Definition: CmdLineOptionParser.cc:269
OptionalStringCmdLineOptionParser::isFlagOff
virtual bool isFlagOff() const
Definition: CmdLineOptionParser.cc:492
StringListCmdLineOptionParser::parseValue
virtual bool parseValue(std::string arguments, std::string prefix)
Definition: CmdLineOptionParser.cc:837
StringListCmdLineOptionParser::StringListCmdLineOptionParser
StringListCmdLineOptionParser(std::string name, std::string desc, std::string alias="")
Definition: CmdLineOptionParser.cc:799
CmdLineOptionParser::unsignedInteger
virtual unsigned unsignedInteger(int index=0) const
Definition: CmdLineOptionParser.cc:90
IntegerOptionValue
Definition: OptionValue.hh:85
Exception.hh
CmdLineOptionParser::isDefined
bool isDefined()
Definition: CmdLineOptionParser.cc:169
RealCmdLineOptionParser::copy
virtual OptionValue * copy() const
Definition: CmdLineOptionParser.cc:529
UnsignedIntegerCmdLineOptionParser::unsignedInteger
virtual unsigned unsignedInteger(int index=0) const
Definition: CmdLineOptionParser.cc:331
OptionalStringCmdLineOptionParser::isFlagOn
virtual bool isFlagOn() const
Definition: CmdLineOptionParser.cc:481
BoolCmdLineOptionParser::value_
bool value_
The value of option.
Definition: CmdLineOptionParser.hh:300
StringListCmdLineOptionParser::String
virtual std::string String(int index=0) const
Definition: CmdLineOptionParser.cc:877
IntegerListCmdLineOptionParser::~IntegerListCmdLineOptionParser
virtual ~IntegerListCmdLineOptionParser()
Definition: CmdLineOptionParser.cc:690
CmdLineOptionParser.hh
CmdLineOptionParser::setDefined
void setDefined()
Definition: CmdLineOptionParser.cc:159
IllegalCommandLine
Definition: Exception.hh:438
BoolCmdLineOptionParser::BoolCmdLineOptionParser
BoolCmdLineOptionParser(std::string name, std::string desc, std::string alias="", bool hidden=false)
Definition: CmdLineOptionParser.cc:591
StringListCmdLineOptionParser::~StringListCmdLineOptionParser
virtual ~StringListCmdLineOptionParser()
Definition: CmdLineOptionParser.cc:808
CmdLineOptionParser::isFlagOn
virtual bool isFlagOn() const
Definition: CmdLineOptionParser.cc:126
UnsignedIntegerCmdLineOptionParser::value_
unsigned value_
The value of option.
Definition: CmdLineOptionParser.hh:169
CmdLineOptionParser::isFlagOff
virtual bool isFlagOff() const
Definition: CmdLineOptionParser.cc:138
assert
#define assert(condition)
Definition: Application.hh:86
StringCmdLineOptionParser::~StringCmdLineOptionParser
virtual ~StringCmdLineOptionParser()
Definition: CmdLineOptionParser.cc:356
RealCmdLineOptionParser::RealCmdLineOptionParser
RealCmdLineOptionParser(std::string name, std::string desc, std::string alias="")
Definition: CmdLineOptionParser.cc:507
StringCmdLineOptionParser::parseValue
virtual bool parseValue(std::string arguments, std::string prefix)
Definition: CmdLineOptionParser.cc:382
UnsignedIntegerCmdLineOptionParser::copy
virtual OptionValue * copy() const
Definition: CmdLineOptionParser.cc:283
OptionalStringCmdLineOptionParser::parseValue
virtual bool parseValue(std::string arguments, std::string prefix)
Definition: CmdLineOptionParser.cc:453
CmdLineOptionParser::listSize
virtual int listSize() const
Definition: CmdLineOptionParser.cc:150
CmdLineOptionParser
Definition: CmdLineOptionParser.hh:56
WrongSubclass
Definition: Exception.hh:336
Application.hh
CmdLineOptionParser::CmdLineOptionParser
CmdLineOptionParser(std::string name, std::string desc, std::string alias, bool hidden=false)
Definition: CmdLineOptionParser.cc:62
RealOptionValue
Definition: OptionValue.hh:157
StringCmdLineOptionParser::String
virtual std::string String(int index=0) const
Definition: CmdLineOptionParser.cc:403
__func__
#define __func__
Definition: Application.hh:67
RealCmdLineOptionParser::parseValue
virtual bool parseValue(std::string arguments, std::string prefix)
Definition: CmdLineOptionParser.cc:543
BoolCmdLineOptionParser::isFlagOff
virtual bool isFlagOff() const
Definition: CmdLineOptionParser.cc:666
RealCmdLineOptionParser::value_
double value_
The value of the option.
Definition: CmdLineOptionParser.hh:266
BoolOptionValue
Definition: OptionValue.hh:184
IntegerCmdLineOptionParser::parseValue
virtual bool parseValue(std::string arguments, std::string prefix)
Definition: CmdLineOptionParser.cc:219
CmdLineOptionParser::longName
std::string longName() const
OptionalStringCmdLineOptionParser::flag_
bool flag_
The flag status.
Definition: CmdLineOptionParser.hh:236
UnsignedIntegerOptionValue
Definition: OptionValue.hh:109
IntegerCmdLineOptionParser::IntegerCmdLineOptionParser
IntegerCmdLineOptionParser(std::string name, std::string desc, std::string alias="")
Definition: CmdLineOptionParser.cc:184
StringListCmdLineOptionParser::listSize
virtual int listSize() const
Definition: CmdLineOptionParser.cc:889
CmdLineOptionParser::real
virtual double real() const
Definition: CmdLineOptionParser.cc:114
StringOptionValue
Definition: OptionValue.hh:133
IntegerCmdLineOptionParser::~IntegerCmdLineOptionParser
virtual ~IntegerCmdLineOptionParser()
Definition: CmdLineOptionParser.cc:193
CmdLineOptionParser::String
virtual std::string String(int index=0) const
Definition: CmdLineOptionParser.cc:102
OptionalStringCmdLineOptionParser::OptionalStringCmdLineOptionParser
OptionalStringCmdLineOptionParser(std::string name, std::string desc, std::string alias="")
Definition: CmdLineOptionParser.cc:419
BoolCmdLineOptionParser::~BoolCmdLineOptionParser
virtual ~BoolCmdLineOptionParser()
Definition: CmdLineOptionParser.cc:602
false
find Finds info of the inner loops in the false
Definition: InnerLoopFinder.cc:81
OptionalStringCmdLineOptionParser::~OptionalStringCmdLineOptionParser
virtual ~OptionalStringCmdLineOptionParser()
Definition: CmdLineOptionParser.cc:427
BoolCmdLineOptionParser::copy
virtual OptionValue * copy() const
Definition: CmdLineOptionParser.cc:614
CmdLineOptionParser::~CmdLineOptionParser
virtual ~CmdLineOptionParser()
Definition: CmdLineOptionParser.cc:74
UnsignedIntegerCmdLineOptionParser::~UnsignedIntegerCmdLineOptionParser
virtual ~UnsignedIntegerCmdLineOptionParser()
Definition: CmdLineOptionParser.cc:279
StringCmdLineOptionParser::copy
virtual OptionValue * copy() const
Definition: CmdLineOptionParser.cc:368
OptionValue
Definition: OptionValue.hh:51
StringCmdLineOptionParser::value_
std::string value_
The value of the option.
Definition: CmdLineOptionParser.hh:200
UnsignedIntegerCmdLineOptionParser::parseValue
virtual bool parseValue(std::string arguments, std::string prefix)
Definition: CmdLineOptionParser.cc:297
StringListOptionValue
Definition: OptionValue.hh:237
BoolCmdLineOptionParser::parseValue
virtual bool parseValue(std::string arguments, std::string prefix)
Definition: CmdLineOptionParser.cc:628
IntegerListOptionValue
Definition: OptionValue.hh:210
OptionalStringCmdLineOptionParser::copy
virtual OptionValue * copy() const
Definition: CmdLineOptionParser.cc:439
CmdLineOptionParser::integer
virtual int integer(int index=0) const
Definition: CmdLineOptionParser.cc:84
CmdLineOptionParser::defined_
bool defined_
Is the value of this option set in the parsed command line?
Definition: CmdLineOptionParser.hh:106
BoolCmdLineOptionParser::isFlagOn
virtual bool isFlagOn() const
Definition: CmdLineOptionParser.cc:655
OptionalStringCmdLineOptionParser::value_
std::string value_
The value of the option.
Definition: CmdLineOptionParser.hh:234
IntegerListCmdLineOptionParser::parseValue
virtual bool parseValue(std::string arguments, std::string prefix)
Definition: CmdLineOptionParser.cc:719
StringListCmdLineOptionParser::values_
std::vector< std::string > values_
The values in string list.
Definition: CmdLineOptionParser.hh:367
RealCmdLineOptionParser::real
virtual double real() const
Definition: CmdLineOptionParser.cc:576
IntegerListCmdLineOptionParser::listSize
virtual int listSize() const
Definition: CmdLineOptionParser.cc:784
OptionalStringCmdLineOptionParser::String
virtual std::string String(int index=0) const
Definition: CmdLineOptionParser.cc:469
RealCmdLineOptionParser::~RealCmdLineOptionParser
virtual ~RealCmdLineOptionParser()
Definition: CmdLineOptionParser.cc:517
IntegerListCmdLineOptionParser::values_
std::vector< int > values_
The values in integer list.
Definition: CmdLineOptionParser.hh:333
IntegerListCmdLineOptionParser::copy
virtual OptionValue * copy() const
Definition: CmdLineOptionParser.cc:703
IntegerCmdLineOptionParser::integer
virtual int integer(int index=0) const
Definition: CmdLineOptionParser.cc:253
IntegerListCmdLineOptionParser::IntegerListCmdLineOptionParser
IntegerListCmdLineOptionParser(std::string name, std::string desc, std::string alias="")
Definition: CmdLineOptionParser.cc:681
IntegerCmdLineOptionParser::value_
int value_
The value of option.
Definition: CmdLineOptionParser.hh:137
IntegerListCmdLineOptionParser::integer
virtual int integer(int index=0) const
Definition: CmdLineOptionParser.cc:772
StringCmdLineOptionParser::StringCmdLineOptionParser
StringCmdLineOptionParser(std::string name, std::string desc, std::string alias="")
Definition: CmdLineOptionParser.cc:347
OptionValue.hh
StringListCmdLineOptionParser::copy
virtual OptionValue * copy() const
Definition: CmdLineOptionParser.cc:821
IntegerCmdLineOptionParser::copy
virtual OptionValue * copy() const
Definition: CmdLineOptionParser.cc:205