blob: 34aa81bcdb095d43bc7e5fe1f7122ee32525037d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#include "drape/buffer_base.hpp"
#include "base/assert.hpp"
namespace dp
{
BufferBase::BufferBase(uint8_t elementSize, uint16_t capacity)
: m_elementSize(elementSize)
, m_capacity(capacity)
, m_size(0)
{
}
uint16_t BufferBase::GetCapacity() const
{
return m_capacity;
}
uint16_t BufferBase::GetCurrentSize() const
{
return m_size;
}
uint16_t BufferBase::GetAvailableSize() const
{
return m_capacity - m_size;
}
void BufferBase::Resize(uint16_t elementCount)
{
m_capacity = elementCount;
m_size = 0;
}
uint8_t BufferBase::GetElementSize() const
{
return m_elementSize;
}
void BufferBase::Seek(uint16_t elementNumber)
{
ASSERT(elementNumber <= m_capacity, ());
m_size = elementNumber;
}
void BufferBase::UploadData(uint16_t elementCount)
{
ASSERT(m_size + elementCount <= m_capacity, ());
m_size += elementCount;
}
} // namespace dp
|