Files
Aethera/kernel/kernel/include/function/frame_policy/Throttled_Latest_Only.hpp
T
2026-09-01 08:51:01 +08:00

42 lines
1.3 KiB
C++

#pragma once
#include "function/frame_policy/global.hpp"
#include "model/Model.hpp"
#include <cstdint>
#include <functional>
namespace aethera {
/*
* 固定帧率、最多一帧在途的策略。Scene 创建具体帧;策略持有并重复使用,
* stop completion 执行前会排空 Scene/Sink 借用并销毁该帧。
*/
struct Throttled_Latest_only :
Def<Throttled_Latest_only, Root<Throttled_Latest_only>> {
enum struct Start_Result : std::uint8_t {
started,
already_running,
start_in_progress,
stop_in_progress,
dependency_unavailable,
frame_unavailable,
invalid_frames_per_second,
interval_out_of_range
};
enum struct Stop_Result : std::uint8_t {
stopping,
already_stopped,
already_stopping,
start_in_progress,
completion_missing
};
using Stop_Completion = std::function<void()>;
struct Prop : Prev_Prop {};
struct Private;
Throttled_Latest_only(proxy<Periodic_Timer_Service> timer_service,
proxy<FP_Scene> scene,
proxy<FP_Sink> sink);
~Throttled_Latest_only() noexcept;
Start_Result start(double frames_per_second);
Stop_Result stop(Stop_Completion completion);
};
}
#include "Throttled_Latest_Only.ipp"