2026-02-22 17:46:27 -04:00
|
|
|
#ifndef _MARIONETTE_H
|
|
|
|
|
#define _MARIONETTE_H
|
|
|
|
|
|
|
|
|
|
#include <boost/asio/signal_set.hpp>
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <atomic>
|
2026-05-24 16:12:29 -04:00
|
|
|
#include <exception>
|
2026-02-22 17:46:27 -04:00
|
|
|
#include <functional>
|
|
|
|
|
#include <memory>
|
2026-05-24 16:12:29 -04:00
|
|
|
#include <optional>
|
2026-02-22 17:46:27 -04:00
|
|
|
#include <spinscale/component.h>
|
2026-06-09 11:19:42 -04:00
|
|
|
#include <spinscale/co/nonViralTaskNursery.h>
|
2026-05-24 16:12:29 -04:00
|
|
|
#include <marionette/marionetteThread.h>
|
2026-06-10 21:17:52 -04:00
|
|
|
#include <user/smoHooks.h>
|
2026-02-22 17:46:27 -04:00
|
|
|
|
|
|
|
|
namespace sscl {
|
|
|
|
|
|
|
|
|
|
class PuppeteerThread;
|
|
|
|
|
|
|
|
|
|
} // namespace sscl
|
|
|
|
|
|
|
|
|
|
namespace smo {
|
|
|
|
|
namespace mrntt {
|
|
|
|
|
|
|
|
|
|
class MarionetteComponent
|
|
|
|
|
: public sscl::pptr::PuppeteerComponent
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
MarionetteComponent(const std::shared_ptr<sscl::PuppeteerThread> &thread)
|
|
|
|
|
: sscl::pptr::PuppeteerComponent(thread)
|
|
|
|
|
{}
|
|
|
|
|
~MarionetteComponent() = default;
|
|
|
|
|
|
2026-06-09 11:19:42 -04:00
|
|
|
void holdInitializeCReq(
|
|
|
|
|
std::function<void(std::exception_ptr &exceptionPtr)> completion);
|
|
|
|
|
void holdFinalizeCReq(
|
|
|
|
|
std::function<void(std::exception_ptr &exceptionPtr)> completion);
|
2026-05-24 16:12:29 -04:00
|
|
|
|
|
|
|
|
MrnttNonViralPostingInvoker initializeCReq(
|
|
|
|
|
std::exception_ptr &exceptionPtr,
|
|
|
|
|
std::function<void()> callback);
|
|
|
|
|
|
|
|
|
|
MrnttNonViralPostingInvoker finalizeCReq(
|
|
|
|
|
std::exception_ptr &exceptionPtr,
|
|
|
|
|
std::function<void()> callback);
|
|
|
|
|
|
2026-02-22 17:46:27 -04:00
|
|
|
void exceptionInd();
|
|
|
|
|
|
|
|
|
|
void handleLoopExceptionHook() override;
|
|
|
|
|
|
|
|
|
|
static void preJoltHook(sscl::PuppeteerThread &thr);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
void postJoltHook() override;
|
|
|
|
|
void tryBlock1Hook() override;
|
|
|
|
|
void preLoopHook() override;
|
|
|
|
|
void postLoopHook() override;
|
|
|
|
|
void postTryBlock1CatchHook() override;
|
|
|
|
|
void handleTryBlock1TypedException(const std::exception& e) override;
|
|
|
|
|
void handleTryBlock1UnknownException() override;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::unique_ptr<boost::asio::signal_set> signals;
|
|
|
|
|
bool callShutdownSalmanoff = false;
|
2026-06-09 11:19:42 -04:00
|
|
|
sscl::co::NonViralTaskNursery taskNursery;
|
2026-02-22 17:46:27 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern std::shared_ptr<sscl::PuppeteerThread> thread;
|
|
|
|
|
extern MarionetteComponent mrntt;
|
2026-06-10 21:17:52 -04:00
|
|
|
extern stim_buff::SmoThreadingModelDesc smoThreadingModelDesc;
|
|
|
|
|
|
|
|
|
|
void initializeSmoThreadingModelDesc(
|
|
|
|
|
const std::shared_ptr<sscl::ComponentThread>& componentThread);
|
|
|
|
|
|
|
|
|
|
const stim_buff::SmoThreadingModelDesc& getSmoThreadingModelDesc();
|
2026-02-22 17:46:27 -04:00
|
|
|
|
|
|
|
|
void marionetteInitializeReqCb(bool success);
|
|
|
|
|
void marionetteFinalizeReqCb(bool success);
|
|
|
|
|
|
|
|
|
|
} // namespace mrntt
|
|
|
|
|
} // namespace smo
|
|
|
|
|
|
|
|
|
|
#endif
|