7 Entity argIds[MAX_ITEMS_IN_QUERY]{};
8 bool writeFlags[MAX_ITEMS_IN_QUERY]{};
9 uint32_t firstWriteArg = MAX_ITEMS_IN_QUERY;
10 bool hasWriteArgs =
false;
11 bool needsInheritedArgIds =
false;
12 bool canUseDirectChunkEval =
false;
13 bool hasInheritedTerms =
false;
19 bool isEntity =
false;
25 using Arg = std::remove_cv_t<std::remove_reference_t<T>>;
27 std::is_lvalue_reference_v<T> && !std::is_const_v<std::remove_reference_t<T>> && !std::is_same_v<Arg, Entity>;
28 if constexpr (std::is_same_v<Arg, Entity>)
31 using FT =
typename component_type_t<Arg>::TypeFull;
32 if constexpr (is_pair<FT>::value)
33 return TypedQueryArgMeta{EntityBad, isWrite,
false,
true};
35 return TypedQueryArgMeta{world_query_arg_id<Arg>(world), isWrite,
false,
false};
39 template <
typename... T>
41 init_typed_query_arg_metas(TypedQueryArgMeta* pMetas, World& world, [[maybe_unused]] core::func_type_list<T...>) {
42 if constexpr (
sizeof...(T) > 0) {
43 const TypedQueryArgMeta descs[] = {typed_query_arg_meta<T>(world)...};
44 GAIA_FOR(
sizeof...(T)) {
48 return (uint32_t)
sizeof...(T);
51#if GAIA_ASSERT_ENABLED
52 template <
typename... T>
53 GAIA_NODISCARD
inline bool
54 typed_query_args_match_query(
const QueryInfo& queryInfo, [[maybe_unused]] core::func_type_list<T...>) {
55 if constexpr (
sizeof...(T) > 0)
56 return queryInfo.template has_all<T...>();
62 template <
typename... T,
typename Func,
size_t... I>
63 inline void invoke_typed_query_args_by_id(
64 World& world, Entity entity,
const Entity* pArgIds, Func& func, std::index_sequence<I...>) {
65 func(([&]() ->
decltype(
auto) {
66 using Arg = std::remove_cv_t<std::remove_reference_t<T>>;
67 if constexpr (std::is_same_v<Arg, Entity>)
69 else if constexpr (std::is_lvalue_reference_v<T> && !std::is_const_v<std::remove_reference_t<T>>)
70 return world_query_entity_arg_by_id_raw<T>(world, entity, pArgIds[I]);
72 return world_query_entity_arg_by_id<T>(world, entity, pArgIds[I]);
76 template <
typename Func,
typename... T>
77 inline void invoke_typed_query_args_by_id_erased(World& world, Entity entity,
const Entity* pArgIds,
void* pFunc) {
78 auto& func = *
static_cast<Func*
>(pFunc);
79 invoke_typed_query_args_by_id<T...>(world, entity, pArgIds, func, std::index_sequence_for<T...>{});
82 template <
typename Func,
typename... T>
83 GAIA_NODISCARD
inline auto typed_invoke_inherited_ptr(core::func_type_list<T...>) {
84 return &invoke_typed_query_args_by_id_erased<Func, T...>;
87 inline void finish_typed_query_args_by_id(
88 World& world, Entity entity,
const Entity* pArgIds,
const bool* pWriteFlags, uint32_t argCnt) {
91 const auto finish_term = [&](Entity term) {
93 if (seenTerms[i] == term)
97 seenTerms[seenCnt++] = term;
98 world_finish_write(world, term, entity);
103 finish_term(pArgIds[i]);
Checks if endianess was detected correctly at compile-time.
Definition bitset.h:9
Definition query_adapter_typed.inl:5