From 260f649b08e7c3325cf4a879245f2c132562e405 Mon Sep 17 00:00:00 2001 From: wyc <1104749580@qq.com> Date: Fri, 14 Aug 2026 12:29:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BC=8F=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../real_time_data/Latest_Real_Time_Data.hpp | 52 ---------------- .../real_time_data/Latest_Real_Time_Data.inl | 61 ------------------- 2 files changed, 113 deletions(-) delete mode 100644 Kernel/src/renderive/real_time_data/Latest_Real_Time_Data.hpp delete mode 100644 Kernel/src/renderive/real_time_data/Latest_Real_Time_Data.inl diff --git a/Kernel/src/renderive/real_time_data/Latest_Real_Time_Data.hpp b/Kernel/src/renderive/real_time_data/Latest_Real_Time_Data.hpp deleted file mode 100644 index 157998f..0000000 --- a/Kernel/src/renderive/real_time_data/Latest_Real_Time_Data.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include "renderive/base/Concepts.hpp" -#include "renderive/base/observer/Observer.hpp" -#include "Observation.hpp" -#include "base/Real_Time_Data_Base.hpp" -#include "concept/Real_Time_Data.hpp" -#include "renderive/state/Render_State_View.hpp" -template > -class Latest_Real_Time_Data : public Real_Time_Data_Base { -public: - using Value = Value_Type; - static_assert(Real_Time_Data_Value); - static_assert(Timed_Struct_Observer); - explicit Latest_Real_Time_Data(Observer observer = {}); - Latest_Real_Time_Data(const Latest_Real_Time_Data&) = delete; - Latest_Real_Time_Data& operator=(const Latest_Real_Time_Data&) = delete; - void update(Value value); - std::optional snapshot() const; - bool has_value() const; - std::uint64_t revision() const; - Real_Time_Data_Retention retention() const noexcept override; - Real_Time_Data_Update_State update_state() const override; - std::size_t discard_before_time_ns(std::uint64_t time_ns) override; - template - requires requires(Observer& observer, Target& target) { - observer.bind(target); - } - decltype(auto) bind(Target& target) { - return observer_.bind(target); - } -private: - friend class Render_State_View; - void publish_render_state() override; - const std::optional& render_state_value() const noexcept; - mutable Mutex mutex_; - std::recursive_mutex mutation_mutex_; - Observer observer_; - std::optional states_[3]; - std::optional* render_state_; - std::optional* cache_state_; - std::optional* scratch_state_; - std::uint64_t revision_{}; - std::uint64_t render_revision_{}; - std::uint64_t total_update_count_{}; - std::uint64_t last_update_time_ns_{}; -}; -#include "Latest_Real_Time_Data.inl" diff --git a/Kernel/src/renderive/real_time_data/Latest_Real_Time_Data.inl b/Kernel/src/renderive/real_time_data/Latest_Real_Time_Data.inl deleted file mode 100644 index 578f867..0000000 --- a/Kernel/src/renderive/real_time_data/Latest_Real_Time_Data.inl +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once -template -Latest_Real_Time_Data::Latest_Real_Time_Data(Observer observer) - : observer_(std::move(observer)), render_state_(&states_[0]), cache_state_(&states_[1]), scratch_state_(&states_[2]) {} -template -void Latest_Real_Time_Data::update(Value value) { - std::lock_guard mutation_lock(mutation_mutex_); - Real_Time_Data_Observation observation; - { - std::lock_guard lock(mutex_); - *cache_state_ = std::move(value); - ++revision_; - ++total_update_count_; - last_update_time_ns_ = observer_.now_ns(); - observation = {Real_Time_Data_Observation_Event::updated, {this, Real_Time_Data_Retention::latest, revision_, last_update_time_ns_, total_update_count_, 1}}; - } - observer_.observe(observation); -} -template -auto Latest_Real_Time_Data::snapshot() const -> std::optional { - std::lock_guard lock(mutex_); - return *cache_state_; -} -template -bool Latest_Real_Time_Data::has_value() const { - std::lock_guard lock(mutex_); - return cache_state_->has_value(); -} -template -std::uint64_t Latest_Real_Time_Data::revision() const { - std::lock_guard lock(mutex_); - return revision_; -} -template -Real_Time_Data_Update_State Latest_Real_Time_Data::update_state() const { - std::lock_guard lock(mutex_); - return {this, Real_Time_Data_Retention::latest, revision_, last_update_time_ns_, total_update_count_, *cache_state_ ? 1U : 0U}; -} -template -void Latest_Real_Time_Data::publish_render_state() { - std::lock_guard lock(mutex_); - if (render_revision_ == revision_) - return; - *scratch_state_ = *cache_state_; - std::swap(render_state_, scratch_state_); - render_revision_ = revision_; -} -template -auto Latest_Real_Time_Data::render_state_value() const noexcept - -> const std::optional& { - return *render_state_; -} - -template -Real_Time_Data_Retention Latest_Real_Time_Data::retention() const noexcept { - return Real_Time_Data_Retention::latest; -} -template -std::size_t Latest_Real_Time_Data::discard_before_time_ns(std::uint64_t) { - return 0; -}