From ba919bfda285b5596b92a866516b8fe32be16113 Mon Sep 17 00:00:00 2001 From: chatty Date: Mon, 29 Nov 1993 12:09:03 +0000 Subject: Fixed documentation glitch Removed UchGenEvtMsg Removed UchEventMsg Now use plain UchMessages --- comm/OLD/Service.cc | 144 +++++++++------------------------------------------- 1 file changed, 23 insertions(+), 121 deletions(-) (limited to 'comm/OLD/Service.cc') diff --git a/comm/OLD/Service.cc b/comm/OLD/Service.cc index 618214b..73130ab 100644 --- a/comm/OLD/Service.cc +++ b/comm/OLD/Service.cc @@ -25,20 +25,20 @@ and put in into the event queue with \fun{PutEvent}. It can also handle non event messages (for instance errors). ?*/ -/*?class UchEvtMsgQueue +/*?class UchMsgQueue An event queue is a linked list of events. Events are normally appended to the end of the queue and extracted from the beginning. ?*/ /*?nodoc?*/ -UchEvtMsgQueue :: UchEvtMsgQueue () +UchMsgQueue :: UchMsgQueue () : CcuSmartData (), Queue () { } /*?nodoc?*/ -UchEvtMsgQueue :: ~UchEvtMsgQueue () +UchMsgQueue :: ~UchMsgQueue () { } @@ -47,7 +47,7 @@ UchEvtMsgQueue :: ~UchEvtMsgQueue () Append an event to the queue. ?*/ void -UchEvtMsgQueue :: Put (UchEventMsg* msg) +UchMsgQueue :: Put (UchMessage* msg) { } @@ -55,23 +55,23 @@ UchEvtMsgQueue :: Put (UchEventMsg* msg) Put an event back in the queue (therefore it becomes the first event of the queue). ?*/ void -UchEvtMsgQueue :: PutBack (UchEventMsg* msg) +UchMsgQueue :: PutBack (UchMessage* msg) { } /*? Return the first event from the queue and remove it. ?*/ -UchEventMsg* -UchEvtMsgQueue :: Get () +UchMessage* +UchMsgQueue :: Get () { } /*? Return the first event from the queue without removing it. ?*/ -UchEventMsg* -UchEvtMsgQueue :: Peek () +UchMessage* +UchMsgQueue :: Peek () { } @@ -122,19 +122,19 @@ If not set, a default event queue is created. This function is intended to share a queue between several servers. ?*/ void -UchService :: SetEvQueue (UchEvtMsgQueue* evq) +UchService :: SetEvQueue (UchMsgQueue* evq) { EvQueue = evq; } /*?nextdoc?*/ -UchEventMsg* +UchMessage* UchService :: PeekEvent (bool wait) { Flush (); if (!EvQueue) - EvQueue = new UchEvtMsgQueue; - UchEventMsg* ev = EvQueue->Peek (); + EvQueue = new UchMsgQueue; + UchMessage* ev = EvQueue->Peek (); if (ev || ! wait) return ev; while (! ev) { @@ -152,13 +152,13 @@ If the event queue is empty and \var{wait} is TRUE, the function blocks until an else it returns 0 without blocking. These functions also create the event queue if it was not set with \fun{SetEvQueue}. ?*/ -UchEventMsg* +UchMessage* UchService :: GetEvent (bool wait) { Flush (); if (!EvQueue) - EvQueue = new UchEvtMsgQueue; - UchEventMsg* ev = EvQueue->Get (); + EvQueue = new UchMsgQueue; + UchMessage* ev = EvQueue->Get (); if (ev || ! wait) return ev; while (! ev) { @@ -170,11 +170,10 @@ UchService :: GetEvent (bool wait) /*?nextdoc?*/ void -UchService :: PutEvent (UchEventMsg* ev) +UchService :: PutEvent (UchMessage* ev) { if (! EvQueue) - EvQueue = new UchEvtMsgQueue; - ev->From = this; + EvQueue = new UchMsgQueue; EvQueue->Put (ev); } @@ -185,55 +184,15 @@ They create the event queue if it was not set with \fun{SetEvQueue}, and set the event's server. ?*/ void -UchService :: PutBackEvent (UchEventMsg* ev) +UchService :: PutBackEvent (UchMessage* ev) { if (! EvQueue) - EvQueue = new UchEvtMsgQueue; - ev->From = this; + EvQueue = new UchMsgQueue; EvQueue->PutBack (ev); } -/*?class UchEventMsg -This class derives from \typ{UchMessage}, so it inherits the usual virtual functions -\fun{ReadFrom} and \fun{WriteTo} that must be redefined in each derived class. -An event is created when a client receives an asynchronous message from its server. -Events are linked together in event queues. -Events must derive from this class. -?*/ - -#ifdef DOC -// fake entries for inline functions - -/*? -Construct an event. -?*/ -UchEventMsg :: UchEventMsg () -{ -} - -#endif /* DOC */ - -/*?nodoc?*/ -UchEventMsg :: ~UchEventMsg () -{ -} - -#ifdef DOC - -/*? -Return the server that sent this event. -The service is known only if the event was appended to the event queue with \fun{UchService::PutEvent}, -else it is 0. -?*/ -UchService* -UchEventMsg :: GetService () -{ -} - -#endif /* DOC */ - -/*?class UchGenEvtMsg +/*?class UchGenMsg This is a sample derived class of \typ{UchEventMsg}. It defines events that contain a pointer to a \typ{UchMessage}. This message must be allocated dynamically because it is deleted by the destructor. @@ -242,13 +201,13 @@ The virtual functions \fun{ReadFrom} and \fun{WriteTo} are defined to act upon t The following example fetches a word from the input buffer, creates a message depending on its value -(\typ{FOO_MSG} and \typ{BAR_MSG} have been derived from \typ{UchMessage}), +(\typ{FOO\_MSG} and \typ{BAR\_MSG} have been derived from \typ{UchMessage}), and transfers the data from the buffer to the event with \fun{Get}. This piece of code typically appears in the body of \fun{NewMessage}: \begin{ccode} -UchGenEvtMsg* ev = new UchGenEvtMsg; +UchGenMsg* ev = new UchGenMsg; sword type; if (! buf.Peek (&type)) return; @@ -269,60 +228,3 @@ PutEvent (ev); \end{ccode} ?*/ -#ifdef DOC - -/*?nextdoc?*/ -UchGenEvtMsg :: UchGenEvtMsg () -{ } - -/*? -Construct a generic event. The second constructor sets its message. -The message is deleted when the event is destroyed. -Thus the message must have been allocated dynamically. -?*/ -UchGenEvtMsg :: UchGenEvtMsg (UchMessage* m) -{ } - -#endif /* DOC */ - -/*?nodoc?*/ -UchGenEvtMsg :: ~UchGenEvtMsg () -{ - if (Msg) - delete Msg; -} - - -#ifdef DOC - -/*?nextdoc?*/ -void -UchGenEvtMsg :: SetMsg (UchMessage* m) -{ } - -/*? -Set and get the message associated to the event. -When setting the value, the previous message of the event (if any) is deleted. -?*/ -UchMessage* -UchGenEvtMsg :: GetMsg () -{ } - -#endif /* DOC */ - -/*?nodoc?*/ -void -UchGenEvtMsg :: ReadFrom (UchMsgBuffer& buf, lword l) -{ - if (Msg) - Msg->ReadFrom (buf, l); -} - -/*?nodoc?*/ -void -UchGenEvtMsg :: WriteTo (UchMsgBuffer& buf) -{ - if (Msg) - Msg->WriteTo (buf); -} - -- cgit v1.1