diff options
author | chatty | 1993-04-07 11:50:31 +0000 |
---|---|---|
committer | chatty | 1993-04-07 11:50:31 +0000 |
commit | ba066c34dde204aa192d03a23a81356374d93731 (patch) | |
tree | 39391f6235d2cf8a59a0634ac5ea430cdd21f5d4 /comm/OLD/Service.h | |
parent | 05ab076e1c2a9ca16472f9a6b47b8d22914b3783 (diff) | |
download | ivy-league-ba066c34dde204aa192d03a23a81356374d93731.zip ivy-league-ba066c34dde204aa192d03a23a81356374d93731.tar.gz ivy-league-ba066c34dde204aa192d03a23a81356374d93731.tar.bz2 ivy-league-ba066c34dde204aa192d03a23a81356374d93731.tar.xz |
Initial revision
Diffstat (limited to 'comm/OLD/Service.h')
-rw-r--r-- | comm/OLD/Service.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/comm/OLD/Service.h b/comm/OLD/Service.h new file mode 100644 index 0000000..b97a6cf --- /dev/null +++ b/comm/OLD/Service.h @@ -0,0 +1,100 @@ +/* + * The Unix Channel + * + * by Michel Beaudouin-Lafon + * + * Copyright 1990-1993 + * Laboratoire de Recherche en Informatique (LRI) + * + * Client side: services + * + * $Id$ + * $CurLog$ + */ + +#ifndef Service_H_ +#define Service_H_ + +#include "Message.h" +#include "MsgStream.h" +#include "error.h" +#include "cplus_bugs.h" +#include "ccu/List.h" + +class UchService; + +// events are messages sent by a server that are linked into an event list +// +class UchEventMsg : public UchMessage { +friend class UchService; + +protected: + UchMsgStream* From; + +public: + +inline UchEventMsg () : UchMessage (), From (0) { } + ~UchEventMsg (); + +inline UchMsgStream* GetSource () { return From; } +}; + + +class UchGenEvtMsg : public UchEventMsg { +protected: + UchMessage* Msg; + +public: +inline UchGenEvtMsg () : UchEventMsg () { Msg = 0; } +inline UchGenEvtMsg (UchMessage* m) : UchEventMsg () { Msg = m; } + ~UchGenEvtMsg (); + + void WriteTo (UchMsgBuffer&); + void ReadFrom (UchMsgBuffer&, lword); +inline void SetMsg (UchMessage* m) { if (Msg) delete Msg; Msg = m; } +inline UchMessage* GetMsg () { return Msg; } +}; + +// class for storing and retrieving events +// +class UchEvtMsgQueue : public CcuSmartData { + +protected: + CcuListOf <UchEventMsg> Queue; + +public: + UchEvtMsgQueue (); + ~UchEvtMsgQueue (); + +inline void Put (UchEventMsg* m) { Queue.Append (m); } +inline UchEventMsg* Peek () { return Queue.First (); } +inline UchEventMsg* Get () { return Queue.RemoveFirst (); } +inline void PutBack (UchEventMsg* m) { Queue.Prepend (m); } +inline operator const CcuListOf <UchEventMsg>& () const { return Queue; } +}; + +PointerClass (pUchEvtMsgQueue, UchEvtMsgQueue) + +// UchService is the client's view of a server +// we use smart pointers so that the event queue can be shared +// +class UchService : public UchMsgStream { +protected: + pUchEvtMsgQueue EvQueue; + +public: + UchService (); + UchService (UchAddress*); + UchService (const UchService&); + ~UchService (); + + UchChannel* Copy () const; + + void SetEvQueue (UchEvtMsgQueue*); + UchEventMsg* PeekEvent (bool = TRUE); + UchEventMsg* GetEvent (bool = TRUE); + void PutEvent (UchEventMsg*); + void PutBackEvent (UchEventMsg*); +}; + +#endif /* Service_H_ */ |