Skip to content

Commit c2f877e

Browse files
Remove unused MapStorage and GenerationArrayStorage (#6990)
1 parent 825132e commit c2f877e

File tree

2 files changed

+2
-68
lines changed

2 files changed

+2
-68
lines changed

include/util/query_heap.hpp

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,6 @@
1515
namespace osrm::util
1616
{
1717

18-
template <typename NodeID, typename Key> class GenerationArrayStorage
19-
{
20-
using GenerationCounter = std::uint16_t;
21-
22-
public:
23-
explicit GenerationArrayStorage(std::size_t size)
24-
: positions(size, 0), generation(1), generations(size, 0)
25-
{
26-
}
27-
28-
Key &operator[](NodeID node)
29-
{
30-
generation[node] = generation;
31-
return positions[node];
32-
}
33-
34-
Key peek_index(const NodeID node) const
35-
{
36-
if (generations[node] < generation)
37-
{
38-
return std::numeric_limits<Key>::max();
39-
}
40-
return positions[node];
41-
}
42-
43-
void Clear()
44-
{
45-
generation++;
46-
// if generation overflows we end up at 0 again and need to clear the vector
47-
if (generation == 0)
48-
{
49-
generation = 1;
50-
std::fill(generations.begin(), generations.end(), 0);
51-
}
52-
}
53-
54-
private:
55-
GenerationCounter generation;
56-
std::vector<GenerationCounter> generations;
57-
std::vector<Key> positions;
58-
};
59-
6018
template <typename NodeID, typename Key> class ArrayStorage
6119
{
6220
public:
@@ -72,29 +30,6 @@ template <typename NodeID, typename Key> class ArrayStorage
7230
std::vector<Key> positions;
7331
};
7432

75-
template <typename NodeID, typename Key> class MapStorage
76-
{
77-
public:
78-
explicit MapStorage(std::size_t) {}
79-
80-
Key &operator[](NodeID node) { return nodes[node]; }
81-
82-
void Clear() { nodes.clear(); }
83-
84-
Key peek_index(const NodeID node) const
85-
{
86-
const auto iter = nodes.find(node);
87-
if (nodes.end() != iter)
88-
{
89-
return iter->second;
90-
}
91-
return std::numeric_limits<Key>::max();
92-
}
93-
94-
private:
95-
std::map<NodeID, Key> nodes;
96-
};
97-
9833
template <typename NodeID, typename Key> class UnorderedMapStorage
9934
{
10035
public:

unit_tests/util/query_heap.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ struct TestData
2222
using TestNodeID = NodeID;
2323
using TestKey = int;
2424
using TestWeight = int;
25-
using storage_types = boost::mpl::list<ArrayStorage<TestNodeID, TestKey>,
26-
MapStorage<TestNodeID, TestKey>,
27-
UnorderedMapStorage<TestNodeID, TestKey>>;
25+
using storage_types =
26+
boost::mpl::list<ArrayStorage<TestNodeID, TestKey>, UnorderedMapStorage<TestNodeID, TestKey>>;
2827

2928
template <unsigned NUM_ELEM> struct RandomDataFixture
3029
{

0 commit comments

Comments
 (0)