Skip to content

Commit

Permalink
feat: Accomodated overloads for other capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelwan committed May 31, 2024
1 parent decf71b commit 16fe54f
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 109 deletions.
36 changes: 21 additions & 15 deletions rt_entt_codegen/core/system_provider/association/association.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
#include "rt_entt_codegen/shared/util.hh"
#include "ecsact/runtime/meta.hh"
#include "ecsact/cpp_codegen_plugin_util.hh"
#include "rt_entt_codegen/core/system_provider/system_ctx_functions.hh"

using ecsact::rt_entt_codegen::provider::context_action_impl;
using ecsact::rt_entt_codegen::provider::context_add_impl;
using ecsact::rt_entt_codegen::provider::context_generate_impl;
using ecsact::rt_entt_codegen::provider::context_get_impl;
using ecsact::rt_entt_codegen::provider::context_has_impl;
using ecsact::rt_entt_codegen::provider::context_other_impl;
using ecsact::rt_entt_codegen::provider::context_parent_impl;
using ecsact::rt_entt_codegen::provider::context_remove_impl;
using ecsact::rt_entt_codegen::provider::context_update_impl;

using ecsact::rt_entt_codegen::core::provider::context_action_impl;
using ecsact::rt_entt_codegen::core::provider::context_add_impl;
using ecsact::rt_entt_codegen::core::provider::context_generate_impl;
using ecsact::rt_entt_codegen::core::provider::context_get_impl;
using ecsact::rt_entt_codegen::core::provider::context_has_impl;
using ecsact::rt_entt_codegen::core::provider::context_other_impl;
using ecsact::rt_entt_codegen::core::provider::context_parent_impl;
using ecsact::rt_entt_codegen::core::provider::context_remove_impl;
using ecsact::rt_entt_codegen::core::provider::context_update_impl;

