00001
00002
00003
00004
00005 #ifndef EQNET_BUFFER_CONNECTION_H
00006 #define EQNET_BUFFER_CONNECTION_H
00007
00008 #include <eq/net/connection.h>
00009 #include <eq/base/nonCopyable.h>
00010
00011 namespace eq
00012 {
00013 namespace net
00014 {
00018 class EQ_EXPORT BufferConnection : public Connection,
00019 public base::NonCopyable
00020 {
00021 public:
00022 BufferConnection();
00023 virtual ~BufferConnection();
00024
00025 void sendBuffer( ConnectionPtr connection );
00026
00027 uint64_t getSize() const { return _size; }
00028
00029 protected:
00030 virtual int64_t read( void* buffer, const uint64_t bytes )
00031 { EQDONTCALL; return -1; }
00032 virtual int64_t write( const void* buffer, const uint64_t bytes ) const;
00033
00034 private:
00035 mutable uint8_t* _buffer;
00036 mutable uint64_t _size;
00037 mutable uint64_t _maxSize;
00038 };
00039 }
00040 }
00041
00042 #endif //EQNET_BUFFER_CONNECTION_H