AsyncStream.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <boost/system/error_code.hpp>
00020 #include "Buffer.h"
00021
00022 namespace adchpp {
00023
00024 class AsyncStream : private boost::noncopyable {
00025 public:
00026 typedef std::function<void (const boost::system::error_code& ec, size_t)> Handler;
00027
00028 virtual size_t available() = 0;
00029 virtual void prepareRead(const BufferPtr& buf, const Handler& handler) = 0;
00030 virtual size_t read(const BufferPtr& buf) = 0;
00031 virtual void write(const BufferList& bufs, const Handler& handler) = 0;
00032 virtual void close() = 0;
00033
00034 virtual ~AsyncStream() { }
00035 };
00036
00037 typedef shared_ptr<AsyncStream> AsyncStreamPtr;
00038
00039 }