Files
Aethera/mcp/core/Control_Service.ipp
T

52 lines
2.0 KiB
C++

#pragma once
#include "runtime/Gallery_Runtime.hpp"
#include <array>
#include <atomic>
#include <optional>
#include <unordered_map>
namespace aethera::mcp {
struct Control_Service::Private {
struct Entry : std::enable_shared_from_this<Entry> {
static constexpr std::size_t maximum_taskflow_trace_frames{120};
std::unique_ptr<web::Gallery_Component> components{};
web::Gallery_Runtime runtime{};
std::string id{};
Gallery_Output output{};
std::atomic<std::shared_ptr<const std::string>> terminal_failure{};
std::atomic_size_t taskflow_trace_remaining{};
std::atomic_uint64_t taskflow_trace_control{};
std::array<std::atomic<std::shared_ptr<const nlohmann::json>>,
maximum_taskflow_trace_frames> taskflow_trace_slots{};
Entry(std::string value_id, web::Gallery_Build build,
Gallery_Output value_output);
~Entry();
Entry(const Entry&) = delete;
Entry& operator=(const Entry&) = delete;
void start();
void stop() noexcept;
[[nodiscard]] std::shared_ptr<Frame_Policy> policy() const noexcept;
[[nodiscard]] std::shared_ptr<Frame_Policy> create_policy(
Frame_Policy_Type type, double fixed_rate_fps);
void replace_policy(Frame_Policy_Type type);
void prepare_frame(not_null<Render_Frame*> frame,
const Frame_Production& production);
[[nodiscard]] Frame_Publication_Dispatch publish_frame(
not_null<Render_Frame*> frame,
const Frame_Production& production);
void fail(std::exception_ptr failure) noexcept;
[[nodiscard]] nlohmann::json schema() const;
[[nodiscard]] nlohmann::json diagnostics() const;
void request_trace(std::size_t frame_count);
[[nodiscard]] nlohmann::json trace() const;
};
Gallery_Output output{};
std::unordered_map<std::string, std::shared_ptr<Entry>> plots;
};
}