parse_cl.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /******************************************************************************
  2. **
  3. ** parse_cl.h
  4. **
  5. ** Thu Aug 6 19:42:25 2020
  6. ** Linux 5.4.0-42-generic (#46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020) x86_64
  7. ** cerik@Erik-VBox-Ubuntu (Erik Cota-Robles)
  8. **
  9. ** Copyright (c) 2020 Erik Cota-Robles
  10. **
  11. ** Header file for command line parser class
  12. **
  13. ** Automatically created by genparse v0.9.3
  14. **
  15. ** See http://genparse.sourceforge.net for details and updates
  16. **
  17. ******************************************************************************/
  18. #ifndef CMDLINE_H
  19. #define CMDLINE_H
  20. #include <iostream>
  21. #include <string>
  22. /*----------------------------------------------------------------------------
  23. **
  24. ** class Cmdline
  25. **
  26. ** command line parser class
  27. **
  28. **--------------------------------------------------------------------------*/
  29. class Cmdline
  30. {
  31. private:
  32. /* parameters */
  33. bool _n;
  34. std::string _s;
  35. int _t;
  36. std::string _w;
  37. int _x;
  38. bool _h;
  39. int _d;
  40. bool _o;
  41. bool _p;
  42. int _r;
  43. int _b;
  44. int _c;
  45. /* other stuff to keep track of */
  46. std::string _program_name;
  47. int _optind;
  48. public:
  49. /* constructor and destructor */
  50. Cmdline (int, char **); // ISO C++17 not allowed: throw (std::string);
  51. ~Cmdline (){}
  52. /* usage function */
  53. void usage (int status);
  54. /* return next (non-option) parameter */
  55. int next_param () { return _optind; }
  56. bool noStun () const { return _n; }
  57. std::string stunServer () const { return _s; }
  58. int stunPort () const { return _t; }
  59. std::string webSocketServer () const { return _w; }
  60. int webSocketPort () const { return _x; }
  61. bool h () const { return _h; }
  62. int durationInSec () const { return _d; }
  63. bool noSend () const { return _o; }
  64. int bufferSize() const { return _b; }
  65. bool enableThroughputSet () const { return _p; }
  66. int throughtputSetAsKB() const { return _r; }
  67. int dataChannelCount() const { return _c; }
  68. };
  69. #endif