mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 21:33:59 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
58
drape/buffer_base.cpp
Normal file
58
drape/buffer_base.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#include "drape/buffer_base.hpp"
|
||||
#include "base/assert.hpp"
|
||||
|
||||
namespace dp
|
||||
{
|
||||
|
||||
BufferBase::BufferBase(uint8_t elementSize, uint32_t capacity)
|
||||
: m_elementSize(elementSize)
|
||||
, m_capacity(capacity)
|
||||
, m_size(0)
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t BufferBase::GetCapacity() const
|
||||
{
|
||||
return m_capacity;
|
||||
}
|
||||
|
||||
uint32_t BufferBase::GetCurrentSize() const
|
||||
{
|
||||
return m_size;
|
||||
}
|
||||
|
||||
uint32_t BufferBase::GetAvailableSize() const
|
||||
{
|
||||
return m_capacity - m_size;
|
||||
}
|
||||
|
||||
void BufferBase::Resize(uint32_t elementCount)
|
||||
{
|
||||
m_capacity = elementCount;
|
||||
m_size = 0;
|
||||
}
|
||||
|
||||
uint8_t BufferBase::GetElementSize() const
|
||||
{
|
||||
return m_elementSize;
|
||||
}
|
||||
|
||||
void BufferBase::Seek(uint32_t elementNumber)
|
||||
{
|
||||
ASSERT(elementNumber <= m_capacity, ());
|
||||
m_size = elementNumber;
|
||||
}
|
||||
|
||||
void BufferBase::UploadData(uint32_t elementCount)
|
||||
{
|
||||
ASSERT(m_size + elementCount <= m_capacity, ());
|
||||
m_size += elementCount;
|
||||
}
|
||||
|
||||
void BufferBase::SetDataSize(uint32_t elementCount)
|
||||
{
|
||||
ASSERT(elementCount <= m_capacity, ());
|
||||
m_size = elementCount;
|
||||
}
|
||||
|
||||
} // namespace dp
|
||||
Reference in New Issue
Block a user