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

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

#include "../base/mutex.hpp"
#include "../std/vector.hpp"
#include "../std/shared_ptr.hpp"
#include "../std/list.hpp"
#include "../std/map.hpp"

class SharedBufferManager
{
public:
  typedef vector<unsigned char> shared_buffer_t;
  typedef shared_ptr<shared_buffer_t> shared_buffer_ptr_t;
  typedef list<shared_buffer_ptr_t> shared_buffer_ptr_list_t;
  typedef map<size_t, shared_buffer_ptr_list_t> shared_buffers_t;
private:

  threads::Mutex m_mutex;
  shared_buffers_t m_sharedBuffers;

public:
  static SharedBufferManager & instance();

  shared_buffer_ptr_t reserveSharedBuffer(size_t s);
  void freeSharedBuffer(size_t s, shared_buffer_ptr_t buf);
};