Function get_ptrs

Synopsis

#include <include/flecs/addons/cpp/invoker.hpp>

static bool get_ptrs(world_t *world, const ecs_record_t *r, ecs_table_t *table, ArrayType &ptrs)

Description

No description yet.

Source

Lines 447-477 in include/flecs/addons/cpp/invoker.hpp.

static bool get_ptrs(world_t *world, const ecs_record_t *r, ecs_table_t *table,
    ArrayType& ptrs) 
{
    ecs_assert(table != NULL, ECS_INTERNAL_ERROR, NULL);
    ecs_table_t *storage_table = ecs_table_get_storage_table(table);
    if (!storage_table) {
        return false;
    }
    /* table_index_of needs real world */
    const flecs::world_t *real_world = ecs_get_world(world);
    /* Get column indices for components */
    ColumnArray columns ({
        ecs_search_offset(real_world, storage_table, 0, 
            _::cpp_type<Args>().id(world), 0)...
    });
    /* Get pointers for columns for entity */
    size_t i = 0;
    for (int32_t column : columns) {
        if (column == -1) {
            return false;
        }
        ptrs[i ++] = ecs_record_get_column(r, column, 0);
    }
    return true;
}