DevMgr: Add sensorDevSpecs list and make intero/extro lists use unique_ptr
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <stdexcept>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <deviceManager/deviceManager.h>
|
||||
|
||||
#ifndef yylex
|
||||
@@ -70,23 +72,25 @@ sensor_spec:
|
||||
|
||||
interoceptor_spec:
|
||||
KEYWORD_SPECTYPE_INTEROSPECTOR PIPE spec_body {
|
||||
DeviceManager::InteroceptorDeviceSpec *spec =
|
||||
static_cast<DeviceManager::InteroceptorDeviceSpec *>($3);
|
||||
auto spec = std::make_unique<DeviceManager::InteroceptorDeviceSpec>(
|
||||
*static_cast<DeviceManager::InteroceptorDeviceSpec *>($3));
|
||||
|
||||
spec->sensorType = $1;
|
||||
DeviceManager::interoceptorDeviceSpecs.push_back(*spec);
|
||||
delete spec;
|
||||
DeviceManager::interoceptorDeviceSpecs.push_back(std::move(spec));
|
||||
DeviceManager::sensorDeviceSpecs.push_back(*spec);
|
||||
delete $3;
|
||||
}
|
||||
;
|
||||
|
||||
extrospector_spec:
|
||||
KEYWORD_SPECTYPE_EXTROSPECTOR PIPE spec_body {
|
||||
DeviceManager::ExtrospectorDeviceSpec *spec =
|
||||
static_cast<DeviceManager::ExtrospectorDeviceSpec *>($3);
|
||||
auto spec = std::make_unique<DeviceManager::ExtrospectorDeviceSpec>(
|
||||
*static_cast<DeviceManager::ExtrospectorDeviceSpec *>($3));
|
||||
|
||||
spec->sensorType = $1;
|
||||
DeviceManager::extrospectorDeviceSpecs.push_back(*spec);
|
||||
delete spec;
|
||||
DeviceManager::extrospectorDeviceSpecs.push_back(std::move(spec));
|
||||
DeviceManager::sensorDeviceSpecs.push_back(*spec);
|
||||
delete $3;
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user