Split: Split libspinscale off from SMO.

Now we can probably begin using libspinscale in Couresilient
without worrying about excessive technical debt later on.
This commit is contained in:
2026-02-22 17:46:27 -04:00
parent 9361a43e40
commit 1c397dfeb5
22 changed files with 350 additions and 310 deletions
+2 -1
View File
@@ -3,6 +3,7 @@
#include <spinscale/puppetApplication.h>
#include <spinscale/component.h>
#include <mindComponent.h>
#include <functional>
#include <spinscale/callback.h>
@@ -13,7 +14,7 @@ class Mind;
namespace body {
class Body
: public sscl::PuppetComponent
: public MindComponent
{
public:
Body(Mind &parent, const std::shared_ptr<sscl::PuppetThread> &thread);
+2 -1
View File
@@ -4,6 +4,7 @@
#include <config.h>
#include <spinscale/puppetApplication.h>
#include <spinscale/component.h>
#include <mindComponent.h>
#include <goal.h>
#include <lruLifo.h>
@@ -14,7 +15,7 @@ class Mind;
namespace director {
class Director
: public sscl::PuppetComponent
: public MindComponent
{
public:
Director(Mind &parent, const std::shared_ptr<sscl::PuppetThread> &thread);
+66
View File
@@ -0,0 +1,66 @@
#ifndef _MARIONETTE_H
#define _MARIONETTE_H
#include <boost/asio/signal_set.hpp>
#include <cstdint>
#include <atomic>
#include <functional>
#include <memory>
#include <spinscale/component.h>
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;
public:
typedef std::function<void(bool)> mrnttLifetimeMgmtOpCbFn;
void initializeReq(sscl::Callback<mrnttLifetimeMgmtOpCbFn> callback);
void finalizeReq(sscl::Callback<mrnttLifetimeMgmtOpCbFn> callback);
// Intentionally doesn't take a 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:
class MrnttLifetimeMgmtOp;
class TerminationEvent;
std::unique_ptr<boost::asio::signal_set> signals;
bool callShutdownSalmanoff = false;
};
extern std::shared_ptr<sscl::PuppeteerThread> thread;
extern MarionetteComponent mrntt;
void marionetteInitializeReqCb(bool success);
void marionetteFinalizeReqCb(bool success);
} // namespace mrntt
} // namespace smo
#endif
+3 -2
View File
@@ -11,6 +11,7 @@
#include <spinscale/component.h>
#include <componentThread.h>
#include <mindThread.h>
#include <mindComponent.h>
#include <director/director.h>
#include <simulator/simulator.h>
#include <body/body.h>
@@ -38,9 +39,9 @@ public:
public:
director::Director director;
simulator::Simulator canvas;
sscl::PuppetComponent subconscious;
MindComponent subconscious;
body::Body body;
sscl::PuppetComponent world;
MindComponent world;
private:
friend class body::Body;
+23
View File
@@ -0,0 +1,23 @@
#ifndef MIND_COMPONENT_H
#define MIND_COMPONENT_H
#include <spinscale/component.h>
namespace smo {
class MindComponent
: public sscl::PuppetComponent
{
public:
using sscl::PuppetComponent::PuppetComponent;
static void preJoltHook(sscl::PuppetThread &thr);
void handleLoopExceptionHook() override;
void preLoopHook() override;
void postLoopHook() override;
};
} // namespace smo
#endif // MIND_COMPONENT_H
+5 -7
View File
@@ -6,18 +6,16 @@
namespace smo {
class Mind; // Forward declaration
class MindThread
: public sscl::PuppetThread
{
public:
MindThread(sscl::ThreadId _id)
: sscl::PuppetThread(_id)
MindThread(
sscl::ThreadId _id, sscl::PuppetThread::entryPointFn entryPoint,
sscl::PuppetComponent &component,
sscl::PuppetThread::preJoltHookFn preJoltFn = nullptr)
: sscl::PuppetThread(_id, std::move(entryPoint), component, preJoltFn)
{}
protected:
void handleException() override;
};
} // namespace smo
+2 -1
View File
@@ -4,6 +4,7 @@
#include <config.h>
#include <spinscale/puppetApplication.h>
#include <spinscale/component.h>
#include <mindComponent.h>
#include <simulator/scene.h>
namespace smo {
@@ -13,7 +14,7 @@ class Mind;
namespace simulator {
class Simulator
: public sscl::PuppetComponent
: public MindComponent
{
public:
Simulator(Mind &parent, const std::shared_ptr<sscl::PuppetThread> &thread);