8#ifndef _ENTITYMANAGER_H
9#define _ENTITYMANAGER_H
12#include <unordered_set>
50 std::vector<int>
getEntities(
const std::string& prefixOrTag,
bool isPrefix =
true);
69 int createEntity(
const std::string& name,
bool createFile =
false);
90 bool hasTag(
int entity,
const std::string& tag);
97 void addTag(
int entity,
const std::string& tag);
103 std::map<std::string, int> entities;
109 std::vector<std::string> names;
115 std::queue<int> availableIDs;
126 std::string directory;
132 std::string placeholder;
137 std::unordered_map<std::string, std::unordered_set<int>> tags;
void addTag(int entity, const std::string &tag)
Add a tag to an entity.
const std::string & getName(int entity)
Return the name of an entity based on its ID.
void removeEntity(const std::string &name)
Remove an entity from the EntityManager.
EntityManager()
Default constructor of the EntityManager.
int getEntity(const std::string &name)
Return the ID of an Entity based on its name.
bool hasTag(int entity, const std::string &tag)
Return true if the entity have the given tag, false otherwise.
std::vector< int > getEntities(const std::string &prefixOrTag, bool isPrefix=true)
Return every entities with a name which start by the given prefix or all the entities of a tag.
void toString(std::ostream &stream)
Append a serialized version of the EntityManager to the given stream.
EntityManager(const std::string &directory)
Constructor of the EntityManager, take the root directory with the entities as a parameter.
std::vector< std::string > getNames()
Return a vector with the names of all the entities.
int createEntity(const std::string &name, bool createFile=false)
Create a new entity and return its ID.