#ifndef CHILON_POLL_BUFFERED_SOCKET_CLIENT_HPP
#define CHILON_POLL_BUFFERED_SOCKET_CLIENT_HPP
#include <chilon/poll/socket_client.hpp>
#ifndef CHILON_DEFAULT_BUFF_SIZE
#define CHILON_DEFAULT_BUFF_SIZE 4096
#endif
namespace chilon { namespace poll {
/**
* @brief buffered_socket_client represents a socket and provides read and write buffers
* for it to use.
*/
template <class Client, int READ_BUFF_SIZE = CHILON_DEFAULT_BUFF_SIZE, int SEND_BUFF_SIZE = READ_BUFF_SIZE>
struct buffered_socket_client : public socket_client<Client> {
buffered_socket_client()
: end_idx_(0), read_idx_(0), write_idx_(0) {}
buffered_socket_client(int const socket)
: socket_client<Client>(socket), end_idx_(0), read_idx_(0), write_idx_(0) {}
int end_idx_;
int read_idx_;
char read_[READ_BUFF_SIZE];
char write_[SEND_BUFF_SIZE];
off_t write_idx_;
};
} }
#endif