#ifndef OSRM_UTIL_NAME_TABLE_HPP #define OSRM_UTIL_NAME_TABLE_HPP #include "util/indexed_data.hpp" #include "util/string_view.hpp" #include "util/typedefs.hpp" #include namespace osrm { namespace util { // While this could, theoretically, hold any names in the fitting format, // the NameTable allows access to a part of the Datafacade to allow // processing based on name indices. class NameTable { public: using IndexedData = util::IndexedData>; using ResultType = IndexedData::ResultType; using ValueType = IndexedData::ValueType; NameTable() {} // Read filename and store own data in m_buffer NameTable(const std::string &filename); // Keep pointers only in m_name_table and don't own data in m_buffer void reset(ValueType *begin, ValueType *end); // This class provides a limited view over all the string data we serialize out. // The following functions are a subset of what is available. // See the data facades for they provide full access to this serialized string data. util::StringView GetNameForID(const NameID id) const; util::StringView GetDestinationsForID(const NameID id) const; util::StringView GetExitsForID(const NameID id) const; util::StringView GetRefForID(const NameID id) const; util::StringView GetPronunciationForID(const NameID id) const; private: using BufferType = std::unique_ptr>; BufferType m_buffer; IndexedData m_name_table; }; } // namespace util } // namespace osrm #endif // OSRM_UTIL_NAME_TABLE_HPP