Remove unused MapStorage and GenerationArrayStorage (#6990)

This commit is contained in:
Siarhei Fedartsou 2024-07-11 23:10:14 +02:00 committed by GitHub
parent 825132eec7
commit c2f877eb9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 68 deletions

View File

@ -15,48 +15,6 @@
namespace osrm::util namespace osrm::util
{ {
template <typename NodeID, typename Key> class GenerationArrayStorage
{
using GenerationCounter = std::uint16_t;
public:
explicit GenerationArrayStorage(std::size_t size)
: positions(size, 0), generation(1), generations(size, 0)
{
}
Key &operator[](NodeID node)
{
generation[node] = generation;
return positions[node];
}
Key peek_index(const NodeID node) const
{
if (generations[node] < generation)
{
return std::numeric_limits<Key>::max();
}
return positions[node];
}
void Clear()
{
generation++;
// if generation overflows we end up at 0 again and need to clear the vector
if (generation == 0)
{
generation = 1;
std::fill(generations.begin(), generations.end(), 0);
}
}
private:
GenerationCounter generation;
std::vector<GenerationCounter> generations;
std::vector<Key> positions;
};
template <typename NodeID, typename Key> class ArrayStorage template <typename NodeID, typename Key> class ArrayStorage
{ {
public: public:
@ -72,29 +30,6 @@ template <typename NodeID, typename Key> class ArrayStorage
std::vector<Key> positions; std::vector<Key> positions;
}; };
template <typename NodeID, typename Key> class MapStorage
{
public:
explicit MapStorage(std::size_t) {}
Key &operator[](NodeID node) { return nodes[node]; }
void Clear() { nodes.clear(); }
Key peek_index(const NodeID node) const
{
const auto iter = nodes.find(node);
if (nodes.end() != iter)
{
return iter->second;
}
return std::numeric_limits<Key>::max();
}
private:
std::map<NodeID, Key> nodes;
};
template <typename NodeID, typename Key> class UnorderedMapStorage template <typename NodeID, typename Key> class UnorderedMapStorage
{ {
public: public:

View File

@ -22,9 +22,8 @@ struct TestData
using TestNodeID = NodeID; using TestNodeID = NodeID;
using TestKey = int; using TestKey = int;
using TestWeight = int; using TestWeight = int;
using storage_types = boost::mpl::list<ArrayStorage<TestNodeID, TestKey>, using storage_types =
MapStorage<TestNodeID, TestKey>, boost::mpl::list<ArrayStorage<TestNodeID, TestKey>, UnorderedMapStorage<TestNodeID, TestKey>>;
UnorderedMapStorage<TestNodeID, TestKey>>;
template <unsigned NUM_ELEM> struct RandomDataFixture template <unsigned NUM_ELEM> struct RandomDataFixture
{ {