From 3ee78810becfeeb3690468ac735b6ba20dc5c501 Mon Sep 17 00:00:00 2001 From: sc Date: Tue, 28 Nov 2000 14:52:16 +0000 Subject: Integration into IvyLeague Dnn -> Ivl Some class names changed, because of conflicts with previous Uch classes Imakefile is replaced with Makefile --- dnn/Trigger.cc | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) (limited to 'dnn/Trigger.cc') diff --git a/dnn/Trigger.cc b/dnn/Trigger.cc index 3effd6d..f749b7d 100644 --- a/dnn/Trigger.cc +++ b/dnn/Trigger.cc @@ -16,11 +16,11 @@ #include "Reaction.h" #include "Criterion.h" -/*?class DnnTrigger -\typ{DnnTrigger}s are the core of event detection and emission. The presence of a trigger +/*?class IvlTrigger +\typ{IvlTrigger}s are the core of event detection and emission. The presence of a trigger (generally in a sensor) determines whether a certain situation, or the reception of an event from the underlying window system, should provoke the emission of an event. -Each trigger holds a list of reactions (of type \typ{DnnBaseReaction}). These reactions will +Each trigger holds a list of reactions (of type \typ{IvlBaseReaction}). These reactions will receive all the events whose creation and emission was caused by the presence of the trigger. ?*/ @@ -28,7 +28,7 @@ the trigger. /*? Create a trigger with an empty list of associated reaction. ?*/ -DnnTrigger :: DnnTrigger () +IvlTrigger :: IvlTrigger () : FirstSubscribers (), LastSubscribers (), Subscribers (), @@ -38,13 +38,13 @@ DnnTrigger :: DnnTrigger () } /*?nodoc?*/ -DnnTrigger :: ~DnnTrigger () +IvlTrigger :: ~IvlTrigger () { /* Force reactions to unsubscribe. We should take care of conditions when destructor is called during iteration */ - CcuListIterOf ri = FirstSubscribers; + IvlListIterOf ri = FirstSubscribers; while (++ri) (*ri)->Forget (*this); ri = Subscribers; @@ -60,7 +60,7 @@ DnnTrigger :: ~DnnTrigger () /*?nextdoc?*/ void -DnnTrigger :: Subscribe (DnnBaseReaction& a, REL_PRIORITY p) +IvlTrigger :: Subscribe (IvlBaseReaction& a, REL_PRIORITY p) { switch (p) { case isFirstPriority: @@ -80,7 +80,7 @@ Add (resp. Remove) a reaction to (resp. from) the list of reactions that should events caused by this trigger. ?*/ void -DnnTrigger :: Unsubscribe (DnnBaseReaction& a) +IvlTrigger :: Unsubscribe (IvlBaseReaction& a) { FirstSubscribers.Remove (&a); Subscribers.Remove (&a); @@ -90,7 +90,7 @@ DnnTrigger :: Unsubscribe (DnnBaseReaction& a) /*?nextdoc?*/ void -DnnTrigger :: Grab (DnnBaseReaction& a) +IvlTrigger :: Grab (IvlBaseReaction& a) { Grabs.Prepend (&a); } @@ -100,19 +100,19 @@ Add (resp. Remove) a reaction onto (resp. from) the stack of reactions that pree events caused by this trigger. ?*/ void -DnnTrigger :: Release (DnnBaseReaction& a) +IvlTrigger :: Release (IvlBaseReaction& a) { Grabs.Remove (&a); } #if 0 void -DnnTrigger :: Circulate (DnnBaseReaction& r, REL_POS pos, DnnBaseReaction* ref) +IvlTrigger :: Circulate (IvlBaseReaction& r, REL_POS pos, IvlBaseReaction* ref) { if (Subscribers.Remove (&r)) { /* find the predecessor of ref */ - CcuListIterOf lc = Subscribers; + IvlListIterOf lc = Subscribers; while (++lc && (*lc != ref)) ; /* NOW, lc is on ref, or at the end if ref == 0 */ @@ -129,18 +129,18 @@ DnnTrigger :: Circulate (DnnBaseReaction& r, REL_POS pos, DnnBaseReaction* ref) Have a trigger dispatch the event \var{ev} to its associated reactions. ?*/ void -DnnTrigger :: Dispatch (DnnEvent& ev) +IvlTrigger :: Dispatch (IvlEvent& ev) { - DnnBaseReaction* r = Grabs.First (); + IvlBaseReaction* r = Grabs.First (); if (r) { r->Manage (ev); } else { /* calls to Manage may result in changes in Subscribers; let's make a safe copy */ - CcuListOf first_subscribers = FirstSubscribers; - CcuListOf subscribers = Subscribers; - CcuListOf last_subscribers = LastSubscribers; + IvlListOf first_subscribers = FirstSubscribers; + IvlListOf subscribers = Subscribers; + IvlListOf last_subscribers = LastSubscribers; - CcuListIterOf s = first_subscribers; + IvlListIterOf s = first_subscribers; while (++s) #ifdef CRITERIA_IN_REACTIONS if ((*s)->Check (ev)) @@ -163,18 +163,16 @@ DnnTrigger :: Dispatch (DnnEvent& ev) } } - bool -DnnTrigger :: Check (DnnEvent& ev) +IvlTrigger :: Check (IvlEvent& ev) { - CcuListIterOf c = Criteria; + IvlListIterOf c = Criteria; while (++c) if (!(*c)->Test (ev)) return false; - #ifdef CRITERIA_IN_REACTIONS - CcuListIterOf ri = FirstSubscribers; + IvlListIterOf ri = FirstSubscribers; while (++ri) if ((*ri)->Check (ev)) return true; -- cgit v1.1