EntityManager

Convenience type for centralized storage and management of entity components.

Members

Functions

get
C* get(EntityId eid)

Returns pointer to the component of type C. Returns null if entity has no such component. Works only with non-flag components.

getComponentStorage
auto getComponentStorage()

Returns pointer to the storage of components C. Storage type depends on component type (flag or not).

getOrCreate
C* getOrCreate(EntityId eid, C defVal)

Returns pointer to the component of type C. Creates component first if entity had no such component. Works only with non-flag components.

has
bool has(EntityId eid)

Used to check for presence of given component or flag.

load
void load(Loader loader, bool removeBeforeRead)

Deserializes all component storages from given loader.

query
auto query()

Returns query object for given set of component types for iteration with foreach.

registerComponent
void registerComponent()

Before using component type in every other method, register it here. name is used for (de)serialization.

remove
void remove(EntityId eid)

Removes one component for given eid.

remove
void remove(EntityId eid)

Removes all components for given eid.

removeAll
void removeAll()

Removes all components of all types.

removeSerializedComponents
void removeSerializedComponents(IoStorageType storageType)
Undocumented in source. Be warned that the author may not have intended to support it.
save
void save(Saver saver)

Serializes all component storages with given saver.

savePartial
void savePartial(Saver saver, E entities)
Undocumented in source. Be warned that the author may not have intended to support it.
set
void set(EntityId eid, Components components)

Add or set list of components for entity eid.

Variables

eidMan
EntityIdManager* eidMan;
Undocumented in source.

Meta