blob: 565d9c020afd65318b812a389077cabb8d65e6d3 [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)
George Liuf79f6f52022-07-06 09:32:35 +080028 {}
Eddie James9d7ff842018-12-11 12:54:35 -060029 ~CommandLine() = default;
30 CommandLine(const CommandLine&) = default;
31 CommandLine& operator=(const CommandLine&) = default;
32 CommandLine(CommandLine&&) = default;
33 CommandLine& operator=(CommandLine&&) = default;
34
35 int argc;
36 char** argv;
37 };
38
39 /*
40 * @brief Constructs Args object
41 *
42 * @param[in] argc - The number of arguments in the command line call
43 * @param[in] argv - The array of arguments from the command line
44 */
45 Args(int argc, char* argv[]);
46 ~Args() = default;
47 Args(const Args&) = default;
48 Args& operator=(const Args&) = default;
49 Args(Args&&) = default;
50 Args& operator=(Args&&) = default;
51
52 /*
53 * @brief Get the original command line arguments
54 *
55 * @return Reference to the CommandLine structure storing the original
56 * command line arguments
57 */
58 inline const CommandLine& getCommandLine() const
59 {
60 return commandLine;
61 }
62
63 /*
64 * @brief Get the desired video frame rate
65 *
66 * @return Value of the desired frame rate in frames per second
67 */
68 inline int getFrameRate() const
69 {
70 return frameRate;
71 }
72
73 /*
Jammy Huanga4f63b32022-02-14 14:43:21 +080074 * @brief Get the video subsampling
75 *
76 * @return Value of the video subsampling
77 */
78 inline int getSubsampling() const
79 {
80 return subsampling;
81 }
82
83 /*
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080084 * @brief Get the path to the USB keyboard device
Eddie James9d7ff842018-12-11 12:54:35 -060085 *
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080086 * @return Reference to the string storing the path to the keyboard device
Eddie James9d7ff842018-12-11 12:54:35 -060087 */
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080088 inline const std::string& getKeyboardPath() const
Eddie James9d7ff842018-12-11 12:54:35 -060089 {
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -080090 return keyboardPath;
91 }
92
93 /*
94 * @brief Get the path to the USB mouse device
95 *
96 * @return Reference to the string storing the path to the mouse device
97 */
98 inline const std::string& getPointerPath() const
99 {
100 return pointerPath;
Eddie James9d7ff842018-12-11 12:54:35 -0600101 }
102
103 /*
104 * @brief Get the path to the V4L2 video device
105 *
106 * @return Reference to the string storing the path to the video device
107 */
108 inline const std::string& getVideoPath() const
109 {
110 return videoPath;
111 }
112
Paul Fertser2d2f3da2021-06-18 11:16:43 +0000113 /*
114 * @brief Get the identical frames detection setting
115 *
116 * @return True if identical frames detection is enabled
117 */
118 inline bool getCalcFrameCRC() const
119 {
120 return calcFrameCRC;
121 }
122
Eddie James9d7ff842018-12-11 12:54:35 -0600123 private:
124 /* @brief Prints the application usage to stderr */
125 void printUsage();
126
127 /*
128 * @brief Desired frame rate (in frames per second) of the video
129 * stream
130 */
131 int frameRate;
Jammy Huanga4f63b32022-02-14 14:43:21 +0800132 /* @brief Desired subsampling (0: 444, 1: 420) */
133 int subsampling;
Jae Hyun Yoo7dfac9f2019-01-15 10:14:59 -0800134 /* @brief Path to the USB keyboard device */
135 std::string keyboardPath;
136 /* @brief Path to the USB mouse device */
137 std::string pointerPath;
Eddie James9d7ff842018-12-11 12:54:35 -0600138 /* @brief Path to the V4L2 video device */
139 std::string videoPath;
Paul Fertser2d2f3da2021-06-18 11:16:43 +0000140 /* @brief Identical frames detection */
141 bool calcFrameCRC;
Eddie James9d7ff842018-12-11 12:54:35 -0600142 /* @brief Original command line arguments passed to the application */
143 CommandLine commandLine;
144};
145
146} // namespace ikvm