2014-11-28 04:29:56 -05:00
|
|
|
#ifndef GEOMETRY_COMPRESSOR_HPP_
|
|
|
|
#define GEOMETRY_COMPRESSOR_HPP_
|
2014-10-03 04:19:45 -04:00
|
|
|
|
2016-01-02 11:13:44 -05:00
|
|
|
#include "util/typedefs.hpp"
|
2013-11-25 13:05:58 -05:00
|
|
|
|
2014-05-09 12:40:07 -04:00
|
|
|
#include <unordered_map>
|
2013-11-25 13:05:58 -05:00
|
|
|
|
2014-05-09 13:50:16 -04:00
|
|
|
#include <string>
|
2013-11-25 13:05:58 -05:00
|
|
|
#include <vector>
|
|
|
|
|
2016-01-05 10:51:13 -05:00
|
|
|
namespace osrm
|
|
|
|
{
|
|
|
|
namespace extractor
|
|
|
|
{
|
|
|
|
|
2015-06-24 13:55:36 -04:00
|
|
|
class CompressedEdgeContainer
|
2014-04-11 16:25:25 -04:00
|
|
|
{
|
|
|
|
public:
|
2014-08-19 07:01:38 -04:00
|
|
|
using CompressedNode = std::pair<NodeID, EdgeWeight>;
|
2015-06-24 13:55:36 -04:00
|
|
|
using EdgeBucket = std::vector<CompressedNode>;
|
2014-02-11 05:42:24 -05:00
|
|
|
|
2015-06-24 13:55:36 -04:00
|
|
|
CompressedEdgeContainer();
|
2014-04-11 16:25:25 -04:00
|
|
|
void CompressEdge(const EdgeID surviving_edge_id,
|
|
|
|
const EdgeID removed_edge_id,
|
|
|
|
const NodeID via_node_id,
|
|
|
|
const NodeID target_node,
|
|
|
|
const EdgeWeight weight1,
|
|
|
|
const EdgeWeight weight2);
|
2014-02-11 05:42:24 -05:00
|
|
|
|
|
|
|
bool HasEntryForID(const EdgeID edge_id) const;
|
2013-11-25 13:05:58 -05:00
|
|
|
void PrintStatistics() const;
|
2014-04-11 16:25:25 -04:00
|
|
|
void SerializeInternalVector(const std::string &path) const;
|
2014-02-11 05:42:24 -05:00
|
|
|
unsigned GetPositionForID(const EdgeID edge_id) const;
|
2016-01-05 06:04:04 -05:00
|
|
|
const EdgeBucket &GetBucketReference(const EdgeID edge_id) const;
|
2015-06-24 13:55:36 -04:00
|
|
|
NodeID GetFirstEdgeTargetID(const EdgeID edge_id) const;
|
|
|
|
NodeID GetLastEdgeSourceID(const EdgeID edge_id) const;
|
2013-11-25 13:05:58 -05:00
|
|
|
|
2014-04-11 16:25:25 -04:00
|
|
|
private:
|
2015-03-05 05:30:52 -05:00
|
|
|
int free_list_maximum = 0;
|
2015-06-24 13:55:36 -04:00
|
|
|
|
2013-11-25 13:05:58 -05:00
|
|
|
void IncreaseFreeList();
|
2015-06-24 13:55:36 -04:00
|
|
|
std::vector<EdgeBucket> m_compressed_geometries;
|
2013-11-25 13:05:58 -05:00
|
|
|
std::vector<unsigned> m_free_list;
|
2014-05-09 12:40:07 -04:00
|
|
|
std::unordered_map<EdgeID, unsigned> m_edge_id_to_list_index_map;
|
2013-11-25 13:05:58 -05:00
|
|
|
};
|
2016-01-05 10:51:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-28 04:29:56 -05:00
|
|
|
#endif // GEOMETRY_COMPRESSOR_HPP_
|