Spinscale: create new namespace sscl

This commit is contained in:
2025-12-27 16:21:22 -04:00
parent 0c4f427c0a
commit 34d76df7d9
67 changed files with 434 additions and 429 deletions
+4 -5
View File
@@ -9,20 +9,19 @@
namespace smo {
class Mind;
class ComponentThread;
namespace body {
class Body
: public PuppetComponent
: public sscl::PuppetComponent
{
public:
Body(Mind &parent, const std::shared_ptr<ComponentThread> &thread);
Body(Mind &parent, const std::shared_ptr<sscl::ComponentThread> &thread);
~Body() = default;
typedef std::function<void(bool)> bodyLifetimeMgmtOpCbFn;
void initializeReq(Callback<bodyLifetimeMgmtOpCbFn> callback);
void finalizeReq(Callback<bodyLifetimeMgmtOpCbFn> callback);
void initializeReq(sscl::Callback<bodyLifetimeMgmtOpCbFn> callback);
void finalizeReq(sscl::Callback<bodyLifetimeMgmtOpCbFn> callback);
private:
class InitializeReq;
+1 -1
View File
@@ -9,7 +9,7 @@ namespace smo {
// Application-specific thread ID enum
// Using regular enum (not enum class) to allow implicit conversion to ThreadId
enum SmoThreadId : ThreadId
enum SmoThreadId : sscl::ThreadId
{
MRNTT = 0,
DIRECTOR,
+1 -1
View File
@@ -33,7 +33,7 @@ public:
public:
std::string deviceIdentifier;
std::vector<std::shared_ptr<DeviceRole>> deviceRoles;
Qutex qutex;
sscl::Qutex qutex;
};
} // namespace device
+11 -11
View File
@@ -55,10 +55,10 @@ public:
void newDeviceAttachmentSpecInd(
const DeviceAttachmentSpec &spec,
Callback<newDeviceAttachmentSpecIndCbFn> callback);
sscl::Callback<newDeviceAttachmentSpecIndCbFn> callback);
void removeDeviceAttachmentSpecReq(
const DeviceAttachmentSpec &spec,
Callback<removeDeviceAttachmentSpecReqCbFn> callback);
sscl::Callback<removeDeviceAttachmentSpecReqCbFn> callback);
// Device attachment/detachment methods moved from SenseApiManager
typedef stim_buff::sal_mlo_attachDeviceReqCbFn attachStimBuffDeviceReqCbFn;
@@ -66,25 +66,25 @@ public:
void attachStimBuffDeviceReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec,
Callback<attachStimBuffDeviceReqCbFn> cb);
sscl::Callback<attachStimBuffDeviceReqCbFn> cb);
void detachStimBuffDeviceReq(
const std::shared_ptr<DeviceAttachmentSpec>& spec,
Callback<detachStimBuffDeviceReqCbFn> cb);
sscl::Callback<detachStimBuffDeviceReqCbFn> cb);
typedef std::function<void(AsynchronousLoop &results)>
typedef std::function<void(sscl::AsynchronousLoop &results)>
attachAllUnattachedDevicesFromReqCbFn;
typedef std::function<void(AsynchronousLoop &results)>
typedef std::function<void(sscl::AsynchronousLoop &results)>
detachAllAttachedDeviceRolesCbFn;
void attachAllUnattachedDevicesFromReq(
const std::shared_ptr<std::vector<DeviceAttachmentSpec>> &specs,
Callback<attachAllUnattachedDevicesFromReqCbFn> cb);
sscl::Callback<attachAllUnattachedDevicesFromReqCbFn> cb);
void attachAllUnattachedDevicesFromKnownListReq(
Callback<attachAllUnattachedDevicesFromReqCbFn> cb);
sscl::Callback<attachAllUnattachedDevicesFromReqCbFn> cb);
void attachAllUnattachedDevicesFromCmdlineReq(
Callback<attachAllUnattachedDevicesFromReqCbFn> cb);
sscl::Callback<attachAllUnattachedDevicesFromReqCbFn> cb);
void detachAllAttachedDeviceRoles(
Callback<detachAllAttachedDeviceRolesCbFn> cb);
sscl::Callback<detachAllAttachedDeviceRolesCbFn> cb);
private:
DeviceManager()
@@ -95,7 +95,7 @@ private:
DeviceManager& operator=(const DeviceManager&) = delete;
public:
Qutex qutex;
sscl::Qutex qutex;
std::string allDapSpecs;
static std::vector<std::shared_ptr<DeviceAttachmentSpec>>
deviceAttachmentSpecs;
@@ -9,8 +9,6 @@
namespace smo {
class ComponentThread;
namespace device {
class DeviceManager;
@@ -19,7 +17,7 @@ class DeviceReattacher
{
public:
DeviceReattacher(
DeviceManager& parent, std::shared_ptr<ComponentThread> ioThread);
DeviceManager& parent, std::shared_ptr<sscl::ComponentThread> ioThread);
~DeviceReattacher() = default;
// Non-copyable
@@ -35,8 +33,8 @@ private:
void onTimeout(const boost::system::error_code& error);
DeviceManager &parent;
std::shared_ptr<ComponentThread> ioThread;
SpinLock shouldContinueLock;
std::shared_ptr<sscl::ComponentThread> ioThread;
sscl::SpinLock shouldContinueLock;
bool shouldContinue;
boost::asio::deadline_timer timer;
};
+2 -3
View File
@@ -10,15 +10,14 @@
namespace smo {
class Mind;
class ComponentThread;
namespace director {
class Director
: public PuppetComponent
: public sscl::PuppetComponent
{
public:
Director(Mind &parent, const std::shared_ptr<ComponentThread> &thread);
Director(Mind &parent, const std::shared_ptr<sscl::ComponentThread> &thread);
~Director() = default;
void negtrinEventInd(void);
+4 -4
View File
@@ -13,16 +13,16 @@ class MarionetteThread;
namespace mrntt {
class MarionetteComponent
: public Component
: public sscl::Component
{
public:
MarionetteComponent(const std::shared_ptr<ComponentThread> &thread);
MarionetteComponent(const std::shared_ptr<sscl::ComponentThread> &thread);
~MarionetteComponent() = default;
public:
typedef std::function<void(bool)> mrnttLifetimeMgmtOpCbFn;
void initializeReq(Callback<mrnttLifetimeMgmtOpCbFn> callback);
void finalizeReq(Callback<mrnttLifetimeMgmtOpCbFn> callback);
void initializeReq(sscl::Callback<mrnttLifetimeMgmtOpCbFn> callback);
void finalizeReq(sscl::Callback<mrnttLifetimeMgmtOpCbFn> callback);
// Intentionally doesn't take a callback.
void exceptionInd();
+6 -6
View File
@@ -18,18 +18,18 @@
namespace smo {
class Mind
: public PuppetApplication
: public sscl::PuppetApplication
{
public:
Mind(void);
~Mind(void) = default;
typedef std::function<void(bool)> mindLifetimeMgmtOpCbFn;
void initializeReq(Callback<mindLifetimeMgmtOpCbFn> callback);
void finalizeReq(Callback<mindLifetimeMgmtOpCbFn> callback);
void initializeReq(sscl::Callback<mindLifetimeMgmtOpCbFn> callback);
void finalizeReq(sscl::Callback<mindLifetimeMgmtOpCbFn> callback);
// ComponentThread access methods
std::shared_ptr<MindThread> getComponentThread(ThreadId id) const;
std::shared_ptr<MindThread> getComponentThread(sscl::ThreadId id) const;
std::shared_ptr<MindThread> getComponentThread(
const std::string& name) const;
// Get all this Mind's component threads.
@@ -38,9 +38,9 @@ public:
public:
director::Director director;
simulator::Simulator canvas;
PuppetComponent subconscious;
sscl::PuppetComponent subconscious;
body::Body body;
PuppetComponent world;
sscl::PuppetComponent world;
private:
friend class body::Body;
+3 -3
View File
@@ -9,11 +9,11 @@ namespace smo {
class Mind; // Forward declaration
class MindThread
: public PuppetThread
: public sscl::PuppetThread
{
public:
MindThread(ThreadId _id, Mind& parent)
: PuppetThread(_id),
MindThread(sscl::ThreadId _id, Mind& parent)
: sscl::PuppetThread(_id),
parent(parent)
{
}
+2 -3
View File
@@ -9,15 +9,14 @@
namespace smo {
class Mind;
class ComponentThread;
namespace simulator {
class Simulator
: public PuppetComponent
: public sscl::PuppetComponent
{
public:
Simulator(Mind &parent, const std::shared_ptr<ComponentThread> &thread);
Simulator(Mind &parent, const std::shared_ptr<sscl::ComponentThread> &thread);
~Simulator() = default;
void initialize();
@@ -51,7 +51,7 @@ public:
public:
std::string libraryPath;
Qutex qutex;
sscl::Qutex qutex;
std::atomic<bool> isBeingDestroyed;
std::unique_ptr<void, DlCloser> dlopen_handle;
/* UNIMPLEMENTED: API-specific cmdline options. These affect this specific
@@ -32,7 +32,7 @@ public:
StimBuffApiLib& loadStimBuffApiLib(
const std::string& libraryPath,
const std::shared_ptr<ComponentThread>& componentThread);
const std::shared_ptr<sscl::ComponentThread>& componentThread);
std::optional<std::shared_ptr<StimBuffApiLib>> getStimBuffApiLib(
const std::string& libraryPath);
@@ -44,7 +44,7 @@ public:
void finalizeStimBuffApiLib(StimBuffApiLib& lib);
void loadAllStimBuffApiLibsFromOptions(
const std::shared_ptr<ComponentThread>& componentThread);
const std::shared_ptr<sscl::ComponentThread>& componentThread);
void unloadAllStimBuffApiLibs(void);
void initializeAllStimBuffApiLibs(void);
@@ -64,7 +64,7 @@ private:
std::vector<std::shared_ptr<StimBuffApiLib>> stimBuffApiLibs;
public:
Qutex qutex;
sscl::Qutex qutex;
public:
static std::optional<std::string> searchForLibInSmoSearchPaths(