mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 00:03:34 +08:00
Implemented TransferBufferManager
This commit is contained in:
@@ -62,6 +62,26 @@ void DynamicTransferBuffer::Block::write(const uint8_t*& inptr, unsigned int tar
|
||||
/*
|
||||
* DynamicTransferBuffer
|
||||
*/
|
||||
DynamicTransferBuffer* DynamicTransferBuffer::instantiate(IAllocator* allocator)
|
||||
{
|
||||
assert(allocator);
|
||||
void* const praw = allocator->allocate(sizeof(DynamicTransferBuffer));
|
||||
if (praw == NULL)
|
||||
return NULL;
|
||||
return new (praw) DynamicTransferBuffer(allocator);
|
||||
}
|
||||
|
||||
void DynamicTransferBuffer::destroy(DynamicTransferBuffer*& obj, IAllocator* allocator)
|
||||
{
|
||||
assert(allocator);
|
||||
if (obj != NULL)
|
||||
{
|
||||
obj->~DynamicTransferBuffer();
|
||||
allocator->deallocate(obj);
|
||||
obj = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void DynamicTransferBuffer::resetImpl()
|
||||
{
|
||||
max_write_pos_ = 0;
|
||||
|
||||
Reference in New Issue
Block a user