Rename: DeviceSpec=>DAP Spec

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