#pragma once #include #include #include #include #include #include #include #include namespace mbgl { using StringIdentity = std::size_t; class StringIndexer { protected: StringIndexer(); public: StringIndexer(StringIndexer const&) = delete; StringIndexer(StringIndexer&&) = delete; void operator=(StringIndexer const&) = delete; ~StringIndexer() = default; StringIdentity get(std::string_view); std::string get(const StringIdentity id); size_t size(); protected: friend StringIndexer& stringIndexer(); std::unordered_map stringToIdentity; std::vector identityToString; std::vector buffer; std::shared_mutex sharedMutex; }; /// StringIndexer singleton StringIndexer& stringIndexer(); } // namespace mbgl