Growing heap array, that can release underlying buffer.
More...
#include <staticlib/io/array_sink.hpp>
Public Member Functions |
| | array_sink (AllocFun alloc_fun, FreeFun free_fun, size_t initial_capacity, float grow_coef=1.5) |
| | Constructor.
|
| | array_sink (const array_sink &) |
| | Deleted copy constructor.
|
| array_sink & | operator= (const array_sink &) |
| | Deleted copy assignment operator.
|
| | array_sink (array_sink &&other) STATICLIB_NOEXCEPT |
| | Move constructor.
|
| array_sink & | operator= (array_sink &&other) STATICLIB_NOEXCEPT |
| | Move assignment operator.
|
| | ~array_sink () STATICLIB_NOEXCEPT |
| | Destructor.
|
| std::streamsize | write (span< const char > span) |
| | Write implementation.
|
| std::streamsize | flush () |
| | No-op flush.
|
| span< char > | release () |
| | Releases underlying buffer and returns it inside the span.
|
| char * | data () |
| | Underlying buffer accessor.
|
| const char * | data () const |
| | Underlying buffer const accessor.
|
| size_t | size () const |
| | Size accessor.
|
Detailed Description
template<typename AllocFun, typename FreeFun>
class staticlib::io::array_sink< AllocFun, FreeFun >
Growing heap array, that can release underlying buffer.
Constructor & Destructor Documentation
template<typename AllocFun , typename FreeFun >
Constructor.
- Parameters
-
| alloc_fun | function to use to allocate memory |
| free_fun | function to use to free memory |
| initial_capacity | initial capacity to allocate* |
template<typename AllocFun , typename FreeFun >
Deleted copy constructor.
- Parameters
-
template<typename AllocFun , typename FreeFun >
Move constructor.
- Parameters
-
template<typename AllocFun , typename FreeFun >
Member Function Documentation
template<typename AllocFun , typename FreeFun >
Underlying buffer accessor.
- Returns
- pointer to underlying buffer
template<typename AllocFun , typename FreeFun >
Underlying buffer const accessor.
- Returns
- const pointer to underlying buffer
template<typename AllocFun , typename FreeFun >
template<typename AllocFun , typename FreeFun >
Deleted copy assignment operator.
- Parameters
-
- Returns
- this instance
template<typename AllocFun , typename FreeFun >
Move assignment operator.
- Parameters
-
- Returns
- this instance
template<typename AllocFun , typename FreeFun >
Releases underlying buffer and returns it inside the span.
Returned buffer is always NUL-terminated and must be freed by the client. Sink is left in empty state.
- Returns
- span with sink buffer
template<typename AllocFun , typename FreeFun >
Size accessor.
- Returns
- current size of the buffer
template<typename AllocFun , typename FreeFun >
Write implementation.
- Parameters
-
- Returns
- number of bytes processed
The documentation for this class was generated from the following file: