Enable gtest for testing LED set operations
This patchset enables gtest to allow different combinations
of LED set operations to be verified at build time.
Change-Id: I9c2ddf82c2e23be911233b23037ee44e3ce301db
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
diff --git a/ledlayout.hpp b/ledlayout.hpp
new file mode 100644
index 0000000..d3d0e40
--- /dev/null
+++ b/ledlayout.hpp
@@ -0,0 +1,44 @@
+#pragma once
+
+#include <map>
+#include <set>
+namespace phosphor
+{
+namespace led
+{
+/** @namespace Layout
+ * @brief Depicts the LED and their mappings and group actions
+ */
+namespace Layout
+{
+ /** @brief Define possible actions on a given LED.
+ * For the BLINK operation, follow 50-50 duty cycle
+ */
+ enum Action
+ {
+ Off,
+ On,
+ Blink,
+ };
+
+ /** @brief Name of the LED and it's proposed action.
+ * This structure is supplied as configuration at build time
+ */
+ struct LedAction
+ {
+ std::string name;
+ Action action;
+
+ // Needed for inserting elements into sets
+ bool operator<(const LedAction& right) const
+ {
+ if (name == right.name)
+ {
+ return action < right.action;
+ }
+ return name < right.name;
+ }
+ };
+} // namespace Layout
+} // namespace led
+} // namespace phosphor