libwallaby  v23
The wallaby standard library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sensor_logic.hpp
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright 2012 KISS Institute for Practical Robotics *
3  * *
4  * This file is part of libkovan. *
5  * *
6  * libkovan is free software: you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License as published by *
8  * the Free Software Foundation, either version 2 of the License, or *
9  * (at your option) any later version. *
10  * *
11  * libkovan is distributed in the hope that it will be useful, *
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14  * GNU General Public License for more details. *
15  * *
16  * You should have received a copy of the GNU General Public License *
17  * along with libkovan. Check the LICENSE file in the project root. *
18  * If not, see <http://www.gnu.org/licenses/>. *
19  **************************************************************************/
20 
21 #ifndef _SENSOR_LOGIC_HPP_
22 #define _SENSOR_LOGIC_HPP_
23 
24 #include "sensor.hpp"
25 #include "export.h"
26 
31 namespace SensorLogic
32 {
33  class EXPORT_SYM Base : public Sensor<bool>
34  {
35  public:
36  Base(const Sensor<bool> *a, const Sensor<bool> *b, bool owns = false);
37  ~Base();
38 
39  const Sensor<bool> *a() const;
40  const Sensor<bool> *b() const;
41  bool owns() const;
42  private:
43  const Sensor<bool> *m_a;
44  const Sensor<bool> *m_b;
45  bool m_owns;
46  };
47 
48  class EXPORT_SYM And : public Base
49  {
50  public:
51  And(const Sensor<bool> *a, const Sensor<bool> *b, bool owns = false);
52  virtual bool value() const;
53  };
54 
55  class EXPORT_SYM Or : public Base
56  {
57  public:
58  Or(const Sensor<bool> *a, const Sensor<bool> *b, bool owns = false);
59  virtual bool value() const;
60  };
61 
62  class EXPORT_SYM Xor : public Base
63  {
64  public:
65  Xor(const Sensor<bool> *a, const Sensor<bool> *b, bool owns = false);
66  virtual bool value() const;
67  };
68 
69  class EXPORT_SYM Not : public Sensor<bool>
70  {
71  public:
72  Not(const Sensor<bool> *input, bool owns = false);
73  ~Not();
74  virtual bool value() const;
75 
76  const Sensor<bool> *input() const;
77  bool owns() const;
78 
79  private:
80  const Sensor<bool> *m_input;
81  bool m_owns;
82  };
83 }
84 
85 #endif
Definition: sensor_logic.hpp:69
Definition: sensor.hpp:17
Definition: sensor_logic.hpp:55
Definition: sensor_logic.hpp:48
Definition: sensor_logic.hpp:33
Definition: sensor_logic.hpp:62
Definition: sensor_logic.hpp:31
#define EXPORT_SYM
Definition: export.h:14