Files
comaps/indexer/types_mapping.hpp
Konstantin Pastbin e3e4a1985a Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run:
  git remote add om-historic [om-historic.git repo url]
  git fetch --tags om-historic
  git replace squashed-history historic-commits
2025-05-08 21:10:51 +07:00

36 lines
785 B
C++

#pragma once
#include "base/assert.hpp"
#include <cstdint>
#include <iostream>
#include <map>
#include <vector>
class IndexAndTypeMapping
{
public:
void Clear();
void Load(std::istream & s);
bool IsLoaded() const { return !m_types.empty(); }
static constexpr uint32_t INVALID_TYPE = 0;
/// @return INVALID_TYPE If \a ind is out of bounds.
uint32_t GetType(uint32_t ind) const
{
return ind < m_types.size() ? m_types[ind] : INVALID_TYPE;
}
uint32_t GetIndex(uint32_t t) const;
/// For Debug purposes only.
bool HasIndex(uint32_t t) const { return (m_map.find(t) != m_map.end()); }
private:
using Map = std::map<uint32_t, uint32_t>;
void Add(uint32_t ind, uint32_t type, bool isMainTypeDescription);
std::vector<uint32_t> m_types;
Map m_map;
};