Remove modification callbacks API from ecs::container - ain't gonna implement them anyway

This commit is contained in:
Nikita Lisitsa 2025-08-10 14:45:17 +03:00
parent b1255f7a14
commit b83a3635fc

View file

@ -22,11 +22,8 @@ namespace psemek::ecs
// TODO:
// - Fully document which functions can be called from which callbacks
// - Modification callbacks implementation (const-only)
// - Tables serialization
// - Refactor query caches
// - Index API
// - Index implementation
struct container
{
@ -296,12 +293,7 @@ namespace psemek::ecs
* The constructor function must have the same signature as a function
* passed to the `apply<Components...>()` call.
*
* The constuctor is not considered to be a modification of the entity, i.e. it
* doesn't trigger modification callbacks.
*
* @param function A function to be applied to created entity's components
* @return An ownerwhip token; destroying this token removes
* the constructor from this container
* @warning If any two of the passed component types are equal, the call fails with
* a compilation error
* @warning If the constructor modifies the entity's archetype (i.e. attaches or
@ -335,11 +327,7 @@ namespace psemek::ecs
*
* Note that there is no way to cancel the entity's destruction.
*
* The destructor is not considered to be a modification of the entity, i.e. it
* doesn't trigger modification callbacks.
*
* @param function A function to be applied to a to-be destroyed entity's components
* @return An ownerwhip token; destroying it removes the destructor from the container
* @warning If any two of the passed component types are equal, the call fails with
* a compilation error
* @warning If the destructor modifies the entity's archetype (i.e. attaches or
@ -349,42 +337,6 @@ namespace psemek::ecs
template <typename ... Components, typename Function>
void destructor(Function && function);
/** Register a component modification callback. Each time an entity that has
* the specified set of components is modified, and the modification affects
* one of this callback's component types, the callback is called.
*
* The component types can be const-qualified, in which case the corresponding function must
* also accept the corresponding components by a const reference.
*
* The component types can be equal to ecs::without<Component>, indicating that entities having
* this component type will not be watched by this callback. These component types are not
* included in the called function signature.
*
* If the modification occurred via an accessor, the callback is called
* after the accessor is destroyed, allowing for transaction-like modification.
*
* If the modification occurred via an `apply()` or `batch_apply()` call,
* the callback is called immediately after this call.
*
* Note that modifications from within a modification callback are not considered
* as modifications, i.e. they don't recursively invoke modification callbacks.
*
* The callback function must have the same signature as a function
* passed to the `apply<Components...>()` call.
*
* @param function A function to be applied to modified entity's components
* @return An ownerwhip token; destroying it removes the modification callback from the container
* @warning If any two of the passed component types are equal, the call fails with
* a compilation error
* @warning If the modification callback modifies the entity's archetype (i.e. attaches or
* detaches components), the behavior is undefined
*
* TODO: can we allow the callback to modify the archetype?
*/
// TODO: implement
template <typename ... Components, typename Function>
void watch(Function && function);
/** Call a callback after exiting all currently executing ECS container methods.
*
* If no ECS container method is currently executed, call the callback immediately instead.