parse_cl.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. /* other stuff to keep track of */
  45. std::string _program_name;
  46. int _optind;
  47. public:
  48. /* constructor and destructor */
  49. Cmdline (int, char **); // ISO C++17 not allowed: throw (std::string);
  50. ~Cmdline (){}
  51. /* usage function */
  52. void usage (int status);
  53. /* return next (non-option) parameter */
  54. int next_param () { return _optind; }
  55. bool noStun () const { return _n; }
  56. std::string stunServer () const { return _s; }
  57. int stunPort () const { return _t; }
  58. std::string webSocketServer () const { return _w; }
  59. int webSocketPort () const { return _x; }
  60. bool h () const { return _h; }
  61. int durationInSec () const { return _d; }
  62. bool noSend () const { return _o; }
  63. int bufferSize() const { return _b;}
  64. bool enableThroughputSet () const { return _p; }
  65. int throughtputSetAsKB() const { return _r;}
  66. };
  67. #endif