File: way_stores.h

package info (click to toggle)
tilemaker 3.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 83,488 kB
  • sloc: cpp: 29,461; ansic: 12,510; makefile: 229; ruby: 77; sh: 43
file content (35 lines) | stat: -rw-r--r-- 1,075 bytes parent folder | download | duplicates (2)
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
#ifndef _WAY_STORES_H
#define _WAY_STORES_H

#include <memory>
#include <mutex>
#include "way_store.h"
#include "sorted_way_store.h"
#include "sharded_way_store.h"

class BinarySearchWayStore: public WayStore {

public:
	using map_t = std::deque<WayStore::ll_element_t, mmap_allocator<WayStore::ll_element_t>>;

	void reopen() override;
	void batchStart() override {}
	std::vector<LatpLon> at(WayID wayid) const override;
	bool requiresNodes() const override { return false; }
	void insertLatpLons(std::vector<WayStore::ll_element_t> &newWays) override;
	void insertNodes(const std::vector<std::pair<WayID, std::vector<NodeID>>>& newWays) override;
	void clear() override;
	std::size_t size() const override;
	void finalize(unsigned int threadNum) override;

	bool contains(size_t shard, WayID id) const override;
	WayStore& shard(size_t shard) override { return *this; }
	const WayStore& shard(size_t shard) const override { return *this; }
	size_t shards() const override { return 1; }

private:
	mutable std::mutex mutex;
	std::unique_ptr<map_t> mLatpLonLists;
};

#endif