senseApiMgr: new method: loadAllSenseApisFromOptions
This method dlopens() all senseApi libs that were referenced by device specs.
This commit is contained in:
@@ -24,6 +24,7 @@ public:
|
||||
std::optional<std::reference_wrapper<SenseApiLib>> getSenseApiLib(
|
||||
const std::string& libraryPath);
|
||||
void unloadSenseApiLib(const std::string& libraryPath);
|
||||
void loadAllSenseApiLibsFromOptions(void);
|
||||
|
||||
private:
|
||||
SenseApiManager() = default;
|
||||
|
||||
@@ -116,5 +116,13 @@ void SenseApiManager::unloadSenseApiLib(const std::string& libraryPath)
|
||||
<< libraryPath << '\n';
|
||||
}
|
||||
|
||||
void SenseApiManager::loadAllSenseApiLibsFromOptions()
|
||||
{
|
||||
const auto& options = OptionParser::getOptions();
|
||||
for (const auto& libPath : options.senseApiLibs) {
|
||||
loadSenseApiLib(libPath);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace sense_api
|
||||
} // namespace hk
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
#include <opts.h>
|
||||
#include <mind.h>
|
||||
#include <deviceManager/deviceManager.h>
|
||||
#include <senseApis/senseApiManager.h>
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
using namespace hk;
|
||||
|
||||
try {
|
||||
OptionParser &options = OptionParser::getOptions();
|
||||
hk::Mind mind;
|
||||
@@ -30,6 +33,7 @@ try {
|
||||
DeviceManager::getInstance().collateAllDeviceSpecs(options);
|
||||
DeviceManager::getInstance().parseAllDeviceSpecs();
|
||||
std::cout << DeviceManager::printDeviceSpecs() << std::endl;
|
||||
sense_api::SenseApiManager::getInstance().loadAllSenseApiLibsFromOptions();
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
std::cerr << "Exception occurred: " << e.what() << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user