From 375258b6c9ffa60826e1188e24daa9352d323fa9 Mon Sep 17 00:00:00 2001 From: chatty Date: Mon, 13 Feb 1995 16:57:15 +0000 Subject: Changed status of Activate --- comm/Message.cc | 47 +++++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 30 deletions(-) (limited to 'comm') diff --git a/comm/Message.cc b/comm/Message.cc index 7d42248..fea0d80 100644 --- a/comm/Message.cc +++ b/comm/Message.cc @@ -3,7 +3,7 @@ * * by Michel Beaudouin-Lafon * - * Copyright 1990-1993 + * Copyright 1990-1995 * Laboratoire de Recherche en Informatique (LRI) * * Messages @@ -15,6 +15,7 @@ #include "cplus_bugs.h" #include "Message.h" +#include "MsgStream.h" #include "IOS.h" /*?class UchMessage @@ -63,36 +64,22 @@ UchMessage :: ReadFrom (UchIOS&, lword) } /*? -This virtual function can be redefined in derived classes to support the handling of messages -after they have been loaded from a buffer. The function \typ{MyClient}::\fun{NewMessage} -may then look like: -\begin{ccode} -void -MyClient :: NewMessage (UchMsgBuffer& buffer, bool ask) -{ - MyRequest* m = 0; - lword type; - buffer.MsgPeek (&type); - switch (type) { - case MyFirstReqType: - m = new MyFirstRequest; - break; - case ... - ... - } - if (m) { - buffer.Get (m); - m->Activate (*this); - return true; - } - return false; -} -\end{ccode} -However, this virtual function is only provided as a facility and is not used -by \uch. Redefining it is not mandatory. +This virtual function must be redefined in derived classes to support the handling of messages +after they have been loaded from a buffer. +\var{ask} is true if the message was sent with \fun{Ask}. +In this case an answer must be sent back with \fun{Reply}. +Messages can be sent before replying; they will be buffered by the receiver for later processing. +But you cannot use \fun{Ask} before replying. +In the class \typ{UchMessage} this function does nothing and returns true; +if \var{ask} is true, it replies immediately with an empty message. ?*/ -void -UchMessage :: Activate (UchMsgStream&) +bool +UchMessage :: Activate (UchMsgStream& s, bool ask) { + if (ask) { + UchMessage dummy; + s.Reply (dummy); + } + return true; } -- cgit v1.1