#include <unix_buffer.H>
Public Member Functions | |
int | get_descriptor () const |
returns the attached file/socket descriptor | |
void | attach (const int _fd, const bool autoclose=true) |
virtual int | detach () |
unix_fd_buffer (void) | |
create an unix_fd_buffer that is ready to be connected to a file/socket descriptor | |
unix_fd_buffer (const int _fd) | |
virtual | ~unix_fd_buffer () |
destroy the unix_fd_buffer and close resource (if any was open) | |
Protected Member Functions | |
virtual int | _get_descriptor () const |
virtual int | empty_buffer () |
virtual int | overflow (int c) |
virtual int | sync () |
virtual int | underflow () |
Protected Attributes | |
int | fd |
bool | fd_autoclose |
char | obuffer [buffersize] |
char | ibuffer [buffersize+pushbacksize] |
Static Protected Attributes | |
static const int | buffersize = 4096 |
static const int | pushbacksize = 10 |
Definition at line 732 of file unix_buffer.H.
unix_fd_buffer::unix_fd_buffer | ( | void | ) | [inline] |
create an unix_fd_buffer that is ready to be connected to a file/socket descriptor
Definition at line 888 of file unix_buffer.H.
unix_fd_buffer::unix_fd_buffer | ( | const int | _fd | ) | [inline, explicit] |
create an unix_fd_buffer that is connected to the given file/socket descriptor
_fd | descriptor of an already opened connection |
autoclose
set to false
Definition at line 903 of file unix_buffer.H.
virtual unix_fd_buffer::~unix_fd_buffer | ( | ) | [inline, virtual] |
destroy the unix_fd_buffer and close resource (if any was open)
Definition at line 912 of file unix_buffer.H.
virtual int unix_fd_buffer::_get_descriptor | ( | ) | const [inline, protected, virtual] |
Implements Cprovide_descriptor_access.
Reimplemented in unix_buffer.
Definition at line 742 of file unix_buffer.H.
virtual int unix_fd_buffer::empty_buffer | ( | ) | [inline, protected, virtual] |
Reimplemented in unix_buffer.
Definition at line 744 of file unix_buffer.H.
References buffersize, cerr, count(), endl(), errno, my_strerror(), obuffer, and PTHREAD_TESTCANCEL.
Referenced by overflow(), and sync().
virtual int unix_fd_buffer::overflow | ( | int | c | ) | [inline, protected, virtual] |
Definition at line 787 of file unix_buffer.H.
References empty_buffer().
virtual int unix_fd_buffer::sync | ( | ) | [inline, protected, virtual] |
Definition at line 794 of file unix_buffer.H.
References empty_buffer().
virtual int unix_fd_buffer::underflow | ( | ) | [inline, protected, virtual] |
Reimplemented in unix_buffer.
Definition at line 799 of file unix_buffer.H.
References buffersize, count(), errno, ibuffer, my_strerror(), PTHREAD_TESTCANCEL, and pushbacksize.
int unix_fd_buffer::get_descriptor | ( | ) | const [inline] |
returns the attached file/socket descriptor
Definition at line 833 of file unix_buffer.H.
Referenced by sd_iostream::_get_descriptor(), fd_iostream::_get_descriptor(), and unix_io_stream::_get_descriptor().
void unix_fd_buffer::attach | ( | const int | _fd, | |
const bool | autoclose = true | |||
) | [inline] |
attach a file / network connection via the given file/socket descriptor
_fd | file/socket descriptor to attach | |
autoclose | (optional) whether _fd should be closed on destruction of this object |
Definition at line 850 of file unix_buffer.H.
virtual int unix_fd_buffer::detach | ( | ) | [inline, virtual] |
detach the buffer from the file/socket descriptor
returnvalue
is not -1, it is most possibly open and should not be thrown away. Reimplemented in unix_buffer.
Definition at line 872 of file unix_buffer.H.
const int unix_fd_buffer::buffersize = 4096 [static, protected] |
Definition at line 735 of file unix_buffer.H.
Referenced by unix_buffer::empty_buffer(), empty_buffer(), unix_buffer::underflow(), and underflow().
const int unix_fd_buffer::pushbacksize = 10 [static, protected] |
Definition at line 736 of file unix_buffer.H.
Referenced by unix_buffer::underflow(), and underflow().
int unix_fd_buffer::fd [protected] |
Definition at line 737 of file unix_buffer.H.
bool unix_fd_buffer::fd_autoclose [protected] |
Definition at line 738 of file unix_buffer.H.
char unix_fd_buffer::obuffer[buffersize] [protected] |
Definition at line 739 of file unix_buffer.H.
Referenced by unix_buffer::empty_buffer(), and empty_buffer().
char unix_fd_buffer::ibuffer[buffersize+pushbacksize] [protected] |
Definition at line 740 of file unix_buffer.H.
Referenced by unix_buffer::underflow(), and underflow().