Encapsulates uv_buf_t data type and provides uv_buf_t[] functionality.  
 More...
#include "buffer.hpp"
| Public Types | |
| using | uv_t = ::uv_buf_t | 
| using | sink_cb_t = std::function< void(buffer &) > | 
| The function type of the callback called when the reference count of the buffer using within the program becomes zero and the buffer instance is going to be destroyed. uvcc creates a new variable referencing the buffer instance (so its usage count gets equal to one) and passes a reference to this variable to the sink callback. If the client code wish to store this free buffer for further reuse, it must move (or copy) the variable into some designated storage structure, otherwise no any action is required, and the buffer will be destroyed. | |
| Public Member Functions | |
| buffer () | |
| Create a single uv_buf_tnull-initialized buffer structure.  More... | |
| buffer (const std::initializer_list< std::size_t > &_len_values) | |
| Create an array of initialized uv_buf_tbuffer describing structures.  More... | |
| buffer (const buffer &_that) | |
| buffer & | operator= (const buffer &_that) | 
| buffer (buffer &&_that) noexcept | |
| buffer & | operator= (buffer &&_that) noexcept | 
| void | swap (buffer &_that) noexcept | 
| long | nrefs () const noexcept | 
| The current number of existing references to the same buffer as this variable refers to. | |
| sink_cb_t & | sink_cb () const noexcept | 
| std::size_t | count () const noexcept | 
| The number of the uv_buf_tstructures in the array. | |
| uv_t & | operator[] (const std::size_t _i) const noexcept | 
| Access to the _i-thuv_buf_tbuffer structure in the array. | |
| decltype(uv_t::base) & | base (const std::size_t _i=0) const noexcept | 
| The .basefield of the_i-th buffer structure. | |
| decltype(uv_t::len) & | len (const std::size_t _i=0) const noexcept | 
| The .lenfield of the_i-th buffer structure. | |
| operator const uv_t * () const noexcept | |
| operator uv_t * () noexcept | |
| operator bool () const noexcept | |
| Equivalent to (base() != nullptr). | |
Encapsulates uv_buf_t data type and provides uv_buf_t[] functionality. 
Definition at line 28 of file buffer.hpp.
| 
 | inline | 
Create a single uv_buf_t null-initialized buffer structure. 
That is:
Definition at line 180 of file buffer.hpp.
| 
 | inlineexplicit | 
Create an array of initialized uv_buf_t buffer describing structures. 
Each uv_buf_t structure in the array is effectively initialized with an allocated memory chunk of the specified length. The number of structures in the array is equal to the number of elements in the initializer list. The value of the .len field and the length of the each allocated chunk pointed by the .base field is equal to the corresponding value from the initializer list.
All chunks are located seamlessly one after the next within a single continuous memory block. Therefore the .base field of the next buffer just points to the byte following the end of the previous buffer and the .base field of the first buffer in the array points to the whole memory area of the total length of all buffers.
If some of the initializing values are zeros, the .base field of the such a buffer is not a nullptr. Instead it keeps pointing inside the continuous memory block and is considered as a zero-length chunk.
All of the initializing values being zeros results in creating an array of null-initialized uv_buf_t structures. 
Definition at line 199 of file buffer.hpp.