DAP.yy: use cmdlineDASpecs; DevMgr: add attachAllUnattachedDevicesFromCmdlineReq

This method wraps around attachAllUnattachedDevicesFromReq and supplies
it with a sh_ptr<> collection of all DASpecs parsed by the DAP parser
from the cmdline.

The initialization sequence now correctly initializes all DAP specs
given on the cmdline again.
This commit is contained in:
2025-09-28 12:52:59 -04:00
parent b43ffcb677
commit e45a9ee5d1
4 changed files with 18 additions and 4 deletions
+2 -2
View File
@@ -78,8 +78,8 @@ public:
std::cout << __func__ << ": About to attachAllSenseDevicesFromSpecs"
<< '\n';
}
device::DeviceManager::getInstance().attachAllUnattachedDevicesFromReq(
std::make_shared<std::vector<device::DeviceAttachmentSpec>>(),
device::DeviceManager::getInstance()
.attachAllUnattachedDevicesFromCmdlineReq(
{context, std::bind(
&InitializeReq::initializeReq2,
context.get(), context,
@@ -87,7 +87,7 @@ interoceptor_spec:
*static_cast<smo::device::InteroceptorDevAttachmentSpec *>($3));
spec->sensorType = $1;
smo::device::DeviceManager::deviceAttachmentSpecs.push_back(spec);
smo::device::DeviceManager::commandLineDASpecs.push_back(*spec);
delete $3;
}
@@ -99,7 +99,7 @@ extrospector_spec:
*static_cast<smo::device::ExtrospectorDevAttachmentSpec *>($3));
spec->sensorType = $1;
smo::device::DeviceManager::deviceAttachmentSpecs.push_back(spec);
smo::device::DeviceManager::commandLineDASpecs.push_back(*spec);
delete $3;
}
+11
View File
@@ -23,6 +23,8 @@ std::vector<std::shared_ptr<Device>>
DeviceManager::devices;
std::vector<std::shared_ptr<DeviceRole>>
DeviceManager::attachedDeviceRoles;
std::vector<DeviceAttachmentSpec>
DeviceManager::commandLineDASpecs;
const std::string DeviceManager::stringifyDeviceSpecs(void)
{
@@ -573,6 +575,15 @@ void DeviceManager::attachAllUnattachedDevicesFromReq(
request.get(), request));
}
void DeviceManager::attachAllUnattachedDevicesFromCmdlineReq(
Callback<attachAllUnattachedDevicesFromReqCbFn> cb
)
{
auto specs = std::make_shared<std::vector<DeviceAttachmentSpec>>(
commandLineDASpecs);
attachAllUnattachedDevicesFromReq(specs, std::move(cb));
}
class DeviceManager::DetachAllAttachedDeviceRoles
: public PostedAsynchronousContinuation<
detachAllAttachedDeviceRolesCbFn>
@@ -73,6 +73,8 @@ public:
void attachAllUnattachedDevicesFromReq(
const std::shared_ptr<std::vector<DeviceAttachmentSpec>> &specs,
Callback<attachAllUnattachedDevicesFromReqCbFn> cb);
void attachAllUnattachedDevicesFromCmdlineReq(
Callback<attachAllUnattachedDevicesFromReqCbFn> cb);
void detachAllAttachedDeviceRoles(
Callback<detachAllAttachedDeviceRolesCbFn> cb);
@@ -91,6 +93,7 @@ public:
deviceAttachmentSpecs;
static std::vector<std::shared_ptr<Device>> devices;
static std::vector<std::shared_ptr<DeviceRole>> attachedDeviceRoles;
static std::vector<DeviceAttachmentSpec> commandLineDASpecs;
private:
class NewDeviceAttachmentSpecInd;