00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MDWLINEBUFFERPROTOCOL_H
00021 #define MDWLINEBUFFERPROTOCOL_H
00022 #include <map>
00023
00024 #include "StreamServerApi.h"
00025
00026 namespace mdw
00027 {
00028 class StreamInfo;
00032 class LineBufferProtocol : public StreamServerVisitor, public StreamSizeServer
00033 {
00034 public:
00035 LineBufferProtocol (StreamServer &server);
00036
00037 ~LineBufferProtocol();
00038 virtual void visitRead (char *buffer, int size, StreamInfo &info);
00039 virtual void visitConnect (StreamInfo &info);
00040 virtual void visitDisconnect (StreamInfo &info);
00041
00042 virtual void accept(StreamServerVisitor&, int, int);
00043 virtual void accept(StreamSizeServerVisitor &visitor, int timeOutSec, int timeOutMicro);
00044 virtual void write(const char* buffer, int size, int streamId);
00045 virtual Stream &outStream(int streamId);
00046 virtual void close(int streamId);
00047
00048 private:
00049 StreamServer &_server;
00050 StreamSizeServerVisitor *_currentSizeVisitor;
00051 StreamServerVisitor *_currentVisitor;
00052 std::map<int, std::string> _buffers;
00053 };
00054
00055 }
00056
00057 #endif