psemek/libs/ecs/source/detail/query_cache.cpp
2023-12-18 12:45:42 +03:00

22 lines
528 B
C++

#include <psemek/ecs/detail/query_cache.hpp>
#include <psemek/ecs/detail/table.hpp>
namespace psemek::ecs::detail
{
void query_cache::add(table * table)
{
auto & entry = entries.emplace_back();
entry.table = table;
for (auto const & uuid : with_uuids)
entry.columns_indices.push_back(*table->column_index(uuid));
if (constructor_factory)
table->add_constructor(constructor_factory(entry.columns_indices));
if (destructor_factory)
table->add_destructor(destructor_factory(entry.columns_indices));
}
}