using capability_t =
std::unordered_map<ecsact_component_like_id, ecsact_system_capability>;
Expand Down Expand Up @@ -210,8 +209,13 @@ auto ecsact::rt_entt_codegen::core::provider::association::print_other_contexts(
ctx.write(std::format("{}_t* view;\n", view_type_name));
ctx.write("\n");
print_other_ctx_action(ctx);
print_other_ctx_add(ctx, other_details);
print_other_ctx_remove(ctx, other_details, view_type_name);
print_other_ctx_add(ctx, assoc_detail.capabilities, other_details);
print_other_ctx_remove(
ctx,
assoc_detail.capabilities,
other_details,
view_type_name
);
print_other_ctx_get(ctx, other_details, view_type_name);
print_other_ctx_update(ctx, other_details, view_type_name);
print_other_ctx_has(ctx, other_details);
Expand Down Expand Up @@ -245,6 +249,7 @@ auto ecsact::rt_entt_codegen::core::provider::association::

auto ecsact::rt_entt_codegen::core::provider::association::print_other_ctx_add(
ecsact::codegen_plugin_context& ctx,
const capability_t& other_caps,
const ecsact::rt_entt_codegen::ecsact_entt_system_details& details
) -> void {
auto printer = //
Expand All @@ -253,12 +258,13 @@ auto ecsact::rt_entt_codegen::core::provider::association::print_other_ctx_add(
.parameter("const void*", "component_data")
.return_type("void final");

context_add_impl(ctx, sys_like_id_variant);
context_add_impl(ctx, other_caps);
}

auto ecsact::rt_entt_codegen::core::provider::association::
print_other_ctx_remove(
ecsact::codegen_plugin_context& ctx,
const capability_t& other_caps,
const ecsact::rt_entt_codegen::ecsact_entt_system_details& details,
const std::string& view_type_name
) -> void {
Expand All @@ -267,7 +273,7 @@ auto ecsact::rt_entt_codegen::core::provider::association::
.parameter("ecsact_component_like_id", "component_id")
.return_type("void final");

context_remove_impl(ctx, sys_like_id_variant, details, view_type_name);
context_remove_impl(ctx, other_caps, details, view_type_name);
}

auto ecsact::rt_entt_codegen::core::provider::association::print_other_ctx_get(
Expand Down
103 changes: 43 additions & 60 deletions rt_entt_codegen/core/system_provider/association/association.hh
Original file line number Diff line number Diff line change
Expand Up @@ -5,141 +5,123 @@

#include "rt_entt_codegen/core/system_provider/system_provider.hh"
#include "rt_entt_codegen/core/sys_exec/sys_exec.hh"
#include "rt_entt_codegen/core/system_provider/system_ctx_functions.hh"

namespace ecsact::rt_entt_codegen::core::provider {
class association : public system_provider {
public:
using system_provider::system_provider;

auto initialization(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> void {
}

auto before_make_view_or_group(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options,
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names,
std::vector<std::string>& additional_view_components
) -> void {
}

auto after_make_view_or_group(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> void final;

auto context_function_header(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> void final;

auto context_function_action(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> handle_exclusive_provide {
return NOT_HANDLED;
}

auto context_function_add(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> handle_exclusive_provide {
return NOT_HANDLED;
}

auto context_function_remove(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> handle_exclusive_provide {
return NOT_HANDLED;
}

auto context_function_get(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> handle_exclusive_provide {
return NOT_HANDLED;
}

auto context_function_update(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> handle_exclusive_provide {
return NOT_HANDLED;
}

auto context_function_has(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> handle_exclusive_provide {
return NOT_HANDLED;
}

auto context_function_generate(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> handle_exclusive_provide {
return NOT_HANDLED;
}

auto context_function_parent(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> handle_exclusive_provide {
return NOT_HANDLED;
}

auto context_function_other(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> handle_exclusive_provide final;

auto pre_entity_iteration(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> void final;

auto entity_iteration(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> void {
}

auto pre_exec_system_impl(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> void final;
auto system_impl(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> handle_exclusive_provide final;
auto post_exec_system_impl(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> void {};
auto post_iteration(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> void {};

private:
Expand All @@ -148,19 +130,20 @@ private:
std::map<ecsact_component_like_id, std::string> components_with_entity_fields;

auto print_other_contexts(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names&
options
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> void;

auto print_other_ctx_action(ecsact::codegen_plugin_context& ctx) -> void;
auto print_other_ctx_add(
ecsact::codegen_plugin_context& ctx,
const capability_t& other_caps,
const ecsact::rt_entt_codegen::ecsact_entt_system_details& details
) -> void;

auto print_other_ctx_remove(
ecsact::codegen_plugin_context& ctx,
const capability_t& other_caps,
const ecsact::rt_entt_codegen::ecsact_entt_system_details& details,
const std::string& view_type_name
) -> void;
Expand Down
27 changes: 16 additions & 11 deletions rt_entt_codegen/core/system_provider/basic/basic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#include "ecsact/cpp_codegen_plugin_util.hh"
#include "rt_entt_codegen/core/system_provider/system_ctx_functions.hh"

using ecsact::rt_entt_codegen::provider::context_action_impl;
using ecsact::rt_entt_codegen::provider::context_add_impl;
using ecsact::rt_entt_codegen::provider::context_generate_impl;
using ecsact::rt_entt_codegen::provider::context_get_impl;
using ecsact::rt_entt_codegen::provider::context_has_impl;
using ecsact::rt_entt_codegen::provider::context_parent_impl;
using ecsact::rt_entt_codegen::provider::context_remove_impl;
using ecsact::rt_entt_codegen::provider::context_update_impl;
using ecsact::rt_entt_codegen::core::provider::context_action_impl;
using ecsact::rt_entt_codegen::core::provider::context_add_impl;
using ecsact::rt_entt_codegen::core::provider::context_generate_impl;
using ecsact::rt_entt_codegen::core::provider::context_get_impl;
using ecsact::rt_entt_codegen::core::provider::context_has_impl;
using ecsact::rt_entt_codegen::core::provider::context_parent_impl;
using ecsact::rt_entt_codegen::core::provider::context_remove_impl;
using ecsact::rt_entt_codegen::core::provider::context_update_impl;

auto ecsact::rt_entt_codegen::core::provider::basic::initialization(
ecsact::codegen_plugin_context& ctx,
Expand Down Expand Up @@ -46,16 +46,21 @@ auto ecsact::rt_entt_codegen::core::provider::basic::context_function_add(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> handle_exclusive_provide {
auto adds_comps = std::vector<ecsact_component_like_id>{};
context_add_impl(ctx, sys_like_id_variant);
auto sys_caps =
ecsact::meta::system_capabilities(sys_like_id_variant.get_sys_like_id());

context_add_impl(ctx, sys_caps);
return HANDLED;
}

auto ecsact::rt_entt_codegen::core::provider::basic::context_function_remove(
ecsact::codegen_plugin_context& ctx,
const ecsact::rt_entt_codegen::core::print_execute_systems_var_names& names
) -> handle_exclusive_provide {
context_remove_impl(ctx, sys_like_id_variant, system_details, view_type_name);
auto sys_caps =
ecsact::meta::system_capabilities(sys_like_id_variant.get_sys_like_id());

context_remove_impl(ctx, sys_caps, system_details, view_type_name);
return HANDLED;
}

Expand Down
Loading

0 comments on commit 16fe54f

Please sign in to comment.