summaryrefslogtreecommitdiff
path: root/2003/i/buzz/src/automate/grafcet.h
diff options
context:
space:
mode:
Diffstat (limited to '2003/i/buzz/src/automate/grafcet.h')
-rw-r--r--2003/i/buzz/src/automate/grafcet.h79
1 files changed, 79 insertions, 0 deletions
diff --git a/2003/i/buzz/src/automate/grafcet.h b/2003/i/buzz/src/automate/grafcet.h
new file mode 100644
index 0000000..09b87a1
--- /dev/null
+++ b/2003/i/buzz/src/automate/grafcet.h
@@ -0,0 +1,79 @@
+#ifndef grafcet_h
+#define grafcet_h
+// grafcet.h
+// buzz - Programme du robot Efrei Robotique I1-I2 2003
+// Copyright (C) 2003 Nicolas Schodet
+#include "etape.h"
+#include "action.h"
+#include "receptivite.h"
+#include "transition.h"
+
+#include <vector>
+
+namespace Automate
+{
+
+class Grafcet
+{
+ public:
+ // Type d'un élément du grafcet.
+ enum GrafcetElemType
+ {
+ etape, action, receptivite, transition
+ };
+ // Structure des éléments.
+ struct GrafcetElem
+ {
+ GrafcetElemType type;
+ union
+ {
+ Etape *etape;
+ Action *action;
+ Receptivite *receptivite;
+ Transition *transition;
+ } elem;
+ // Constructeurs.
+ GrafcetElem (Etape *_etape)
+ {
+ type = etape;
+ elem.etape = _etape;
+ }
+ GrafcetElem (Action *_action)
+ {
+ type = action;
+ elem.action = _action;
+ }
+ GrafcetElem (Receptivite *_receptivite)
+ {
+ type = receptivite;
+ elem.receptivite = _receptivite;
+ }
+ GrafcetElem (Transition *_transition)
+ {
+ type = transition;
+ elem.transition = _transition;
+ }
+ };
+ // Contient le grafcet complet.
+ vector<GrafcetElem> m_grafcet;
+ // Etapes actives.
+ enum ActiveStep
+ {
+ inactive, start, active, stop
+ };
+ vector<ActiveStep> m_active_etapes;
+ // Pointeur vers l'instance unique du grafcet.
+ static Grafcet *m_instance;
+ public:
+ // Constructeurs.
+ Grafcet ();
+ Grafcet (const char *filename);
+ // Destructeur.
+ ~Grafcet ();
+ // Retourne une référence vers l'instance.
+ static Grafcet &getInstance () { return *m_instance; }
+};
+
+}
+
+#endif // grafcet_h