核心第一版修订

This commit is contained in:
2026-08-20 17:12:44 +08:00
parent a5cfb4baa9
commit 7849dd9c19
6 changed files with 102 additions and 71 deletions
+4 -19
View File
@@ -19,26 +19,11 @@ struct Scene : Def<Scene, Root, State_Type<Scene_State_Tag>, Dependency_Graph_Ty
std::size_t taskflow_max_predecessors{}; /* 当前总 Taskflow 中单个任务的最大直接前驱数量。 */
std::size_t taskflow_max_successors{}; /* 当前总 Taskflow 中单个任务的最大直接后继数量。 */
std::uint64_t taskflow_execution_time_ns{}; /* 本次 process(...) 执行总 Taskflow 的耗时,单位为纳秒;没有任务时为 0。 */
bool operator==(const State&) const = default; /* 支持测试、快照比较和变更检测的逐字段相等比较。 */
};
struct Private : Prev_Private {
struct Result {}; /* process(...) 完成回调的结果类型;当前仅表示完成。 */
struct Runtime; /* Scene 的 Taskflow 构建产物,定义保留在实现文件。 */
std::unique_ptr<Runtime> runtime; /* Scene 唯一运行时构建产物的所有权。 */
Private();
~Private();
/* Def CRTP hook:所有缓冲推进后重建必要的总 Taskflow,并更新 Scene_State_Tag 状态层。 */
template <Attached Object>
void after_advance(Object* object,
Prop* pending_prop,
State_Access<State> pending_states,
const Prop* current_prop,
State_Access<State> current_states);
/* Impl CRTP 入口:同步执行当前总 Taskflow;派生 Private 只有在替换完整 Scene 处理语义时才应覆盖。 */
template <Attached Object, typename Callback>
void process(Object* object, Callback&& callback) requires std::invocable<Callback, const Result&>;
/* 派生 Scene 的 Private 还可覆盖 Def::Private 的四个 State 生命周期 hook,并通过 State_Access::get<Tag>() 访问状态层。 */
/* 支持测试、快照比较和变更检测的逐字段相等比较。 */
bool operator==(const State&) const = default;
};
/* 完整声明、字段及可覆盖 CRTP hook 见 scene.ipp 中的 Scene::Private。 */
struct Private;
};
}
#include "scene.ipp"