Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cpu_buffer.hpp « drape - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 28a935b0f4a2ce353bc0b60524690067eb992c0b (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
#pragma once

#include "drape/buffer_base.hpp"

#include <memory>
#include <vector>

namespace dp
{
class CPUBuffer : public BufferBase
{
  using TBase = BufferBase;
public:
  CPUBuffer(uint8_t elementSize, uint32_t capacity);
  ~CPUBuffer() override;

  void UploadData(void const * data, uint32_t elementCount);
  // Set memory cursor on element with number == "elementNumber"
  // Element numbers start from 0
  void Seek(uint32_t elementNumber) override;
  // Check function. In real world use must use it only in assert
  uint32_t GetCurrentElementNumber() const;
  unsigned char const * Data() const;

private:
  unsigned char * NonConstData();
  unsigned char * GetCursor() const;

  unsigned char * m_memoryCursor;
  std::shared_ptr<std::vector<unsigned char>> m_memory;
};
}  // namespace dp