blob: 85e2b7145a8087a0476f8e03a6aa3205cf970679 (
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
|
#pragma once
#include "drape_frontend/tile_info.hpp"
#include "drape/pointers.hpp"
#include "drape/object_pool.hpp"
#include "drape/batcher.hpp"
#include "std/map.hpp"
#include "std/stack.hpp"
#include "std/function.hpp"
namespace df
{
class Message;
// Not thread safe
class BatchersPool
{
public:
typedef function<void (drape_ptr<Message> &&)> TSendMessageFn;
BatchersPool(int initBatcherCount, TSendMessageFn const & sendMessageFn);
~BatchersPool();
void ReserveBatcher(TileKey const & key);
ref_ptr<dp::Batcher> GetTileBatcher(TileKey const & key);
void ReleaseBatcher(TileKey const & key);
private:
typedef pair<dp::Batcher *, int> TBatcherPair;
typedef map<TileKey, TBatcherPair, TileKeyStrictComparator> TBatcherMap;
typedef TBatcherMap::iterator TIterator;
TSendMessageFn m_sendMessageFn;
ObjectPool<dp::Batcher, dp::BatcherFactory> m_pool;
TBatcherMap m_batchs;
};
} // namespace df
|