Created generic ReturnCode class and common includes header
Change-Id: I2d294398d43d44596570faa56ce39ac69a9f0f50
diff --git a/src/hei_includes.hpp b/src/hei_includes.hpp
new file mode 100644
index 0000000..fa2506b
--- /dev/null
+++ b/src/hei_includes.hpp
@@ -0,0 +1,10 @@
+#pragma once
+
+// The purpose of this file is to include common headers that will be used
+// throughout this library.
+
+#include <stdint.h>
+
+#include <hei_return_code.hpp>
+#include <hei_user_defines.hpp> // For HEI_ASSERT, HEI_INF, and HEI_ERR
+
diff --git a/src/hei_return_code.hpp b/src/hei_return_code.hpp
new file mode 100644
index 0000000..cdb1700
--- /dev/null
+++ b/src/hei_return_code.hpp
@@ -0,0 +1,65 @@
+#pragma once
+
+#include <stdint.h>
+
+namespace libhei
+{
+
+class ReturnCode
+{
+ public:
+
+ /**
+ * @brief Constructor.
+ * @param i_rc The error code value.
+ */
+ explicit constexpr ReturnCode( uint32_t i_rc = 0 ) :
+ iv_rc( i_rc )
+ {}
+
+ /** @brief Default copy constructor. */
+ ReturnCode( const ReturnCode & ) = default;
+
+ /** @brief Default assignment operator. */
+ ReturnCode& operator=( const ReturnCode & ) = default;
+
+ /** @brief Default destructor. */
+ ~ReturnCode() = default;
+
+ /** @brief Integral type conversion function. */
+ operator uint32_t() const { return iv_rc; }
+
+ /** @brief Integral type conversion function. */
+ operator uint64_t() const { return iv_rc; }
+
+ /** @brief Equals operator. */
+ bool operator==( const ReturnCode & rhs ) const
+ {
+ return rhs.iv_rc == iv_rc;
+ }
+
+ /** @brief Not equals operator. */
+ bool operator!=( const ReturnCode & rhs ) const
+ {
+ return rhs.iv_rc != iv_rc;
+ }
+
+ /**
+ * @brief Returns the error code value.
+ *
+ * We'd prefer to use the integral type conversion functions above, but
+ * some compilers will throw warnings when passing this object into
+ * functions with variadic arguments, like printf().
+ */
+ uint32_t get() const { return iv_rc; }
+
+ private:
+
+ const uint32_t iv_rc; ///< return code value
+};
+
+/** Function returned successfully. */
+static constexpr ReturnCode RC_SUCCESS = ReturnCode();
+
+}; // end namespace libhei
+