summaryrefslogtreecommitdiff
path: root/comm/MsgStream.h
diff options
context:
space:
mode:
authorchatty2000-11-28 17:07:44 +0000
committerchatty2000-11-28 17:07:44 +0000
commit30f1d67e8b836760abd265f2fc0afeaba810d004 (patch)
tree9aa54f51f052082f021f76580dc1d327876bd820 /comm/MsgStream.h
parent421a701c93c6bd8afda7285b670ba3f264b10128 (diff)
downloadivy-league-30f1d67e8b836760abd265f2fc0afeaba810d004.zip
ivy-league-30f1d67e8b836760abd265f2fc0afeaba810d004.tar.gz
ivy-league-30f1d67e8b836760abd265f2fc0afeaba810d004.tar.bz2
ivy-league-30f1d67e8b836760abd265f2fc0afeaba810d004.tar.xz
Moved parts to BufStream
Diffstat (limited to 'comm/MsgStream.h')
-rw-r--r--comm/MsgStream.h53
1 files changed, 5 insertions, 48 deletions
diff --git a/comm/MsgStream.h b/comm/MsgStream.h
index 0ed867f..7660ae8 100644
--- a/comm/MsgStream.h
+++ b/comm/MsgStream.h
@@ -15,59 +15,16 @@
#ifndef MsgStream_H_
#define MsgStream_H_
-#include "Stream.h"
-#include "ccu/SmartPointer.h"
-#include "MsgBuffer.h"
+#include "BufStream.h"
class UchMessage;
-class UchBufStream : public UchStream {
-protected:
- UchMsgBuffer InBuffer;
- UchMsgBuffer OutBuffer;
- int OutSize;
- bool Sync;
-
- UchBufStream (const UchBufStream&);
- int ReadInput ();
- void HandleWrite ();
-
- void WriteLong (lword);
- void WriteShort (sword);
- void WriteByte (byte);
- void WriteChar (char);
- void WriteString (const char*);
- void WriteBuf (const byte*, int);
-
-
- bool ReadLong (lword&);
- bool ReadShort (sword&);
- bool ReadByte (byte&);
- bool ReadChar (char&);
- int ReadString (char*, int);
- int ReadString (CcuString&);
- bool ReadBuf (byte*, int);
-
-public:
- UchBufStream (UchAddress* = 0, UchAddress* = 0);
- ~UchBufStream ();
-
- void InputBuffer (int min, int grow, int max);
- void OutputBuffer (int min, int grow, int max);
-inline bool GetSyncMode () { return Sync; }
-inline void SetSyncMode (bool s) { Sync = s; Flush (); }
-inline void FlushSize (int n) { OutSize = n; }
-virtual void Flush ();
-
-virtual void Closing (bool);
-};
-
class UchMsgStream : public UchBufStream {
protected:
enum STATE { WAITING, GOT_TYPE, GOT_LENGTH, DONE};
enum TYPE { MSG = 1, ASK, ANS, SYNC, ASYNC, OK };
STATE State;
bool BufferedMessages;
- UchMsgBuffer Buffered;
+ UchMsgBuffer Buffered;
bool WaitingReply;
int InLength;
byte InType;
@@ -82,10 +39,10 @@ public:
~UchMsgStream ();
void HandleRead ();
-virtual UchMessage* DecodeMessage (UchMsgBuffer&);
-virtual UchMessage* DecodeAnswer (UchMsgBuffer&);
+virtual UchMessage* DecodeMessage (UchMsgBuffer&);
+virtual UchMessage* DecodeAnswer (UchMsgBuffer&);
void Send (UchMessage&, bool = false);
- UchMessage* Ask (UchMessage&);
+ UchMessage* Ask (UchMessage&);
void Reply (UchMessage&);
void Send (UchMsgBuffer&, bool = false);
};