From a38e6d7cf946ce15e4a67bcbd1ffbeaec532763a Mon Sep 17 00:00:00 2001 From: chatty Date: Tue, 28 Nov 2000 14:52:15 +0000 Subject: Added Forget --- dnn/Reaction.cc | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'dnn') diff --git a/dnn/Reaction.cc b/dnn/Reaction.cc index 845d689..77dbb83 100644 --- a/dnn/Reaction.cc +++ b/dnn/Reaction.cc @@ -3,7 +3,7 @@ * * by Stephane Chatty * - * Copyright 1993-1994 + * Copyright 1993-1997 * Centre d'Etudes de la Navigation Aerienne (CENA) * * Reactions. @@ -42,12 +42,23 @@ DnnBaseReaction :: ~DnnBaseReaction () (*ti)->Unsubscribe (*this); } +/*! +Tell a reaction to forget a trigger. This special function is used only +when destroying a trigger. +!*/ +void +DnnBaseReaction :: Forget (DnnTrigger& t) +{ + Triggers.Remove (&t); + Grabbed.Remove (&t); +} + /*?nextdoc?*/ void -DnnBaseReaction :: SubscribeTo (DnnTrigger& t) +DnnBaseReaction :: SubscribeTo (DnnTrigger& t, REL_PRIORITY p) { Triggers.Append (&t); - t.Subscribe (*this); + t.Subscribe (*this, (DnnTrigger::REL_PRIORITY) p); } /*? @@ -90,8 +101,8 @@ DnnBaseReaction :: Manage (DnnEvent&) { } -/*?class DnnReaction -The class \typ{DnnReaction} is a ready-to-use derived class of \typ{DnnBaseReaction}. +/*?class DnnCallback +The class \typ{DnnCallback} is a ready-to-use derived class of \typ{DnnBaseReaction}. In this class, the function \fun{Manage} is redefined to call a function passed when creating the reaction. ?*/ @@ -100,20 +111,20 @@ the reaction. Build a reaction that will call \var{f} to handle events. \fun{f} has to take a \typ{DnnEvent\&} parameter and return \typ{void}. ?*/ -DnnReaction :: DnnReaction (DnnHandlingFunction f) +DnnCallback :: DnnCallback (DnnHandlingFunction f) : DnnBaseReaction (), Handler (f) { } /*?nodoc?*/ -DnnReaction :: ~DnnReaction () +DnnCallback :: ~DnnCallback () { } /*?nodoc?*/ void -DnnReaction :: Manage (DnnEvent& ev) +DnnCallback :: Manage (DnnEvent& ev) { (*Handler) (ev); } -- cgit v1.1