#ifndef _MARIONETTE_H #define _MARIONETTE_H #include #include #include #include #include #include #include #include #include namespace sscl { class PuppeteerThread; } // namespace sscl namespace smo { namespace mrntt { class MarionetteComponent : public sscl::pptr::PuppeteerComponent { public: MarionetteComponent(const std::shared_ptr &thread) : sscl::pptr::PuppeteerComponent(thread) {} ~MarionetteComponent() = default; void holdInitializeCReq(std::function completion); void holdFinalizeCReq(std::function completion); MrnttNonViralPostingInvoker initializeCReq( std::exception_ptr &exceptionPtr, std::function callback); MrnttNonViralPostingInvoker finalizeCReq( std::exception_ptr &exceptionPtr, std::function callback); 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 signals; bool callShutdownSalmanoff = false; std::optional initializeCReqInvoker; std::optional finalizeCReqInvoker; public: std::exception_ptr initializeLifetimeExceptionPtr; std::exception_ptr finalizeLifetimeExceptionPtr; /** Set true only when initializeCReq completes without failure. */ bool initializeLifetimeSucceeded = false; }; extern std::shared_ptr thread; extern MarionetteComponent mrntt; void marionetteInitializeReqCb(bool success); void marionetteFinalizeReqCb(bool success); } // namespace mrntt } // namespace smo #endif