From 05ece2870309dbae1d2a182bcd13a732b606f331 Mon Sep 17 00:00:00 2001 From: chatty Date: Tue, 28 Nov 2000 15:29:50 +0000 Subject: Archiving files that were born dead --- dnn/behaviour.cc | 42 +++++++++++++++++++++++++++ dnn/behaviour.h | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100755 dnn/behaviour.cc create mode 100755 dnn/behaviour.h diff --git a/dnn/behaviour.cc b/dnn/behaviour.cc new file mode 100755 index 0000000..f85bd20 --- /dev/null +++ b/dnn/behaviour.cc @@ -0,0 +1,42 @@ +/* + * DNN - Data News Network + * + * by Stephane Chatty + * + * Copyright 1993-1996 + * Centre d'Etudes de la Navigation Aerienne (CENA) + * + * Behaviours. + * + * $Id$ + * $CurLog$ + */ + +#include "Behaviour.h" + +#if 0 +template +CcuKey* +DnnBehaviourOf :: GetEventType (CcuToken* t) +{ + DnnEvent* e = (DnnEvent*) t; + return (CcuKey*) t->GetType (); +} +#endif + +#if 0 + +DnnSuperState :: DnnSuperState (const char* name, CcuAutomaton& a) +: CcuBaseState (name, a), + Criteria () +{ +} + +void +DnnSuperState :: CreateLink (DnnSuperState* to, DnnCriterion* c) +{ + CcuHashCellOf * c = Links.Add (); + c->SetInfo (new DnnActionOf +} +#endif + diff --git a/dnn/behaviour.h b/dnn/behaviour.h new file mode 100755 index 0000000..01f382b --- /dev/null +++ b/dnn/behaviour.h @@ -0,0 +1,86 @@ +/* + * DNN - Data News Network + * + * by Stephane Chatty + * + * Copyright 1993-1995 + * Centre d'Etudes de la Navigation Aerienne (CENA) + * + * Behaviours. + * + * $Id$ + * $CurLog$ + */ + +#ifndef DnnBehaviour_H_ +#define DnnBehaviour_H_ + +#include "cplus_bugs.h" +#include "ccu/Automaton.h" +class DnnEvent; + +// en cours de developpement. + +template class DnnStateOf; + +template class DnnActionOf : public CcuBaseLink { +protected: + T& Object; + void (T::*Action) (DnnStateOf*, DnnStateOf*, DnnEvent*); + + void Fire (CcuBaseState* f, CcuBaseState* t, CcuToken* k) { if (Action) (Object.*Action) ((DnnStateOf*) f, (DnnStateOf*) t, (DnnEvent*) k);} + +public: + DnnActionOf (DnnStateOf* s, DnnEventType* k, T& o, void (T::*a) (DnnStateOf*, DnnStateOf*, DnnEvent*)) : CcuBaseLink (s), Object (o), Action (a) {} + ~DnnActionOf () {} + +}; + +#if 0 +/* future version of States: they create reactions associated to their links when entered. */ + +class DnnSuperState : public CcuBaseState { +protected: + CcuListOf Criteria; + void In (); + void Out (); +public: + DnnSuperState (const char* n, CcuAutomaton& b) : CcuBaseState (n, b) {} + ~DnnSuperState (); + void CreateLink (DnnSuperState*, DnnCriterion*); +}; + +template class DnnStateOf : public CcuBaseState { +protected: + void In () {} + void Out () {} +public: + DnnStateOf (const char* n, DnnBehaviourOf& b) : CcuBaseState (n, b) {} + ~DnnStateOf () {} + void CreateLink (DnnStateOf* to, DnnEventType* k, T& o, void (T::*a) (DnnStateOf*, DnnStateOf*, DnnEvent*)) { CcuHashCellOf * c = Links.Add (k); c->SetInfo (new DnnActionOf (to, k, o, a)); } +}; + +template class DnnBehaviourOf : public CcuBaseAutomaton { +protected: +static CcuKey* GetEventType (CcuToken*); +public: + DnnBehaviourOf () : CcuBaseAutomaton (&GetEventType) {} + ~DnnBehaviourOf () {} + DnnStateOf* CreateState (const char* n) { DnnStateOf* s = new DnnStateOf (n, *this); AllStates.Append (s); return s; } +}; + +template +CcuKey* +DnnBehaviourOf :: GetEventType (CcuToken* t) +{ + DnnEvent* e = (DnnEvent*) t; + return (CcuKey*) e->GetType (); +} + + +// tentative du 20/11/95 +template class DnnInteractionOf : public CcuAutomIter { + DnnInteractionOf (DnnBehaviourOf& b) : CcuAutomIter (b) {} +}; +#endif +#endif /* DnnBehaviour_H_ */ -- cgit v1.1