blob: 489718b427bf9b8221c5cad583f73fba86f6bb2f [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 /*
75 * @brief Get the path to the USB input device
76 *
77 * @return Reference to the string storing the path to the input device
78 */
79 inline const std::string& getInputPath() const
80 {
81 return inputPath;
82 }
83
84 /*
85 * @brief Get the path to the V4L2 video device
86 *
87 * @return Reference to the string storing the path to the video device
88 */
89 inline const std::string& getVideoPath() const
90 {
91 return videoPath;
92 }
93
94 private:
95 /* @brief Prints the application usage to stderr */
96 void printUsage();
97
98 /*
99 * @brief Desired frame rate (in frames per second) of the video
100 * stream
101 */
102 int frameRate;
103 /* @brief Path to the USB input device */
104 std::string inputPath;
105 /* @brief Path to the V4L2 video device */
106 std::string videoPath;
107 /* @brief Original command line arguments passed to the application */
108 CommandLine commandLine;
109};
110
111} // namespace ikvm