mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 18:43:35 +08:00
Map<>, TransferBufferManager - isEmpty() calls for runtime checks
This commit is contained in:
@@ -326,19 +326,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int getNumDynamicBuffers() const { return dynamic_buffers_.length(); }
|
||||
|
||||
unsigned int getNumStaticBuffers() const
|
||||
{
|
||||
unsigned int res = 0;
|
||||
for (unsigned int i = 0; i < NUM_STATIC_BUFS; i++)
|
||||
{
|
||||
if (!static_buffers_[i].isEmpty())
|
||||
res++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
TransferBufferBase* access(const TransferBufferManagerKey& key)
|
||||
{
|
||||
if (key.isEmpty())
|
||||
@@ -398,6 +385,21 @@ public:
|
||||
DynamicTransferBuffer::destroy(dyn, allocator_);
|
||||
}
|
||||
}
|
||||
|
||||
bool isEmpty() const { return (getNumStaticBuffers() == 0) && (getNumDynamicBuffers() == 0); }
|
||||
|
||||
unsigned int getNumDynamicBuffers() const { return dynamic_buffers_.length(); }
|
||||
|
||||
unsigned int getNumStaticBuffers() const
|
||||
{
|
||||
unsigned int res = 0;
|
||||
for (unsigned int i = 0; i < NUM_STATIC_BUFS; i++)
|
||||
{
|
||||
if (!static_buffers_[i].isEmpty())
|
||||
res++;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user