/* * Ivy League * * Buffered streams * * Copyright 1990-2000 * Laboratoire de Recherche en Informatique (LRI) * Centre d'Etudes de la Navigation Aerienne (CENA) * * by Stephane Chatty * portions of code by Michel Beaudouin-Lafon * * $Id$ * */ #ifndef BufStream_H_ #define BufStream_H_ #include "Stream.h" #include "MsgBuffer.h" class IvlBufStream : public IvlStream { protected: IvlMsgBuffer InBuffer; IvlMsgBuffer OutBuffer; int OutSize; bool Sync; IvlBufStream (const IvlBufStream&); 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 (IvlString&); bool ReadBuf (byte*, int); public: IvlBufStream (IvlAddress* = 0, IvlAddress* = 0); ~IvlBufStream (); 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); }; #endif /* BufStream_H_ */