Struct EcsComponentLifecycle

Synopsis

#include <include/flecs.h>

struct EcsComponentLifecycle

Description

Component that contains lifecycle callbacks for a component.

Source

Lines 607-637 in include/flecs.h.

struct EcsComponentLifecycle {
    ecs_xtor_t ctor;            /* ctor */
    ecs_xtor_t dtor;            /* dtor */
    ecs_copy_t copy;            /* copy assignment */
    ecs_move_t move;            /* move assignment */

    void *ctx;                  /* User defined context */

    /* Ctor + copy */
    ecs_copy_ctor_t copy_ctor;

    /* Ctor + move */  
    ecs_move_ctor_t move_ctor;

    /* Ctor + move + dtor (or move_ctor + dtor).
     * This combination is typically used when a component is moved from one
     * location to a new location, like when it is moved to a new table. If
     * not set explicitly it will be derived from other callbacks. */
    ecs_move_ctor_t ctor_move_dtor;

    /* Move + dtor.
     * This combination is typically used when a component is moved from one
     * location to an existing location, like what happens during a remove. If
     * not set explicitly it will be derived from other callbacks. */
    ecs_move_ctor_t move_dtor;

    /* Callback that is invoked when an instance of the component is set. This
     * callback is invoked before triggers are invoked, and enable the component
     * to respond to changes on itself before others can. */
    ecs_on_set_t on_set;
};