slige/runtime/actions.hpp

50 lines
1.2 KiB
C++
Raw Normal View History

2024-11-27 12:28:45 +00:00
#include "rpc_server.hpp"
#include "vm_provider.hpp"
2024-11-27 12:28:45 +00:00
#include <memory>
namespace sliger::rpc::action {
struct Action {
2024-12-13 15:11:16 +00:00
virtual auto perform_action(std::unique_ptr<BufferedWriter> writer,
2024-12-15 00:32:21 +00:00
vm_provider::VmProvider& vm_provider) -> void = 0;
2024-11-27 12:28:45 +00:00
virtual ~Action() = default;
};
2024-12-15 00:32:21 +00:00
class Status : public Action {
public:
Status() { }
auto perform_action(std::unique_ptr<BufferedWriter> writer,
vm_provider::VmProvider& vm_provider) -> void;
};
class FlameGraph : public Action {
public:
FlameGraph() { }
2024-12-13 15:11:16 +00:00
auto perform_action(std::unique_ptr<BufferedWriter> writer,
vm_provider::VmProvider& vm_provider) -> void;
};
class CodeCoverage : public Action {
public:
CodeCoverage() { }
2024-12-13 15:11:16 +00:00
auto perform_action(std::unique_ptr<BufferedWriter> writer,
vm_provider::VmProvider& vm_provider) -> void;
};
2024-11-27 12:28:45 +00:00
class RunDebug : public Action {
public:
RunDebug(std::vector<uint32_t> instructions)
: instructions(instructions)
{
}
2024-12-13 15:11:16 +00:00
auto perform_action(std::unique_ptr<BufferedWriter> writer,
vm_provider::VmProvider& vm_provider) -> void;
2024-11-27 12:28:45 +00:00
private:
std::vector<uint32_t> instructions;
};
2024-12-13 15:11:16 +00:00
auto action_from_json(const json::Value& value) -> std::unique_ptr<Action>;
2024-11-27 12:28:45 +00:00
}