00001 #ifndef STATICIOCONN_seen
00002 #define STATICIOCONN_seen
00003
00004
00014 class StaticIOConnection :public virtual Connection
00015 {
00016 private:
00017 FILE* in;
00018 FILE* out;
00019 JCPN(Reader)* reader;
00020 JCPN(Writer)* writer;
00021 int clientId;
00022 public:
00023 StaticIOConnection (FILE* in, FILE* out, int clientId)
00024 :Connection(NULL)
00025 {
00026 this->in = in;
00027 this->out = out;
00028 reader = new JCPN(StdReader)(fileno(in));
00029 writer = new JCPN(StdWriter)(fileno(out));
00030 this->clientId = clientId;
00031 };
00032 void setReadCallback( ReadCallback* callback )
00033 { Connection::setReadCallback(callback); doReadCallback(); };
00034
00035
00036
00037 virtual JCPN(Reader)* getIn() { return reader; };
00038 virtual JCPN(Writer)* getOut() {return writer; };
00039 virtual void shutdown() { close(fileno(in)); close(fileno(out)); };
00040 virtual char* getName() { return ""; };
00041 int getId() { return clientId; }
00042 };
00043
00044 #endif
00045
00046
00047
00048