#ifndef CREATURELIB_SPECIESLIBRARY_HPP #define CREATURELIB_SPECIESLIBRARY_HPP #include #include #include "CreatureData/CreatureSpecies.hpp" namespace CreatureLib::Library { class SpeciesLibrary { private: std::unordered_map _species; public: SpeciesLibrary(size_t initialCapacity = 32) : _species(std::unordered_map(initialCapacity)){}; virtual ~SpeciesLibrary() { for (auto s : _species) delete s.second; _species.clear(); } [[nodiscard]] bool TryGetSpecies(const std::string& name, const CreatureSpecies*& outSpecies) const; [[nodiscard]] const CreatureSpecies* GetSpecies(const std::string& name) const; [[nodiscard]] const CreatureSpecies* operator[](const std::string& name) const; void LoadSpecies(const std::string& name, const CreatureSpecies* species); void DeleteSpecies(const std::string& name); size_t GetCount() const { return _species.size(); } const std::unordered_map& GetIterator() { return _species; } }; } #endif // CREATURELIB_SPECIESLIBRARY_HPP