summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/automate/receptivite.h
blob: cc9cf521d8505433d1ea90ab71223daa9eafaf05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef receptivite_h
#define receptivite_h
// receptivite.h
// buzz - Programme du robot Efrei Robotique I1-I2 2003
// Copyright (C) 2003 Nicolas Schodet
#include "expression.h"

namespace Automate
{
    class Receptivite
    {
      public:
        // Destructeur.
	virtual ~Receptivite ();
	// Retourne la valeur de la receptivit�.
	virtual bool test (void) = 0;
    };

    class ReceptiviteBool : public Receptivite
    {
	bool m_bool;
      public:
	// Constructeur.
	ReceptiviteBool (bool _bool) { m_bool = _bool; }
	// Destructeur.
	~ReceptiviteBool ();
	// Retourne la valeur de la receptivit�.
	bool test (void);
    };

    class ReceptiviteBoolOp : public Receptivite
    {
	char m_op;
	Receptivite *m_left, *m_right;
      public:
	// Constructeurs.
	ReceptiviteBoolOp (Receptivite *left, char op, Receptivite *right)
	  { m_left = left; m_op = op; m_right = right; }
	ReceptiviteBoolOp (char op, Receptivite *right)
	  { m_left = 0; m_op = op; m_right = right; }
	// Destructeur.
	~ReceptiviteBoolOp ();
	// Retourne la valeur de la receptivit�.
	bool test (void);
    };

    class ReceptiviteCmpOp : public Receptivite
    {
	char m_op;
	Expression *m_left, *m_right;
      public:
	// Constructeurs.
	ReceptiviteCmpOp (Expression *left, char op, Expression *right)
	  { m_left = left; m_op = op; m_right = right; }
	ReceptiviteCmpOp (char op, Expression *right)
	  { m_left = 0; m_op = op; m_right = right; }
	// Destructeur.
	~ReceptiviteCmpOp ();
	// Retourne la valeur de la receptivit�.
	bool test (void);
    };

    class ReceptMotorFinnish : public Receptivite
    {
      public:
	bool test (void);
    };

    class ReceptPaletTrouve : public Receptivite
    {
      public:
	bool test (void);
    };

    class ReceptCapteurs : public Receptivite
      {
	int m_mask;
      public:
	ReceptCapteurs (int m_mask);
	bool test (void);
      };

    /*Ajout des conditions du grafcet, un objet par condition*/

    class ReceptInit : public Receptivite
    {
      public:
	// Destructeur.
	~ReceptInit ();
	// Retourne la valeur de la receptivit�.
	bool test (void);
    };

    class ReceptCouleurAdverse : public Receptivite
    {
	int m_capteur;
      public:
	// Constructeur.
	ReceptCouleurAdverse (int _capteur) { m_capteur = _capteur; }
	// Destructeur.
	~ReceptCouleurAdverse ();
	// Retourne la valeur de la receptivit�.
	bool test (void);
    };

}

#endif // receptivite_h