41 lines
821 B
C++
41 lines
821 B
C++
#pragma once
|
|
|
|
#include <frostbite2D/types/type_alias.h>
|
|
#include <cstddef>
|
|
#include <memory>
|
|
#include <map>
|
|
#include <string>
|
|
|
|
namespace frostbite2D {
|
|
|
|
class Actor;
|
|
class UUID;
|
|
|
|
class ObjectRegistry {
|
|
public:
|
|
static ObjectRegistry& get();
|
|
|
|
ObjectRegistry(const ObjectRegistry&) = delete;
|
|
ObjectRegistry& operator=(const ObjectRegistry&) = delete;
|
|
|
|
void registerObject(const UUID& uuid, Actor* actor);
|
|
void unregisterObject(const UUID& uuid);
|
|
|
|
Actor* getObject(const UUID& uuid);
|
|
Actor* getObject(const std::string& uuidStr);
|
|
|
|
bool hasObject(const UUID& uuid) const;
|
|
bool hasObject(const std::string& uuidStr) const;
|
|
size_t count() const;
|
|
|
|
void clear();
|
|
|
|
private:
|
|
ObjectRegistry() = default;
|
|
~ObjectRegistry() = default;
|
|
|
|
std::map<std::string, Actor*> registry_;
|
|
};
|
|
|
|
} // namespace frostbite2D
|