Files
Renderive/web_server/app/common/Gallery_Scene_Interface.h
T
2026-08-16 20:39:12 +08:00

44 lines
1.9 KiB
C++

#pragma once
#include "Gallery_Input.h"
#include "Gallery_Performance_Types.h"
#include "Gallery_Types.h"
#include "adminive/adminive.hpp"
#include <nlohmann/json.hpp>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <string>
#include <string_view>
namespace renderive::web {
enum class Gallery_Render_Result : std::uint8_t {
none,
inactive,
frame_unavailable,
cancelled,
deadline_exceeded,
backend_failure,
shutting_down
};
class Gallery_Scene_Interface {
public:
virtual ~Gallery_Scene_Interface() = default;
[[nodiscard]] virtual const std::string& case_id() const noexcept = 0;
[[nodiscard]] virtual nlohmann::json controls() const = 0;
[[nodiscard]] virtual Gallery_Frame_Mode frame_mode() const noexcept = 0;
virtual void reset_monitoring() = 0;
[[nodiscard]] virtual bool can_render_automatically() const noexcept = 0;
[[nodiscard]] virtual std::uint64_t kernel_refresh_interval_ns() const = 0;
virtual void set_client_metrics(Gallery_Client_Performance metrics) noexcept = 0;
[[nodiscard]] virtual adminive::Update_Result apply_patch(std::string_view target, const nlohmann::json& patch) = 0;
virtual void resize(int width, int height) = 0;
virtual void dispatch(const Gallery_Input_Event& event) = 0;
[[nodiscard]] virtual Gallery_Render_Result render_latest_frame() = 0;
[[nodiscard]] virtual std::optional<std::string> encode_latest_pixels() = 0;
virtual void record_pixel_response(std::chrono::steady_clock::time_point request_started, std::chrono::steady_clock::time_point encode_started, std::chrono::steady_clock::time_point encode_finished, std::size_t pixel_bytes) = 0;
[[nodiscard]] virtual std::string action(const Gallery_Action_Request& request, bool& recognized) = 0;
virtual void record_action_notice_if_empty(std::string_view notice) = 0;
[[nodiscard]] virtual std::string telemetry_json() const = 0;
};
}