blob: f877d32e9446c167f8026dc1ca09a6d0b1a5b1ea [file] [log] [blame]
Eddie James9d7ff842018-12-11 12:54:35 -06001#pragma once
2
3#include <string>
4
5namespace ikvm
6{
7
8/*
9 * @class Args
10 * @brief Command line argument parser and storage
11 */
12class Args
13{
14 public:
15 /*
16 * @struct CommandLine
17 * @brief Stores the original command line arguments for later use
18 */
19 struct CommandLine
20 {
21 /*
22 * @brief Constructs CommandLine object
23 *
24 * @param[in] c - Number of arguments
25 * @param[in] v - Array of arguments
26 */
27 CommandLine(int c, char** v) : argc(c), argv(v)
28 {
29 }
30 ~CommandLine() = default;
31 CommandLine(const CommandLine&) = default;
32 CommandLine& operator=(const CommandLine&) = default;
33 CommandLine(CommandLine&&) = default;
34 CommandLine& operator=(CommandLine&&) = default;
35
36 int argc;
37 char** argv;
38 };
39
40 /*
41 * @brief Constructs Args object
42 *
43 * @param[in] argc - The number of arguments in the command line call
44 * @param[in] argv - The array of arguments from the command line
45 */
46 Args(int argc, char* argv[]);
47 ~Args() = default;
48 Args(const Args&) = default;
49 Args& operator=(const Args&) = default;
50 Args(Args&&) = default;
51 Args& operator=(Args&&) = default;
52
53 /*
54 * @brief Get the original command line arguments
55 *
56 * @return Reference to the CommandLine structure storing the original
57 * command line arguments
58 */
59 inline const CommandLine& getCommandLine() const
60 {
61 return commandLine;
62 }
63
64 /*
65 * @brief Get the desired video frame rate
66 *
67 * @return Value of the desired frame rate in frames per second
68 */
69 inline int getFrameRate() const
70 {
71 return frameRate;
72 }
73
74 /*
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080075 * @brief Get the path to the USB keyboard device
Eddie James9d7ff842018-12-11 12:54:35 -060076 *
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080077 * @return Reference to the string storing the path to the keyboard device
Eddie James9d7ff842018-12-11 12:54:35 -060078 */
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080079 inline const std::string& getKeyboardPath() const
Eddie James9d7ff842018-12-11 12:54:35 -060080 {
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080081 return keyboardPath;
82 }
83
84 /*
85 * @brief Get the path to the USB mouse device
86 *
87 * @return Reference to the string storing the path to the mouse device
88 */
89 inline const std::string& getPointerPath() const
90 {
91 return pointerPath;
Eddie James9d7ff842018-12-11 12:54:35 -060092 }
93
94 /*
95 * @brief Get the path to the V4L2 video device
96 *
97 * @return Reference to the string storing the path to the video device
98 */
99 inline const std::string& getVideoPath() const
100 {
101 return videoPath;
102 }
103
104 private:
105 /* @brief Prints the application usage to stderr */
106 void printUsage();
107
108 /*
109 * @brief Desired frame rate (in frames per second) of the video
110 * stream
111 */
112 int frameRate;
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -0800113 /* @brief Path to the USB keyboard device */
114 std::string keyboardPath;
115 /* @brief Path to the USB mouse device */
116 std::string pointerPath;
Eddie James9d7ff842018-12-11 12:54:35 -0600117 /* @brief Path to the V4L2 video device */
118 std::string videoPath;
119 /* @brief Original command line arguments passed to the application */
120 CommandLine commandLine;
121};
122
123} // namespace ikvm