Permalink
Browse files

Added Not sensor_logic class

  • Loading branch information...
1 parent 80143ac commit 585cfbaf0cc9a782f78a83093f81b5ec30d9efb5 @bmcdorman bmcdorman committed Feb 16, 2013
Showing with 27 additions and 0 deletions.
  1. +12 −0 include/kovan/sensor_logic.hpp
  2. +15 −0 src/sensor_logic.cpp
@@ -62,6 +62,18 @@ namespace SensorLogic
Xor(const Sensor<bool> *a, const Sensor<bool> *b);
virtual bool value() const;
};
+
+ class EXPORT_SYM Not : public Sensor<bool>
+ {
+ public:
+ Not(const Sensor<bool> *input);
+ virtual bool value() const;
+
+ const Sensor<bool> *input() const;
+
+ private:
+ const Sensor<bool> *m_input;
+ };
}
#endif
View
@@ -54,4 +54,19 @@ bool Xor::value() const
{
const bool b = Base::b()->value();
return a()->value() ? !b : b;
+}
+
+Not::Not(const Sensor<bool> *input)
+ : m_input(input)
+{
+}
+
+bool Not::value() const
+{
+ return !m_input->value();
+}
+
+const Sensor<bool> *Not::input() const
+{
+ return m_input;
}

0 comments on commit 585cfba

Please sign in to comment.