libkipr  1.0.0
logic.hpp
Go to the documentation of this file.
1 #ifndef _SENSOR_LOGIC_HPP_
2 #define _SENSOR_LOGIC_HPP_
3 
4 #include "sensor.hpp"
5 #include "kipr/export/export.h"
6 
7 namespace kipr
8 {
9  namespace sensor
10  {
11  namespace logic
12  {
13  class EXPORT_SYM Base : public Sensor<bool>
14  {
15  public:
16  Base(const Sensor<bool> *a, const Sensor<bool> *b, bool owns = false);
17  ~Base();
18 
19  const Sensor<bool> *a() const;
20  const Sensor<bool> *b() const;
21  bool owns() const;
22  private:
23  const Sensor<bool> *m_a;
24  const Sensor<bool> *m_b;
25  bool m_owns;
26  };
27 
28  class EXPORT_SYM And : public Base
29  {
30  public:
31  And(const Sensor<bool> *a, const Sensor<bool> *b, bool owns = false);
32  virtual bool value() const;
33  };
34 
35  class EXPORT_SYM Or : public Base
36  {
37  public:
38  Or(const Sensor<bool> *a, const Sensor<bool> *b, bool owns = false);
39  virtual bool value() const;
40  };
41 
42  class EXPORT_SYM Xor : public Base
43  {
44  public:
45  Xor(const Sensor<bool> *a, const Sensor<bool> *b, bool owns = false);
46  virtual bool value() const;
47  };
48 
49  class EXPORT_SYM Not : public Sensor<bool>
50  {
51  public:
52  Not(const Sensor<bool> *input, bool owns = false);
53  ~Not();
54  virtual bool value() const;
55 
56  const Sensor<bool> *input() const;
57  bool owns() const;
58 
59  private:
60  const Sensor<bool> *m_input;
61  bool m_owns;
62  };
63  }
64  }
65 }
66 
67 
68 #endif
Definition: sensor.hpp:23
Definition: logic.hpp:29
And(const Sensor< bool > *a, const Sensor< bool > *b, bool owns=false)
virtual bool value() const
Definition: logic.hpp:14
Base(const Sensor< bool > *a, const Sensor< bool > *b, bool owns=false)
const Sensor< bool > * a() const
const Sensor< bool > * b() const
Definition: logic.hpp:50
virtual bool value() const
Not(const Sensor< bool > *input, bool owns=false)
const Sensor< bool > * input() const
Definition: logic.hpp:36
virtual bool value() const
Or(const Sensor< bool > *a, const Sensor< bool > *b, bool owns=false)
Definition: logic.hpp:43
virtual bool value() const
Xor(const Sensor< bool > *a, const Sensor< bool > *b, bool owns=false)
#define EXPORT_SYM
Definition: export.h:7
Definition: accel.hpp:7