Add build infrastructure and argument parsing class
Change-Id: Ifb8f283733fe4de531859dc895da35a3a01071a0
Signed-off-by: Eddie James <eajames@linux.ibm.com>
diff --git a/ikvm_args.hpp b/ikvm_args.hpp
new file mode 100644
index 0000000..489718b
--- /dev/null
+++ b/ikvm_args.hpp
@@ -0,0 +1,111 @@
+#pragma once
+
+#include <string>
+
+namespace ikvm
+{
+
+/*
+ * @class Args
+ * @brief Command line argument parser and storage
+ */
+class Args
+{
+ public:
+ /*
+ * @struct CommandLine
+ * @brief Stores the original command line arguments for later use
+ */
+ struct CommandLine
+ {
+ /*
+ * @brief Constructs CommandLine object
+ *
+ * @param[in] c - Number of arguments
+ * @param[in] v - Array of arguments
+ */
+ CommandLine(int c, char** v) : argc(c), argv(v)
+ {
+ }
+ ~CommandLine() = default;
+ CommandLine(const CommandLine&) = default;
+ CommandLine& operator=(const CommandLine&) = default;
+ CommandLine(CommandLine&&) = default;
+ CommandLine& operator=(CommandLine&&) = default;
+
+ int argc;
+ char** argv;
+ };
+
+ /*
+ * @brief Constructs Args object
+ *
+ * @param[in] argc - The number of arguments in the command line call
+ * @param[in] argv - The array of arguments from the command line
+ */
+ Args(int argc, char* argv[]);
+ ~Args() = default;
+ Args(const Args&) = default;
+ Args& operator=(const Args&) = default;
+ Args(Args&&) = default;
+ Args& operator=(Args&&) = default;
+
+ /*
+ * @brief Get the original command line arguments
+ *
+ * @return Reference to the CommandLine structure storing the original
+ * command line arguments
+ */
+ inline const CommandLine& getCommandLine() const
+ {
+ return commandLine;
+ }
+
+ /*
+ * @brief Get the desired video frame rate
+ *
+ * @return Value of the desired frame rate in frames per second
+ */
+ inline int getFrameRate() const
+ {
+ return frameRate;
+ }
+
+ /*
+ * @brief Get the path to the USB input device
+ *
+ * @return Reference to the string storing the path to the input device
+ */
+ inline const std::string& getInputPath() const
+ {
+ return inputPath;
+ }
+
+ /*
+ * @brief Get the path to the V4L2 video device
+ *
+ * @return Reference to the string storing the path to the video device
+ */
+ inline const std::string& getVideoPath() const
+ {
+ return videoPath;
+ }
+
+ private:
+ /* @brief Prints the application usage to stderr */
+ void printUsage();
+
+ /*
+ * @brief Desired frame rate (in frames per second) of the video
+ * stream
+ */
+ int frameRate;
+ /* @brief Path to the USB input device */
+ std::string inputPath;
+ /* @brief Path to the V4L2 video device */
+ std::string videoPath;
+ /* @brief Original command line arguments passed to the application */
+ CommandLine commandLine;
+};
+
+} // namespace ikvm