Rename: DeviceSpec=>DAP Spec
This commit is contained in:
@@ -13,13 +13,13 @@
|
|||||||
namespace smo {
|
namespace smo {
|
||||||
namespace device {
|
namespace device {
|
||||||
|
|
||||||
std::string DeviceManager::readDeviceSpecFile(const std::string& filename)
|
std::string DeviceManager::readDapSpecFile(const std::string& filename)
|
||||||
{
|
{
|
||||||
std::ifstream file(filename);
|
std::ifstream file(filename);
|
||||||
if (!file.is_open())
|
if (!file.is_open())
|
||||||
{
|
{
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
std::string(__func__) + ": Couldn't open deviceSpec file: "
|
std::string(__func__) + ": Couldn't open DAP spec file: "
|
||||||
+ filename);
|
+ filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,39 +30,39 @@ std::string DeviceManager::readDeviceSpecFile(const std::string& filename)
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::collateAllDeviceSpecs(void)
|
void DeviceManager::collateAllDapSpecs(void)
|
||||||
{
|
{
|
||||||
OptionParser &options = OptionParser::getOptions();
|
OptionParser &options = OptionParser::getOptions();
|
||||||
allDeviceSpecs = options.deviceSpecs;
|
allDapSpecs = options.dapSpecs;
|
||||||
|
|
||||||
for (const auto& file : options.deviceSpecFiles)
|
for (const auto& file : options.dapSpecFiles)
|
||||||
{
|
{
|
||||||
std::string fileContent = readDeviceSpecFile(file);
|
std::string fileContent = readDapSpecFile(file);
|
||||||
if (!allDeviceSpecs.empty()) {
|
if (!allDapSpecs.empty()) {
|
||||||
allDeviceSpecs += "||";
|
allDapSpecs += "||";
|
||||||
}
|
}
|
||||||
allDeviceSpecs += fileContent;
|
allDapSpecs += fileContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::parseAllDeviceSpecs(void)
|
void DeviceManager::parseAllDapSpecs(void)
|
||||||
{
|
{
|
||||||
std::unique_ptr<FILE, decltype(&fclose)> input(
|
std::unique_ptr<FILE, decltype(&fclose)> input(
|
||||||
fmemopen((void*)allDeviceSpecs.c_str(), allDeviceSpecs.size(), "r"),
|
fmemopen((void*)allDapSpecs.c_str(), allDapSpecs.size(), "r"),
|
||||||
&fclose);
|
&fclose);
|
||||||
|
|
||||||
if (!input)
|
if (!input)
|
||||||
{
|
{
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
std::string(__func__) + ": Failed to fmemopen() a FILE* for "
|
std::string(__func__) + ": Failed to fmemopen() a FILE* for "
|
||||||
"parsing device specs");
|
"parsing DAP specs");
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceAttachmentPipeSpeclin = input.get();
|
deviceAttachmentPipeSpeclin = input.get();
|
||||||
if (deviceAttachmentPipeSpecpparse())
|
if (deviceAttachmentPipeSpecpparse())
|
||||||
{
|
{
|
||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
std::string(__func__) + ": Failed to parse device specs. "
|
std::string(__func__) + ": Failed to parse DAP specs. "
|
||||||
"Check specs for errors");
|
"Check specs for errors");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ public:
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string readDeviceSpecFile(const std::string& filename);
|
std::string readDapSpecFile(const std::string& filename);
|
||||||
void collateAllDeviceSpecs(void);
|
void collateAllDapSpecs(void);
|
||||||
void parseAllDeviceSpecs(void);
|
void parseAllDapSpecs(void);
|
||||||
static const std::string stringifyDeviceSpecs(void);
|
static const std::string stringifyDeviceSpecs(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -33,7 +33,7 @@ private:
|
|||||||
DeviceManager& operator=(const DeviceManager&) = delete;
|
DeviceManager& operator=(const DeviceManager&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string allDeviceSpecs;
|
std::string allDapSpecs;
|
||||||
static std::vector<std::shared_ptr<InteroceptorDevAttachmentSpec>>
|
static std::vector<std::shared_ptr<InteroceptorDevAttachmentSpec>>
|
||||||
interoceptorDeviceSpecs;
|
interoceptorDeviceSpecs;
|
||||||
static std::vector<std::shared_ptr<ExtrospectorDevAttachmentSpec>>
|
static std::vector<std::shared_ptr<ExtrospectorDevAttachmentSpec>>
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ public:
|
|||||||
std::string argv0;
|
std::string argv0;
|
||||||
std::vector<std::string> senseApiLibPath;
|
std::vector<std::string> senseApiLibPath;
|
||||||
std::vector<std::string> senseApiLibs;
|
std::vector<std::string> senseApiLibs;
|
||||||
std::string deviceSpecs;
|
std::string dapSpecs;
|
||||||
std::vector<std::string> deviceSpecFiles;
|
std::vector<std::string> dapSpecFiles;
|
||||||
bool verbose, printUsage;
|
bool verbose, printUsage;
|
||||||
|
|
||||||
static struct option longOptions[];
|
static struct option longOptions[];
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ void initializeSalmanoff(void)
|
|||||||
{
|
{
|
||||||
std::cout << __func__ << ": Entered." << std::endl;
|
std::cout << __func__ << ": Entered." << std::endl;
|
||||||
|
|
||||||
device::DeviceManager::getInstance().collateAllDeviceSpecs();
|
device::DeviceManager::getInstance().collateAllDapSpecs();
|
||||||
device::DeviceManager::getInstance().parseAllDeviceSpecs();
|
device::DeviceManager::getInstance().parseAllDapSpecs();
|
||||||
std::cout << device::DeviceManager::stringifyDeviceSpecs() << std::endl;
|
std::cout << device::DeviceManager::stringifyDeviceSpecs() << std::endl;
|
||||||
sense_api::SenseApiManager::getInstance().loadAllSenseApiLibsFromOptions();
|
sense_api::SenseApiManager::getInstance().loadAllSenseApiLibsFromOptions();
|
||||||
std::cout << sense_api::SenseApiManager::getInstance().stringifyLibs()
|
std::cout << sense_api::SenseApiManager::getInstance().stringifyLibs()
|
||||||
|
|||||||
+7
-7
@@ -65,13 +65,13 @@ void OptionParser::parseArguments(int argc, char *argv[], char **envp)
|
|||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
case 's':
|
case 's':
|
||||||
if (!deviceSpecs.empty()) {
|
if (!dapSpecs.empty()) {
|
||||||
deviceSpecs += "||";
|
dapSpecs += "||";
|
||||||
}
|
}
|
||||||
deviceSpecs += std::string(optarg);
|
dapSpecs += std::string(optarg);
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
deviceSpecFiles.push_back(optarg);
|
dapSpecFiles.push_back(optarg);
|
||||||
break;
|
break;
|
||||||
case 'a':
|
case 'a':
|
||||||
senseApiLibs.push_back(optarg);
|
senseApiLibs.push_back(optarg);
|
||||||
@@ -121,10 +121,10 @@ std::string OptionParser::stringifyOptions(void) const
|
|||||||
oss << "Verbose mode is on" << std::endl;
|
oss << "Verbose mode is on" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
oss << "Device Specs: " << deviceSpecs << std::endl;
|
oss << "DAP Specs: " << dapSpecs << std::endl;
|
||||||
|
|
||||||
oss << "Device Spec Files: ";
|
oss << "DAP Spec Files: ";
|
||||||
for (const auto& file : deviceSpecFiles) {
|
for (const auto& file : dapSpecFiles) {
|
||||||
oss << file << " ";
|
oss << file << " ";
|
||||||
}
|
}
|
||||||
oss << std::endl;
|
oss << std::endl;
|
||||||
|
|||||||
Reference in New Issue
Block a user