Add stringifiers to SenseApi related classes
This commit is contained in:
@@ -51,6 +51,15 @@ public:
|
||||
std::string name;
|
||||
// These are the implexors whose APIs this lib exports.
|
||||
std::vector<ExportedImplexorApiDesc> exportedImplexorApis;
|
||||
|
||||
std::string stringify() const {
|
||||
std::string result = "Name: " + name + "\n";
|
||||
result += "Exported Implexor APIs:\n";
|
||||
for (const auto& api : exportedImplexorApis) {
|
||||
result += " - " + api.name + "\n";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
class SenseApiLib
|
||||
@@ -111,6 +120,12 @@ public:
|
||||
* descriptor.
|
||||
*/
|
||||
SenseApiDesc senseApiDesc;
|
||||
|
||||
std::string stringify() const {
|
||||
std::string result = "Library Path: " + libraryPath + "\n";
|
||||
result += "Sense API Descriptor: " + senseApiDesc.stringify() + "\n";
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace sense_api
|
||||
|
||||
@@ -26,6 +26,8 @@ public:
|
||||
void unloadSenseApiLib(const std::string& libraryPath);
|
||||
void loadAllSenseApiLibsFromOptions(void);
|
||||
|
||||
std::string stringifyLibs() const;
|
||||
|
||||
private:
|
||||
SenseApiManager() = default;
|
||||
~SenseApiManager() = default;
|
||||
|
||||
@@ -151,5 +151,14 @@ void SenseApiManager::loadAllSenseApiLibsFromOptions()
|
||||
}
|
||||
}
|
||||
|
||||
std::string SenseApiManager::stringifyLibs() const
|
||||
{
|
||||
std::string result;
|
||||
for (const auto& lib : senseApiLibs) {
|
||||
result += lib->stringify() + "\n";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace sense_api
|
||||
} // namespace hk
|
||||
|
||||
@@ -90,6 +90,8 @@ static int initializeHarikoff(int argc, char **argv, char **envp)
|
||||
DeviceManager::getInstance().parseAllDeviceSpecs();
|
||||
std::cout << DeviceManager::stringifyDeviceSpecs() << std::endl;
|
||||
sense_api::SenseApiManager::getInstance().loadAllSenseApiLibsFromOptions();
|
||||
std::cout << sense_api::SenseApiManager::getInstance().stringifyLibs()
|
||||
<< std::endl;
|
||||
|
||||
/* Start the threads */
|
||||
for (const auto& [id, componentThread]
|
||||
|
||||
Reference in New Issue
Block a user