[openrtm-commit:02585] r2986 - trunk/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 4月 19日 (水) 04:12:33 JST
Author: n-ando
Date: 2017-04-19 04:12:33 +0900 (Wed, 19 Apr 2017)
New Revision: 2986
Modified:
trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp
Log:
[incompat,newfunc] To extend the RTC numbering policy, base class has been introduced. refs #3273
Modified: trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp 2017-04-18 19:11:22 UTC (rev 2985)
+++ trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp 2017-04-18 19:12:33 UTC (rev 2986)
@@ -43,6 +43,7 @@
#include <rtm/LocalServiceAdmin.h>
#include <rtm/SystemLogger.h>
#include <rtm/LogstreamBase.h>
+#include <rtm/NumberingPolicyBase.h>
#ifdef RTM_OS_LINUX
#ifndef _GNU_SOURCE
@@ -635,25 +636,37 @@
* @endif
*/
bool Manager::registerFactory(coil::Properties& profile,
- RtcNewFunc new_func,
- RtcDeleteFunc delete_func)
+ RtcNewFunc new_func,
+ RtcDeleteFunc delete_func)
{
RTC_TRACE(("Manager::registerFactory(%s)", profile["type_name"].c_str()));
+
+ std::string policy_name =
+ m_config.getProperty("manager.components.naming_policy", "default");
+ RTM::NumberingPolicyBase* policy =
+ RTM::NumberingPolicyFactory::instance().createObject(policy_name);
FactoryBase* factory;
- factory = new FactoryCXX(profile, new_func, delete_func);
+ if (policy == NULL)
+ {
+ factory = new FactoryCXX(profile, new_func, delete_func);
+ }
+ else
+ {
+ factory = new FactoryCXX(profile, new_func, delete_func, policy);
+ }
try
- {
- bool ret = m_factory.registerObject(factory);
- if (!ret) {
- delete factory;
- return false;
- }
- return true;
+ {
+ bool ret = m_factory.registerObject(factory);
+ if (!ret) {
+ delete factory;
+ return false;
+ }
+ return true;
}
catch (...)
{
- delete factory;
- return false;
+ delete factory;
+ return false;
}
}
openrtm-commit メーリングリストの案内