wibble::stream::PosixBuf Class Reference

`#include <posix.h>`

Inheritance diagram for wibble::stream::PosixBuf:
[legend]
Collaboration diagram for wibble::stream::PosixBuf:
[legend]

## Public Member Functions

| PosixBuf ()
| PosixBuf (int fd, size_t bufsize=4096)
| ~PosixBuf ()
void | attach (int fd, size_t bufsize=4096)
| Attach the stream to a file descriptor, using the given stream size. More...
int | detach ()
| Sync the PosixBuf and detach it from the file descriptor. More...
int | fd () const
| Access the underlying file descriptor. More...
int | overflow (int c)
int | sync ()

## Constructor & Destructor Documentation

wibble::stream::PosixBuf::PosixBuf | ( |  | ) |

inline

wibble::stream::PosixBuf::PosixBuf | ( | int | fd,
|  | size_t | bufsize = `4096`
| ) |  |

inline

References attach().

wibble::stream::PosixBuf::~PosixBuf | ( |  | ) |

inline

References sync().

## Member Function Documentation

void wibble::stream::PosixBuf::attach | ( | int | fd,
|  | size_t | bufsize = `4096`
| ) |  |

inline

Attach the stream to a file descriptor, using the given stream size.

Management of the file descriptor will be taken over by the PosixBuf, and the file descriptor will be closed with PosixBuf goes out of scope.

References fd().

Referenced by PosixBuf().

int wibble::stream::PosixBuf::detach | ( |  | ) |

inline

Sync the PosixBuf and detach it from the file descriptor.

PosixBuf will not touch the file descriptor anymore, and it is the responsibility of the caller to close it.

Returns
  The file descriptor

References sync().

int wibble::stream::PosixBuf::fd | ( |  | ) | const

inline

Access the underlying file descriptor.

Referenced by attach().

int wibble::stream::PosixBuf::overflow | ( | int | c | ) |

inline

References sync().

int wibble::stream::PosixBuf::sync | ( |  | ) |

inline

Referenced by detach(), overflow(), and ~PosixBuf().

The documentation for this class was generated from the following file:

- posix.h