blob: 00a9c98b08a88fd06b57290c1bc37b5bd58a8b41 (
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 (dp::TransferPointer<Message>)> TSendMessageFn;
BatchersPool(int initBatcherCount, TSendMessageFn const & sendMessageFn);
~BatchersPool();
void ReserveBatcher(TileKey const & key);
dp::RefPointer<dp::Batcher> GetTileBatcher(TileKey const & key);
void ReleaseBatcher(TileKey const & key);
private:
typedef pair<dp::Batcher *, int> TBatcherPair;
typedef map<TileKey, TBatcherPair> TBatcherMap;
typedef TBatcherMap::iterator TIterator;
TSendMessageFn m_sendMessageFn;
ObjectPool<dp::Batcher, dp::BatcherFactory> m_pool;
TBatcherMap m_batchs;
};
} // namespace df
|