File tree Expand file tree Collapse file tree 6 files changed +85
-2
lines changed Expand file tree Collapse file tree 6 files changed +85
-2
lines changed Original file line number Diff line number Diff line change @@ -436,6 +436,23 @@ static void write_fields_info_constexpr(
436
436
ctx.write (" \n }\n " );
437
437
}
438
438
439
+ static inline auto write_lazy_system_iteration_rate ( //
440
+ ecsact::codegen_plugin_context& ctx,
441
+ ecsact_system_id id
442
+ ) -> void {
443
+ using ecsact::cc_lang_support::cpp_identifier;
444
+
445
+ auto lazy_iteration_rate = ecsact_meta_get_lazy_iteration_rate (id);
446
+
447
+ ctx.write (
448
+ " template<> struct ecsact::system_lazy_execution_iteration_rate<" ,
449
+ cpp_identifier (get_sys_full_name (ctx.package_id , id)),
450
+ " > : std::integral_constant<int32_t, " ,
451
+ lazy_iteration_rate,
452
+ " > {};"
453
+ );
454
+ }
455
+
439
456
void ecsact_codegen_plugin (
440
457
ecsact_package_id package_id,
441
458
ecsact_codegen_write_fn_t write_fn
@@ -594,4 +611,8 @@ void ecsact_codegen_plugin(
594
611
for (auto & act_id : ecsact::meta::get_action_ids (ctx.package_id )) {
595
612
write_system_capabilities_info_struct (ctx, act_id);
596
613
}
614
+
615
+ for (auto & sys_id : ecsact::meta::get_system_ids (ctx.package_id )) {
616
+ write_lazy_system_iteration_rate (ctx, sys_id);
617
+ }
597
618
}
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ template<typename SystemT>
31
31
struct system_lazy_execution_iteration_rate ;
32
32
33
33
template <typename SystemT>
34
- using system_lazy_execution_iteration_rate_v =
35
- typename system_lazy_execution_iteration_rate<SystemT>::value;
34
+ constexpr auto system_lazy_execution_iteration_rate_v =
35
+ system_lazy_execution_iteration_rate<SystemT>::value;
36
36
37
37
template <typename SystemLikeT>
38
38
struct system_capabilities_info {
Original file line number Diff line number Diff line change @@ -80,6 +80,17 @@ cc_library(
80
80
],
81
81
)
82
82
83
+ cc_library (
84
+ name = "meta_check" ,
85
+ copts = copts ,
86
+ srcs = ["meta_check.cc" ],
87
+ deps = [
88
+ "//:ecsact_cc" ,
89
+ "@ecsact_lang_cpp//:type_info" ,
90
+ "@ecsact_runtime//:lib" ,
91
+ ],
92
+ )
93
+
83
94
cc_binary (
84
95
name = "example_system_impls" ,
85
96
copts = copts ,
Original file line number Diff line number Diff line change @@ -8,3 +8,19 @@ system ExampleSystemFromImports {
8
8
readwrite pkg.b.ExampleB;
9
9
}
10
10
11
+ system ExampleLazy(lazy) {
12
+ readwrite pkg.a.ExampleA;
13
+ }
14
+
15
+ system LazyLeap(lazy: 24) {
16
+ readwrite pkg.b.ExampleB;
17
+ }
18
+
19
+ system ExplicitlyNoLazy(lazy: false) {
20
+ readwrite pkg.b.ExampleB;
21
+ }
22
+
23
+ system ExplicitlyNoLazyZero(lazy: 0) {
24
+ readwrite pkg.b.ExampleB;
25
+ }
26
+
Original file line number Diff line number Diff line change
1
+ #include " example.ecsact.meta.hh"
2
+
3
+ static_assert (
4
+ ecsact::system_lazy_execution_iteration_rate_v<
5
+ example::ExampleSystemFromImports> == 0
6
+ );
7
+
8
+ static_assert (
9
+ ecsact::system_lazy_execution_iteration_rate_v<example::ExampleLazy> == 1
10
+ );
11
+
12
+ static_assert (
13
+ ecsact::system_lazy_execution_iteration_rate_v<example::LazyLeap> == 24
14
+ );
15
+
16
+ static_assert (
17
+ ecsact::system_lazy_execution_iteration_rate_v<example::ExplicitlyNoLazy> == 0
18
+ );
19
+
20
+ static_assert (
21
+ ecsact::system_lazy_execution_iteration_rate_v<
22
+ example::ExplicitlyNoLazyZero> == 0
23
+ );
Original file line number Diff line number Diff line change @@ -10,3 +10,15 @@ void example::ExampleSystemFromImports::impl(context& ctx) {
10
10
ctx.update (a);
11
11
ctx.update (b);
12
12
}
13
+
14
+ void example::ExampleLazy::impl (context&) {
15
+ }
16
+
17
+ void example::LazyLeap::impl (context&) {
18
+ }
19
+
20
+ void example::ExplicitlyNoLazy::impl (context&) {
21
+ }
22
+
23
+ void example::ExplicitlyNoLazyZero::impl (context&) {
24
+ }
You can’t perform that action at this time.
0 commit comments