Skip to content

Commit

Permalink
Merge pull request #1138 from Nobu19800/bugs/loadcomponent
Browse files Browse the repository at this point in the history
createComponent関数で同一名のモジュールを区別できない問題の修正
  • Loading branch information
n-ando authored Apr 16, 2024
2 parents 0cf13a9 + ac91196 commit e6f6397
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/lib/rtm/Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -695,14 +695,14 @@ std::vector<coil::Properties> Manager::getLoadableModules()
comp_id["implementation_id"].c_str()));
return nullptr;
}
if (it->findNode("module_file_name") == nullptr)
if (it->findNode("module_file_path") == nullptr)
{
RTC_ERROR(("Hmm...module_file_name key not found."));
RTC_ERROR(("Hmm...module_file_path key not found."));
return nullptr;
}
// module loading
RTC_INFO(("Loading module: %s", (*it)["module_file_name"].c_str()));
load((*it)["module_file_name"], "");
RTC_INFO(("Loading module: %s", (*it)["module_file_path"].c_str()));
load((*it)["module_file_path"], "");
factory = m_factory.find(comp_id);
if (factory == nullptr)
{
Expand Down
12 changes: 9 additions & 3 deletions src/lib/rtm/Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2222,21 +2222,23 @@ namespace RTC
{
public:
explicit FactoryPredicate(const char* imple_id)
: m_vendor(""), m_category(""), m_impleid(imple_id), m_version("")
: m_vendor(""), m_category(""), m_impleid(imple_id), m_version(""), m_language("")
{
}
explicit FactoryPredicate(const coil::Properties& prop)
: m_vendor(prop["vendor"]),
m_category(prop["category"]),
m_impleid(prop["implementation_id"]),
m_version(prop["version"])
m_version(prop["version"]),
m_language(prop["language"])
{
}
explicit FactoryPredicate(FactoryBase* factory)
: m_vendor(factory->profile()["vendor"]),
m_category(factory->profile()["category"]),
m_impleid(factory->profile()["implementation_id"]),
m_version(factory->profile()["version"])
m_version(factory->profile()["version"]),
m_language(factory->profile()["language"])
{
}
~FactoryPredicate();
Expand All @@ -2255,6 +2257,9 @@ namespace RTC
return false;
if (!m_version.empty() && m_version != prop["version"])
return false;
if (!m_language.empty() && m_language != prop["language"])
return false;


return true;
}
Expand All @@ -2263,6 +2268,7 @@ namespace RTC
std::string m_category;
std::string m_impleid;
std::string m_version;
std::string m_language;
};

class ModulePredicate
Expand Down

0 comments on commit e6f6397

Please sign in to comment.