Add some ECS API todo's

This commit is contained in:
Nikita Lisitsa 2023-08-26 22:12:25 +03:00
parent 85c0c56e03
commit e16ebb8822

View file

@ -19,6 +19,13 @@ namespace psemek::ecs
{
using query_cache = std::shared_ptr<detail::query_cache>;
using registration_token = std::shared_ptr<void>;
// TODO:
// - Modification callbacks API
// - Modification callbacks implementation
// - Index API
// - Index implementation
struct entity_container
{
@ -141,6 +148,36 @@ namespace psemek::ecs
template <typename ... Components, typename Function>
void batch_apply(Function && function, query_cache cache = {});
/** Register a constructor. Each time an entity is created that has
* the specified set of components (including attaching components),
* the constructor is called for this entity immediately after
* it is created.
* The constructor function must have the same signature as a function
* passed to the `apply<Components...>()` call.
* The returned value is an ownerwhip token. Destroying it removes
* the constructor from the entity_container.
* If any two of the passed component types are equal, the call fails with
* a compilation error.
*/
// TODO: implement
template <typename ... Components, typename Function>
registration_token constructor(Function && function);
/** Register a destructor. Each time an entity is destroyed that has
* the specified set of components (including detaching components),
* the destructor is called for this entity immediately before
* it will be destroyed.
* The destructor function must have the same signature as a function
* passed to the `apply<Components...>()` call.
* The returned value is an ownerwhip token. Destroying it removes
* the destructor from the entity_container.
* If any two of the passed component types are equal, the call fails with
* a compilation error.
*/
// TODO: implement
template <typename ... Components, typename Function>
registration_token destructor(Function && function);
private:
detail::entity_list entity_list_;
detail::table_container table_container_;