#include <chunk.h>
Public Member Functions | |
OwnedChunk (OwnedChunk &&other) noexcept | |
OwnedChunk & | operator= (OwnedChunk &&other) noexcept |
~OwnedChunk () | |
This method will acquire a mutex and is not IRQ safe. | |
std::byte * | data () |
const std::byte * | data () const |
size_t | size () const |
std::byte & | operator[] (size_t index) |
std::byte | operator[] (size_t index) const |
std::byte * | begin () |
const std::byte * | begin () const |
const std::byte * | cbegin () const |
std::byte * | end () |
const std::byte * | end () const |
const std::byte * | cend () const |
Chunk & | operator* () |
const Chunk & | operator* () const |
Chunk * | operator-> () |
const Chunk * | operator-> () const |
void | Release () |
Chunk * | Take () && |
Friends | |
class | Chunk |
class | ChunkRegionTracker |
class | MultiBuf |
class | MultiBufChunks |
An RAII handle to a contiguous slice of data.
Note: OwnedChunk
may acquire a pw::sync::Mutex
during destruction, and so must not be destroyed within ISR contexts.
void pw::multibuf::OwnedChunk::Release | ( | ) |
Decrements the reference count on the underlying chunk of data and empties this handle so that span()
now returns an empty (zero-sized) span.
Does not modify the underlying data, but may cause it to be deallocated if this was the only remaining Chunk
referring to its region.
This method is equivalent to { Chunk _unused = std::move(chunk_ref); }
This method will acquire a mutex and is not IRQ safe.
|
inline |
Returns the contained Chunk*
and empties this OwnedChunk
without releasing the underlying Chunk
.
|
friend |
Allow ChunkRegionTracker
and MultiBuf
to create OwnedChunk
s using the private constructor above.