8#ifndef _COMPONENTMANAGER_H
9#define _COMPONENTMANAGER_H
49 const std::string&
getType(
const std::string& data);
90 bool hasEntity(
int entity,
bool bypassState =
false);
111 void give(
int giver,
int receiver,
bool copy);
123 std::unordered_map<int, std::pair<std::shared_ptr<Component>,
bool>> mapEC;
128 std::shared_ptr<Component> referenceComp;
void unsubscribe(int entity)
Remove the link between an entity and its component.
void toString(std::ostream &stream)
Add to the given buffer, the serialized version of this ComponentManager, which will consist of the l...
void subscribe(int entity)
Subscribe an entity to this component.
const std::string & getType(const std::string &data)
Return a string which give the type of the data.
void subscribe(int entity, dataVector data)
Subscribe an entity to this component with specific values.
void give(int giver, int receiver, bool copy)
Give the ownership, or make a copy, of an entity's component to another component.
const std::string & getName()
Return the name of the component managed by this instance.
bool hasEntity(int entity, bool bypassState=false)
Return true if the given entity possess this component, false otherwise.
bool getState(int entity)
Return the actual state of the given entity's component, true or false.
ComponentManager(std::shared_ptr< Component > component)
Create a ComponentManager with a reference component.
ComponentManager(const std::string &filename)
The main constructor of the ComponentManager, created the components based of the file's description.
std::vector< int > getEntities(bool checkState)
Return the list of entities linked in this component's manager.
std::shared_ptr< Component > getComponent(int entity)
Return the component of a specific entity.
void setState(int entity, bool newState)
Set the state of the given entity's component.