[openrtm-commit:03267] r3254 - branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2018年 3月 22日 (木) 13:47:28 JST
Author: t-katami
Date: 2018-03-22 13:47:28 +0900 (Thu, 22 Mar 2018)
New Revision: 3254
Modified:
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ManagerServant.cpp
Log:
[compat,bugfix] Fixed the bug. refs #4489
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ManagerServant.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ManagerServant.cpp 2018-03-22 01:43:51 UTC (rev 3253)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ManagerServant.cpp 2018-03-22 04:47:28 UTC (rev 3254)
@@ -1148,31 +1148,28 @@
RTC_TRACE(("createComponentByManagerName(%s)",create_arg.c_str()));
coil::mapstring param = coil::urlparam2map(create_arg);
-
-
-
for (coil::mapstring::iterator it(param.begin()); it != param.end(); ++it)
{
RTC_DEBUG(("create_arg[%s] = %s",
it->first.c_str(), it->second.c_str()));
}
-
-
+
std::string mgrstr = param["manager_name"];
-
if (mgrstr.empty())
{
RTC_WARN(("No manager_name found: %s", mgrstr.c_str()));
return RTC::RTObject::_nil();
}
-
-
+
+ CompParam comp_param(create_arg);
+
// detect languange
- std::string lang = param["language"];
+ //std::string lang = param["language"];
+ std::string lang = comp_param.language();
if (lang.empty()) { lang = "C++"; }
-
+
RTC_INFO(("Specified manager's language: %s", lang.c_str()));
-
+
RTM::Manager_var mgrobj = findManagerByName(mgrstr);
if (CORBA::is_nil(mgrobj))
{
@@ -1180,7 +1177,7 @@
RTC_INFO(("Creating new manager named %s", mgrstr.c_str()));
std::string rtcd_cmd_key("manager.modules.");
- rtcd_cmd_key += lang + "manager_cmd";
+ rtcd_cmd_key += lang + ".manager_cmd";
coil::Properties& prop = m_mgr.getConfig();
std::string rtcd_cmd = prop[rtcd_cmd_key];
@@ -1195,37 +1192,35 @@
rtcd_cmd += " -o manager.name:" + prop["manger.name"];
rtcd_cmd += " -o manager.instance_name:" + mgrstr;
+ coil::vstring slaves_names;
+ if (mgrstr == "manager_%p")
+ {
+ Guard gurad(m_slaveMutex);
+
+ for (CORBA::ULong i(0); i < m_slaves.length(); ++i)
+ {
+ try
+ {
+ RTM::NVList_var nvlist = m_slaves[i]->get_configuration();
+ coil::Properties prop;
+ NVUtil::copyToProperties(prop, nvlist);
+ std::string name = prop["manager.instance_name"];
+ if (isProcessIDManager(name))
+ {
+ slaves_names.push_back(name);
+ }
+ }
+ catch (...)
+ {
+ RTC_ERROR(("A slave manager thrown exception."));
+ CORBA_SeqUtil::erase(m_slaves, i);
+ RTC_ERROR(("This slave manager is removed from slave list."));
+ }
+ }
+ }
- coil::vstring slaves_names;
- if (mgrstr == "manager_%p")
- {
- Guard gurad(m_slaveMutex);
-
- for (CORBA::ULong i(0); i < m_slaves.length(); ++i)
- {
- try
- {
- RTM::NVList_var nvlist = m_slaves[i]->get_configuration();
- coil::Properties prop;
- NVUtil::copyToProperties(prop, nvlist);
- std::string name = prop["manager.instance_name"];
- if (isProcessIDManager(name))
- {
- slaves_names.push_back(name);
- }
- }
- catch (...)
- {
- RTC_ERROR(("A slave manager thrown exception."));
- CORBA_SeqUtil::erase(m_slaves, i);
- RTC_ERROR(("This slave manager is removed from slave list."));
- }
- }
- }
-
-
RTC_DEBUG(("Invoking command: %s.", rtcd_cmd.c_str()));
int ret(coil::launch_shell(rtcd_cmd.c_str()));
if (ret == -1)
@@ -1236,65 +1231,63 @@
for (size_t i(0); i < 1000; ++i)
{
- coil::sleep(coil::TimeValue(0.01));
- RTC_DEBUG(("Detecting new slave manager (%s).", mgrstr.c_str()));
- if (mgrstr == "manager_%p")
- {
- Guard gurad(m_slaveMutex);
-
- for (CORBA::ULong j(0); j < m_slaves.length(); ++j)
- {
- RTM::NVList_var nvlist = m_slaves[j]->get_configuration();
- coil::Properties prop;
- NVUtil::copyToProperties(prop, nvlist);
- std::string name = prop["manager.instance_name"];
-
- if (isProcessIDManager(name))
- {
- if (std::count(slaves_names.begin(), slaves_names.end(), name) == 0)
- {
- mgrobj = m_slaves[j];
- }
- }
- }
- }
- else
- {
- mgrobj = findManagerByName(mgrstr);
- }
- if (!CORBA::is_nil(mgrobj))
- {
- RTC_INFO(("New slave manager (%s) launched.", mgrstr.c_str()));
- break;
- }
+ coil::sleep(coil::TimeValue(0.01));
+ RTC_DEBUG(("Detecting new slave manager (%s).", mgrstr.c_str()));
+ if (mgrstr == "manager_%p")
+ {
+ Guard gurad(m_slaveMutex);
+ for (CORBA::ULong j(0); j < m_slaves.length(); ++j)
+ {
+ RTM::NVList_var nvlist = m_slaves[j]->get_configuration();
+ coil::Properties prop;
+ NVUtil::copyToProperties(prop, nvlist);
+ std::string name = prop["manager.instance_name"];
+
+ if (isProcessIDManager(name))
+ {
+ if (std::count(slaves_names.begin(), slaves_names.end(), name) == 0)
+ {
+ mgrobj = m_slaves[j];
+ }
+ }
+ }
+ }
+ else
+ {
+ mgrobj = findManagerByName(mgrstr);
+ }
+ if (!CORBA::is_nil(mgrobj))
+ {
+ RTC_INFO(("New slave manager (%s) launched.", mgrstr.c_str()));
+ break;
+ }
RTC_DEBUG(("Waiting for slave manager started."));
coil::sleep(0.01);
}
-
- if (CORBA::is_nil(mgrobj))
- {
- RTC_ERROR(("Launch failed: manager (%s)", mgrstr.c_str()));
- return RTC::RTObject::_nil();
- }
- std::string create_arg_str(create_arg);
- getParameterByModulename("manager_name", create_arg_str);
- RTC_DEBUG(("Creating component on %s", mgrstr.c_str()));
- RTC_DEBUG(("arg: %s", create_arg_str.c_str()));
- try
- {
- return mgrobj->create_component(create_arg_str.c_str());
- }
- catch (CORBA::SystemException& e)
- {
- RTC_ERROR(("Exception was caught while creating component."));
- return RTC::RTObject::_nil();
- }
- catch (...)
- {
- RTC_ERROR(("Unknown non-CORBA exception cought."));
- return RTC::RTObject::_nil();
- }
}
+ if (CORBA::is_nil(mgrobj))
+ {
+ RTC_ERROR(("Launch failed: manager (%s)", mgrstr.c_str()));
+ return RTC::RTObject::_nil();
+ }
+ std::string create_arg_str(create_arg);
+ getParameterByModulename("manager_name", create_arg_str);
+ RTC_DEBUG(("Creating component on %s", mgrstr.c_str()));
+ RTC_DEBUG(("arg: %s", create_arg_str.c_str()));
+ try
+ {
+ return mgrobj->create_component(create_arg_str.c_str());
+ }
+ catch (CORBA::SystemException& e)
+ {
+ RTC_ERROR(("Exception was caught while creating component."));
+ return RTC::RTObject::_nil();
+ }
+ catch (...)
+ {
+ RTC_ERROR(("Unknown non-CORBA exception cought."));
+ return RTC::RTObject::_nil();
+ }
return RTC::RTObject::_nil();
}
openrtm-commit メーリングリストの案内