[openrtm-commit:02405] r2930 - branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 2月 8日 (水) 13:45:47 JST
Author: n-ando
Date: 2017-02-08 13:45:46 +0900 (Wed, 08 Feb 2017)
New Revision: 2930
Modified:
branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/Manager.cpp
branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/RTObject.cpp
branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.cpp
branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.h
Log:
[incompat] SdoServiceAdmin configuration initialization function is added and init timing has been changed. refs #3883
Modified: branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/Manager.cpp
===================================================================
--- branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/Manager.cpp 2017-02-07 03:41:49 UTC (rev 2929)
+++ branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/Manager.cpp 2017-02-08 04:45:46 UTC (rev 2930)
@@ -832,6 +832,8 @@
"naming.enable",
"naming.type",
"naming.formats",
+ "sdo.service.provider.enabled_services",
+ "sdo.service.consumer.enabled_services",
""
};
Modified: branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/RTObject.cpp
===================================================================
--- branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/RTObject.cpp 2017-02-07 03:41:49 UTC (rev 2929)
+++ branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/RTObject.cpp 2017-02-08 04:45:46 UTC (rev 2930)
@@ -317,6 +317,9 @@
{
RTC_TRACE(("initialize()"));
+ // SDO service admin initialization
+ m_sdoservice.init(m_properties);
+
// EC creation
std::vector<coil::Properties> ec_args;
if (getContextOptions(ec_args) != RTC::RTC_OK)
Modified: branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.cpp
===================================================================
--- branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.cpp 2017-02-07 03:41:49 UTC (rev 2929)
+++ branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.cpp 2017-02-08 04:45:46 UTC (rev 2930)
@@ -67,24 +67,56 @@
{
RTC_TRACE(("SdoServiceAdmin::SdoServiceAdmin(%s)",
rtobj.getProperties()["instance_name"].c_str()));
+ }
- ::coil::Properties& prop(m_rtobj.getProperties());
+ /*!
+ * @if jp
+ * @brief 仮想デストラクタ
+ * @else
+ * @brief Virtual destractor
+ * @endif
+ */
+ SdoServiceAdmin::~SdoServiceAdmin()
+ {
+ for (size_t i(0); i < m_providers.size(); ++i)
+ {
+ m_providers[i]->finalize();
+ delete m_providers[i];
+ }
+ m_providers.clear();
+ for (size_t i(0); i < m_consumers.size(); ++i)
+ {
+ m_consumers[i]->finalize();
+ delete m_consumers[i];
+ }
+ m_consumers.clear();
+ }
+
+ void SdoServiceAdmin::init(const coil::Properties& prop)
+ {
+ initProvider(prop);
+ initConsumer(prop);
+ }
+
+ void SdoServiceAdmin::initProvider(const coil::Properties& prop)
+ {
//------------------------------------------------------------
// SDO service provider
- ::coil::vstring enabledProviderTypes
+ ::coil::vstring enabledProviderTypes
= ::coil::split(prop["sdo.service.provider.enabled_services"], ",", true);
RTC_DEBUG(("sdo.service.provider.enabled_services: %s",
prop["sdo.service.provider.enabled_services"].c_str()));
::coil::vstring availableProviderTypes
- = SdoServiceProviderFactory::instance().getIdentifiers();
- prop["sdo.service.provider.available_services"]
+ = SdoServiceProviderFactory::instance().getIdentifiers();
+ coil::Properties tmp;
+ tmp["sdo.service.provider.available_services"]
= coil::flatten(availableProviderTypes);
+ m_rtobj.setProperties(tmp);
RTC_DEBUG(("sdo.service.provider.available_services: %s",
- prop["sdo.service.provider.available_services"].c_str()));
+ tmp["sdo.service.provider.available_services"].c_str()));
-
// If types include '[Aa][Ll][Ll]', all types enabled in this RTC
::coil::vstring activeProviderTypes;
for (size_t i(0); i < enabledProviderTypes.size(); ++i)
@@ -117,13 +149,17 @@
prof.interface_type = CORBA::string_dup(activeProviderTypes[i].c_str());
prof.service = svc->_this();
std::string propkey = ifrToKey(activeProviderTypes[i]);
- NVUtil::copyFromProperties(prof.properties,
- prop.getNode(propkey.c_str()));
+ coil::Properties tmp;
+ tmp = const_cast<coil::Properties*>(&prop)->getNode(propkey.c_str());
+ NVUtil::copyFromProperties(prof.properties, tmp);
- svc->init(rtobj, prof);
+ svc->init(m_rtobj, prof);
m_providers.push_back(svc);
}
+ }
+ void SdoServiceAdmin::initConsumer(const coil::Properties& prop)
+ {
//------------------------------------------------------------
// SDO service consumer
// getting consumer types from RTC's properties
@@ -132,8 +168,10 @@
m_consumerTypes = ::coil::split(constypes, ",", true);
RTC_DEBUG(("sdo.service.consumer.enabled_services: %s", constypes.c_str()));
- prop["sdo.service.consumer.available_services"]
+ coil::Properties tmp;
+ tmp["sdo.service.consumer.available_services"]
= coil::flatten(SdoServiceConsumerFactory::instance().getIdentifiers());
+ m_rtobj.setProperties(tmp);
RTC_DEBUG(("sdo.service.consumer.available_services: %s",
prop["sdo.service.consumer.available_services"].c_str()));
@@ -152,30 +190,6 @@
/*!
* @if jp
- * @brief 仮想デストラクタ
- * @else
- * @brief Virtual destractor
- * @endif
- */
- SdoServiceAdmin::~SdoServiceAdmin()
- {
- for (size_t i(0); i < m_providers.size(); ++i)
- {
- m_providers[i]->finalize();
- delete m_providers[i];
- }
- m_providers.clear();
-
- for (size_t i(0); i < m_consumers.size(); ++i)
- {
- m_consumers[i]->finalize();
- delete m_consumers[i];
- }
- m_consumers.clear();
- }
-
- /*!
- * @if jp
* @brief SDO Service Provider の ServiceProfileList を取得する
* @else
* @brief Get ServiceProfileList of SDO Service Provider
Modified: branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.h
===================================================================
--- branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.h 2017-02-07 03:41:49 UTC (rev 2929)
+++ branches/DEV_IQ_2016/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.h 2017-02-08 04:45:46 UTC (rev 2930)
@@ -191,7 +191,18 @@
/*!
* @if jp
+ * @brief 初期化処理
*
+ * @else
+ * @brief Initialization
+ *
+ * @endif
+ */
+ virtual void init(const coil::Properties& prop);
+
+ /*!
+ * @if jp
+ *
* @brief SDO Service Provider の ServiceProfileList を取得する
*
* @else
@@ -308,7 +319,29 @@
protected:
/*!
* @if jp
+ * @brief Provider 初期化処理
*
+ * @else
+ * @brief Provider Initialization
+ *
+ * @endif
+ */
+ void initProvider(const coil::Properties& prop);
+ /*!
+ * @if jp
+ * @brief Consumer 初期化処理
+ *
+ * @else
+ * @brief Consumer Initialization
+ *
+ * @endif
+ */
+ void initConsumer(const coil::Properties& prop);
+
+
+ /*!
+ * @if jp
+ *
* @brief 許可されたサービス型かどうか調べる
*
* @else
More information about the openrtm-commit
mailing list