blob: bfd5507476b098cd54bcaa59ea750623be6991cb [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 /*
Jammy Huanga4f63b32022-02-14 14:43:21 +080075 * @brief Get the video subsampling
76 *
77 * @return Value of the video subsampling
78 */
79 inline int getSubsampling() const
80 {
81 return subsampling;
82 }
83
84 /*
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080085 * @brief Get the path to the USB keyboard device
Eddie James9d7ff842018-12-11 12:54:35 -060086 *
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080087 * @return Reference to the string storing the path to the keyboard device
Eddie James9d7ff842018-12-11 12:54:35 -060088 */
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080089 inline const std::string& getKeyboardPath() const
Eddie James9d7ff842018-12-11 12:54:35 -060090 {
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080091 return keyboardPath;
92 }
93
94 /*
95 * @brief Get the path to the USB mouse device
96 *
97 * @return Reference to the string storing the path to the mouse device
98 */
99 inline const std::string& getPointerPath() const
100 {
101 return pointerPath;
Eddie James9d7ff842018-12-11 12:54:35 -0600102 }
103
104 /*
105 * @brief Get the path to the V4L2 video device
106 *
107 * @return Reference to the string storing the path to the video device
108 */
109 inline const std::string& getVideoPath() const
110 {
111 return videoPath;
112 }
113
Paul Fertser2d2f3da2021-06-18 11:16:43 +0000114 /*
115 * @brief Get the identical frames detection setting
116 *
117 * @return True if identical frames detection is enabled
118 */
119 inline bool getCalcFrameCRC() const
120 {
121 return calcFrameCRC;
122 }
123
Eddie James9d7ff842018-12-11 12:54:35 -0600124 private:
125 /* @brief Prints the application usage to stderr */
126 void printUsage();
127
128 /*
129 * @brief Desired frame rate (in frames per second) of the video
130 * stream
131 */
132 int frameRate;
Jammy Huanga4f63b32022-02-14 14:43:21 +0800133 /* @brief Desired subsampling (0: 444, 1: 420) */
134 int subsampling;
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -0800135 /* @brief Path to the USB keyboard device */
136 std::string keyboardPath;
137 /* @brief Path to the USB mouse device */
138 std::string pointerPath;
Eddie James9d7ff842018-12-11 12:54:35 -0600139 /* @brief Path to the V4L2 video device */
140 std::string videoPath;
Paul Fertser2d2f3da2021-06-18 11:16:43 +0000141 /* @brief Identical frames detection */
142 bool calcFrameCRC;
Eddie James9d7ff842018-12-11 12:54:35 -0600143 /* @brief Original command line arguments passed to the application */
144 CommandLine commandLine;
145};
146
147} // namespace ikvm