|
libvisual
0.5.0
|
Reference-counted memory block. More...
#include <libvisual/lv_buffer.h>
Public Member Functions | |
| Buffer (Buffer const &)=delete | |
| Buffer & | operator= (Buffer const &)=delete |
| void | destroy_content () |
| Destroys the buffer content. | |
| void | set (void *data, std::size_t size) |
| Sets the data pair (data and its size). More... | |
| void | set_size (std::size_t size) |
| Sets the size of the data. More... | |
| void | set_data (void *data) |
| Sets the pointer to a memory block to manage. More... | |
| void | allocate (std::size_t size) |
| Allocates the data for a Buffer. More... | |
| void * | get_data () const |
| Return the pointer to the managed memory block. More... | |
| void * | get_data (std::size_t offset) const |
| Returns the pointer to the managed memory block, starting at a given offset. More... | |
| std::size_t | get_size () const |
| Gets the size in bytes of a Buffer. More... | |
| bool | is_allocated () const |
| Returns true if memory block is allocated and managed by the Buffer. More... | |
| void | copy (BufferConstPtr const &src) |
| Clones the content of another Buffer. More... | |
| void | copy_to (BufferPtr const &dest) |
| Copies all data to a given Buffer. More... | |
| void | copy_to (void *dest, std::size_t size) |
| Copies all data to a given memory location. More... | |
| void | put (BufferConstPtr const &src, std::size_t offset) |
| Copies data from another Buffer. More... | |
| void | put (void const *data, std::size_t size, std::size_t offset) |
| Copies data from a memory location. More... | |
| void | fill (uint8_t value) |
| Fills the buffer with a byte value. More... | |
| void | fill_with_pattern (void const *data, std::size_t size) |
| Fills the buffer with a data pattern drawn from a memory location. More... | |
Static Public Member Functions | |
| static BufferPtr | create () |
| Constructs a new empty Buffer. | |
| static BufferPtr | wrap (void *data, std::size_t size, bool own=true) |
| Constructs a new Buffer with an externally allocated block. More... | |
| static BufferPtr | create (std::size_t size) |
| Constructs a new Buffer of a given size. More... | |
Friends | |
| void | intrusive_ptr_add_ref (Buffer const *buffer) |
| void | intrusive_ptr_release (Buffer const *buffer) |
Reference-counted memory block.
Definition at line 50 of file lv_buffer.h.
| void LV::Buffer::allocate | ( | std::size_t | size | ) |
Allocates the data for a Buffer.
| size | Size of memory block |
Definition at line 137 of file lv_buffer.cpp.
| void LV::Buffer::copy | ( | BufferConstPtr const & | src | ) |
Clones the content of another Buffer.
| src | source Buffer to clone data from |
Definition at line 162 of file lv_buffer.cpp.
| void LV::Buffer::copy_to | ( | BufferPtr const & | dest | ) |
Copies all data to a given Buffer.
| dest | Buffer to copy to |
Definition at line 175 of file lv_buffer.cpp.
| void LV::Buffer::copy_to | ( | void * | dest, |
| std::size_t | size | ||
| ) |
Copies all data to a given memory location.
| dest | pointer to memory location |
| size | number of bytes to copy |
Definition at line 168 of file lv_buffer.cpp.
|
static |
Constructs a new Buffer of a given size.
| size | size in bytes |
Definition at line 103 of file lv_buffer.cpp.
| void LV::Buffer::fill | ( | uint8_t | value | ) |
Fills the buffer with a byte value.
| value | fill value |
Definition at line 195 of file lv_buffer.cpp.
| void LV::Buffer::fill_with_pattern | ( | void const * | data, |
| std::size_t | size | ||
| ) |
Fills the buffer with a data pattern drawn from a memory location.
| data | pointer to memory block to source pattern from |
| size | number of bytes to fill |
Definition at line 200 of file lv_buffer.cpp.
| void * LV::Buffer::get_data | ( | ) | const |
Return the pointer to the managed memory block.
Definition at line 142 of file lv_buffer.cpp.
| void * LV::Buffer::get_data | ( | std::size_t | offset | ) | const |
Returns the pointer to the managed memory block, starting at a given offset.
| offset | offset in bytes |
Definition at line 147 of file lv_buffer.cpp.
| std::size_t LV::Buffer::get_size | ( | ) | const |
Gets the size in bytes of a Buffer.
Definition at line 152 of file lv_buffer.cpp.
| bool LV::Buffer::is_allocated | ( | ) | const |
Returns true if memory block is allocated and managed by the Buffer.
Definition at line 157 of file lv_buffer.cpp.
| void LV::Buffer::put | ( | BufferConstPtr const & | src, |
| std::size_t | offset | ||
| ) |
Copies data from another Buffer.
| src | source Buffer |
| offset | offset to copy first byte to |
Definition at line 180 of file lv_buffer.cpp.
Referenced by fill_with_pattern().
| void LV::Buffer::put | ( | void const * | data, |
| std::size_t | size, | ||
| std::size_t | offset | ||
| ) |
Copies data from a memory location.
| data | pointer to memory location |
| size | number of bytes to copy |
| offset | offset to copy first byte to |
Definition at line 185 of file lv_buffer.cpp.
| void LV::Buffer::set | ( | void * | data, |
| std::size_t | size | ||
| ) |
Sets the data pair (data and its size).
| data | Pointer to memory block |
| size | Size of memory block |
Definition at line 122 of file lv_buffer.cpp.
| void LV::Buffer::set_data | ( | void * | data | ) |
Sets the pointer to a memory block to manage.
| data | Pointer to the data. |
Definition at line 132 of file lv_buffer.cpp.
| void LV::Buffer::set_size | ( | std::size_t | size | ) |
Sets the size of the data.
| size | Size in bytes of the data. |
Definition at line 127 of file lv_buffer.cpp.
|
static |
Constructs a new Buffer with an externally allocated block.
| data | pointer to memory block |
| size | size of memory block in bytes |
| own | indicates whether to take ownership |
Definition at line 94 of file lv_buffer.cpp.