Spinscale: create new namespace sscl
This commit is contained in:
@@ -45,15 +45,15 @@ const std::string DeviceManager::stringifyDeviceSpecs(void)
|
||||
}
|
||||
|
||||
class DeviceManager::NewDeviceAttachmentSpecInd
|
||||
: public SerializedAsynchronousContinuation<newDeviceAttachmentSpecIndCbFn>
|
||||
: public sscl::SerializedAsynchronousContinuation<newDeviceAttachmentSpecIndCbFn>
|
||||
{
|
||||
public:
|
||||
NewDeviceAttachmentSpecInd(
|
||||
const DeviceAttachmentSpec &spec,
|
||||
const std::shared_ptr<ComponentThread> &caller,
|
||||
Callback<newDeviceAttachmentSpecIndCbFn> cb,
|
||||
std::vector<std::reference_wrapper<Qutex>> requiredLocks)
|
||||
: SerializedAsynchronousContinuation<newDeviceAttachmentSpecIndCbFn>(
|
||||
const std::shared_ptr<sscl::ComponentThread> &caller,
|
||||
sscl::Callback<newDeviceAttachmentSpecIndCbFn> cb,
|
||||
std::vector<std::reference_wrapper<sscl::Qutex>> requiredLocks)
|
||||
: sscl::SerializedAsynchronousContinuation<newDeviceAttachmentSpecIndCbFn>(
|
||||
caller, cb, requiredLocks),
|
||||
spec(spec)
|
||||
{}
|
||||
@@ -171,15 +171,15 @@ public:
|
||||
};
|
||||
|
||||
class DeviceManager::RemoveDeviceAttachmentSpecReq
|
||||
: public SerializedAsynchronousContinuation<removeDeviceAttachmentSpecReqCbFn>
|
||||
: public sscl::SerializedAsynchronousContinuation<removeDeviceAttachmentSpecReqCbFn>
|
||||
{
|
||||
public:
|
||||
RemoveDeviceAttachmentSpecReq(
|
||||
const DeviceAttachmentSpec &spec,
|
||||
const std::shared_ptr<ComponentThread> &caller,
|
||||
Callback<removeDeviceAttachmentSpecReqCbFn> cb,
|
||||
std::vector<std::reference_wrapper<Qutex>> requiredLocks)
|
||||
: SerializedAsynchronousContinuation<removeDeviceAttachmentSpecReqCbFn>(
|
||||
const std::shared_ptr<sscl::ComponentThread> &caller,
|
||||
sscl::Callback<removeDeviceAttachmentSpecReqCbFn> cb,
|
||||
std::vector<std::reference_wrapper<sscl::Qutex>> requiredLocks)
|
||||
: sscl::SerializedAsynchronousContinuation<removeDeviceAttachmentSpecReqCbFn>(
|
||||
caller, cb, requiredLocks),
|
||||
spec(spec)
|
||||
{}
|
||||
@@ -293,13 +293,13 @@ public:
|
||||
|
||||
void DeviceManager::newDeviceAttachmentSpecInd(
|
||||
const DeviceAttachmentSpec &spec,
|
||||
Callback<newDeviceAttachmentSpecIndCbFn> callback)
|
||||
sscl::Callback<newDeviceAttachmentSpecIndCbFn> callback)
|
||||
{
|
||||
const auto& caller = ComponentThread::getSelf();
|
||||
const auto& caller = sscl::ComponentThread::getSelf();
|
||||
|
||||
auto request = std::make_shared<NewDeviceAttachmentSpecInd>(
|
||||
spec, caller, callback,
|
||||
LockSet<newDeviceAttachmentSpecIndCbFn>::Set{
|
||||
sscl::LockSet<newDeviceAttachmentSpecIndCbFn>::Set{
|
||||
std::ref(DeviceManager::getInstance().qutex)
|
||||
});
|
||||
|
||||
@@ -312,13 +312,13 @@ void DeviceManager::newDeviceAttachmentSpecInd(
|
||||
|
||||
void DeviceManager::removeDeviceAttachmentSpecReq(
|
||||
const DeviceAttachmentSpec &spec,
|
||||
Callback<removeDeviceAttachmentSpecReqCbFn> callback)
|
||||
sscl::Callback<removeDeviceAttachmentSpecReqCbFn> callback)
|
||||
{
|
||||
const auto& caller = ComponentThread::getSelf();
|
||||
const auto& caller = sscl::ComponentThread::getSelf();
|
||||
|
||||
auto request = std::make_shared<RemoveDeviceAttachmentSpecReq>(
|
||||
spec, caller, callback,
|
||||
LockSet<removeDeviceAttachmentSpecReqCbFn>::Set{
|
||||
sscl::LockSet<removeDeviceAttachmentSpecReqCbFn>::Set{
|
||||
std::ref(DeviceManager::getInstance().qutex)
|
||||
});
|
||||
|
||||
@@ -331,17 +331,17 @@ void DeviceManager::removeDeviceAttachmentSpecReq(
|
||||
}
|
||||
|
||||
class DeviceManager::AttachStimBuffDeviceReq
|
||||
: public SerializedAsynchronousContinuation<
|
||||
: public sscl::SerializedAsynchronousContinuation<
|
||||
DeviceManager::attachStimBuffDeviceReqCbFn>
|
||||
{
|
||||
public:
|
||||
AttachStimBuffDeviceReq(
|
||||
const std::shared_ptr<DeviceAttachmentSpec>& spec,
|
||||
const std::shared_ptr<ComponentThread> &caller,
|
||||
Callback<DeviceManager::attachStimBuffDeviceReqCbFn> cb,
|
||||
const std::shared_ptr<sscl::ComponentThread> &caller,
|
||||
sscl::Callback<DeviceManager::attachStimBuffDeviceReqCbFn> cb,
|
||||
std::shared_ptr<stim_buff::StimBuffApiLib> &stimBuffApiLib,
|
||||
std::vector<std::reference_wrapper<Qutex>> requiredLocks)
|
||||
: SerializedAsynchronousContinuation<attachStimBuffDeviceReqCbFn>(
|
||||
std::vector<std::reference_wrapper<sscl::Qutex>> requiredLocks)
|
||||
: sscl::SerializedAsynchronousContinuation<attachStimBuffDeviceReqCbFn>(
|
||||
caller, cb, requiredLocks),
|
||||
spec(spec), stimBuffApiLib(stimBuffApiLib)
|
||||
{}
|
||||
@@ -386,7 +386,7 @@ public:
|
||||
* Introspectors are attached to the body thread; extrospectors are
|
||||
* attached to the world thread.
|
||||
*/
|
||||
std::shared_ptr<ComponentThread> threadForAttachment;
|
||||
std::shared_ptr<sscl::ComponentThread> threadForAttachment;
|
||||
if (spec->sensorType == 'e')
|
||||
{
|
||||
threadForAttachment = mind::globalMind->world.thread;
|
||||
@@ -473,10 +473,10 @@ public:
|
||||
|
||||
void DeviceManager::attachStimBuffDeviceReq(
|
||||
const std::shared_ptr<DeviceAttachmentSpec>& spec,
|
||||
Callback<attachStimBuffDeviceReqCbFn> cb
|
||||
sscl::Callback<attachStimBuffDeviceReqCbFn> cb
|
||||
)
|
||||
{
|
||||
const auto& caller = ComponentThread::getSelf();
|
||||
const auto& caller = sscl::ComponentThread::getSelf();
|
||||
|
||||
// Get the stim buff API lib's qutex
|
||||
auto libOpt = stim_buff::StimBuffApiManager::getInstance()
|
||||
@@ -494,7 +494,7 @@ void DeviceManager::attachStimBuffDeviceReq(
|
||||
|
||||
auto request = std::make_shared<AttachStimBuffDeviceReq>(
|
||||
spec, caller, cb, libOpt.value(),
|
||||
LockSet<attachStimBuffDeviceReqCbFn>::Set{
|
||||
sscl::LockSet<attachStimBuffDeviceReqCbFn>::Set{
|
||||
std::ref(stim_buff::StimBuffApiManager::getInstance().qutex),
|
||||
std::ref(lib.qutex)
|
||||
});
|
||||
@@ -508,10 +508,10 @@ void DeviceManager::attachStimBuffDeviceReq(
|
||||
|
||||
void DeviceManager::detachStimBuffDeviceReq(
|
||||
const std::shared_ptr<DeviceAttachmentSpec>& spec,
|
||||
Callback<detachStimBuffDeviceReqCbFn> cb
|
||||
sscl::Callback<detachStimBuffDeviceReqCbFn> cb
|
||||
)
|
||||
{
|
||||
const auto& caller = ComponentThread::getSelf();
|
||||
const auto& caller = sscl::ComponentThread::getSelf();
|
||||
|
||||
// Get the stim buff API lib's qutex
|
||||
auto libOpt = stim_buff::StimBuffApiManager::getInstance()
|
||||
@@ -529,7 +529,7 @@ void DeviceManager::detachStimBuffDeviceReq(
|
||||
|
||||
auto request = std::make_shared<DetachStimBuffDeviceReq>(
|
||||
spec, caller, cb, libOpt.value(),
|
||||
LockSet<detachStimBuffDeviceReqCbFn>::Set{
|
||||
sscl::LockSet<detachStimBuffDeviceReqCbFn>::Set{
|
||||
std::ref(stim_buff::StimBuffApiManager::getInstance().qutex),
|
||||
std::ref(lib.qutex)
|
||||
});
|
||||
@@ -542,16 +542,16 @@ void DeviceManager::detachStimBuffDeviceReq(
|
||||
}
|
||||
|
||||
class DeviceManager::AttachAllUnattachedDevicesFromReq
|
||||
: public PostedAsynchronousContinuation<
|
||||
: public sscl::PostedAsynchronousContinuation<
|
||||
attachAllUnattachedDevicesFromReqCbFn>
|
||||
{
|
||||
public:
|
||||
AttachAllUnattachedDevicesFromReq(
|
||||
const unsigned int totalNSpecs,
|
||||
const std::shared_ptr<std::vector<DeviceAttachmentSpec>>& specs,
|
||||
const std::shared_ptr<ComponentThread>& caller,
|
||||
Callback<attachAllUnattachedDevicesFromReqCbFn> cb)
|
||||
: PostedAsynchronousContinuation<attachAllUnattachedDevicesFromReqCbFn>(
|
||||
const std::shared_ptr<sscl::ComponentThread>& caller,
|
||||
sscl::Callback<attachAllUnattachedDevicesFromReqCbFn> cb)
|
||||
: sscl::PostedAsynchronousContinuation<attachAllUnattachedDevicesFromReqCbFn>(
|
||||
caller, cb),
|
||||
loop(totalNSpecs), specs(specs)
|
||||
{}
|
||||
@@ -606,23 +606,23 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
AsynchronousLoop loop;
|
||||
sscl::AsynchronousLoop loop;
|
||||
std::shared_ptr<std::vector<DeviceAttachmentSpec>> specs;
|
||||
};
|
||||
|
||||
void DeviceManager::attachAllUnattachedDevicesFromReq(
|
||||
const std::shared_ptr<std::vector<DeviceAttachmentSpec>> &specs,
|
||||
Callback<attachAllUnattachedDevicesFromReqCbFn> cb
|
||||
sscl::Callback<attachAllUnattachedDevicesFromReqCbFn> cb
|
||||
)
|
||||
{
|
||||
if (specs->size() == 0)
|
||||
{
|
||||
AsynchronousLoop tmp(0);
|
||||
sscl::AsynchronousLoop tmp(0);
|
||||
cb.callbackFn(tmp);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& caller = ComponentThread::getSelf();
|
||||
const auto& caller = sscl::ComponentThread::getSelf();
|
||||
auto request = std::make_shared<AttachAllUnattachedDevicesFromReq>(
|
||||
specs->size(), specs, caller, std::move(cb));
|
||||
|
||||
@@ -634,7 +634,7 @@ void DeviceManager::attachAllUnattachedDevicesFromReq(
|
||||
}
|
||||
|
||||
void DeviceManager::attachAllUnattachedDevicesFromCmdlineReq(
|
||||
Callback<attachAllUnattachedDevicesFromReqCbFn> cb
|
||||
sscl::Callback<attachAllUnattachedDevicesFromReqCbFn> cb
|
||||
)
|
||||
{
|
||||
auto specs = std::make_shared<std::vector<DeviceAttachmentSpec>>(
|
||||
@@ -643,15 +643,15 @@ void DeviceManager::attachAllUnattachedDevicesFromCmdlineReq(
|
||||
}
|
||||
|
||||
class DeviceManager::AttachAllUnattachedDevicesFromKnownListReq
|
||||
: public SerializedAsynchronousContinuation<
|
||||
: public sscl::SerializedAsynchronousContinuation<
|
||||
attachAllUnattachedDevicesFromReqCbFn>
|
||||
{
|
||||
public:
|
||||
AttachAllUnattachedDevicesFromKnownListReq(
|
||||
const std::shared_ptr<ComponentThread> &caller,
|
||||
Callback<attachAllUnattachedDevicesFromReqCbFn> cb,
|
||||
std::vector<std::reference_wrapper<Qutex>> requiredLocks)
|
||||
: SerializedAsynchronousContinuation<
|
||||
const std::shared_ptr<sscl::ComponentThread> &caller,
|
||||
sscl::Callback<attachAllUnattachedDevicesFromReqCbFn> cb,
|
||||
std::vector<std::reference_wrapper<sscl::Qutex>> requiredLocks)
|
||||
: sscl::SerializedAsynchronousContinuation<
|
||||
attachAllUnattachedDevicesFromReqCbFn>(
|
||||
caller, cb, requiredLocks)
|
||||
{}
|
||||
@@ -703,7 +703,7 @@ public:
|
||||
void attachAllUnattachedDevicesFromKnownListReq2(
|
||||
[[maybe_unused]]
|
||||
std::shared_ptr<AttachAllUnattachedDevicesFromKnownListReq> context,
|
||||
AsynchronousLoop loop
|
||||
sscl::AsynchronousLoop loop
|
||||
)
|
||||
{
|
||||
callOriginalCb(loop);
|
||||
@@ -711,14 +711,14 @@ public:
|
||||
};
|
||||
|
||||
void DeviceManager::attachAllUnattachedDevicesFromKnownListReq(
|
||||
Callback<attachAllUnattachedDevicesFromReqCbFn> cb
|
||||
sscl::Callback<attachAllUnattachedDevicesFromReqCbFn> cb
|
||||
)
|
||||
{
|
||||
const auto& caller = ComponentThread::getSelf();
|
||||
const auto& caller = sscl::ComponentThread::getSelf();
|
||||
|
||||
auto request = std::make_shared<AttachAllUnattachedDevicesFromKnownListReq>(
|
||||
caller, cb,
|
||||
LockSet<attachAllUnattachedDevicesFromReqCbFn>::Set{
|
||||
sscl::LockSet<attachAllUnattachedDevicesFromReqCbFn>::Set{
|
||||
std::ref(DeviceManager::getInstance().qutex)
|
||||
});
|
||||
|
||||
@@ -731,15 +731,15 @@ void DeviceManager::attachAllUnattachedDevicesFromKnownListReq(
|
||||
}
|
||||
|
||||
class DeviceManager::DetachAllAttachedDeviceRoles
|
||||
: public PostedAsynchronousContinuation<
|
||||
: public sscl::PostedAsynchronousContinuation<
|
||||
detachAllAttachedDeviceRolesCbFn>
|
||||
{
|
||||
public:
|
||||
DetachAllAttachedDeviceRoles(
|
||||
const unsigned int totalNSpecs,
|
||||
const std::shared_ptr<ComponentThread>& caller,
|
||||
Callback<detachAllAttachedDeviceRolesCbFn> cb)
|
||||
: PostedAsynchronousContinuation<detachAllAttachedDeviceRolesCbFn>(
|
||||
const std::shared_ptr<sscl::ComponentThread>& caller,
|
||||
sscl::Callback<detachAllAttachedDeviceRolesCbFn> cb)
|
||||
: sscl::PostedAsynchronousContinuation<detachAllAttachedDeviceRolesCbFn>(
|
||||
caller, cb),
|
||||
loop(totalNSpecs)
|
||||
{}
|
||||
@@ -788,21 +788,21 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
AsynchronousLoop loop;
|
||||
sscl::AsynchronousLoop loop;
|
||||
};
|
||||
|
||||
void DeviceManager::detachAllAttachedDeviceRoles(
|
||||
Callback<detachAllAttachedDeviceRolesCbFn> cb
|
||||
sscl::Callback<detachAllAttachedDeviceRolesCbFn> cb
|
||||
)
|
||||
{
|
||||
if (DeviceManager::getInstance().attachedDeviceRoles.size() == 0)
|
||||
{
|
||||
AsynchronousLoop tmp(0);
|
||||
sscl::AsynchronousLoop tmp(0);
|
||||
cb.callbackFn(tmp);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& caller = ComponentThread::getSelf();
|
||||
const auto& caller = sscl::ComponentThread::getSelf();
|
||||
auto request = std::make_shared<DetachAllAttachedDeviceRoles>(
|
||||
DeviceManager::getInstance().attachedDeviceRoles.size(),
|
||||
caller, std::move(cb));
|
||||
|
||||
Reference in New Issue
Block a user