[openrtm-commit:00144] r2155 - in trunk/OpenRTM-aist: etc src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2011年 5月 31日 (火) 18:32:18 JST
Author: n-ando
Date: 2011-05-31 18:32:17 +0900 (Tue, 31 May 2011)
New Revision: 2155
Modified:
trunk/OpenRTM-aist/etc/rtc.conf.sample
trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h
trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp
trunk/OpenRTM-aist/src/lib/rtm/RTObject.h
trunk/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.cpp
trunk/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.h
Log:
Some SdoServiceAdmin interfaces have been changed.
RTObject interfaces for SDO admin have been updated.
Modified: trunk/OpenRTM-aist/etc/rtc.conf.sample
===================================================================
--- trunk/OpenRTM-aist/etc/rtc.conf.sample 2011-05-31 05:45:47 UTC (rev 2154)
+++ trunk/OpenRTM-aist/etc/rtc.conf.sample 2011-05-31 09:32:17 UTC (rev 2155)
@@ -350,13 +350,13 @@
# SDO service settings
#============================================================
#
-# SDO service consumer settings
-#
-sdo.service.consumer.available_services: [read only]
-sdo.service.consumer.allowed_services: ALL
-#
# SDO service provider settings
#
sdo.service.provider.available_services: [read only]
-sdo.service.provider.allowed_services: ALL
+sdo.service.provider.enabled_services: ALL
sdo.service.provider.providing_services: [read only]
+#
+# SDO service consumer settings
+#
+sdo.service.consumer.available_services: [read only]
+sdo.service.consumer.enabled_services: ALL
Modified: trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h 2011-05-31 05:45:47 UTC (rev 2154)
+++ trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h 2011-05-31 09:32:17 UTC (rev 2155)
@@ -38,72 +38,74 @@
*/
static const char* default_config[] =
{
- "config.version", openrtm_version,
- "openrtm.name", openrtm_name,
- "openrtm.version", openrtm_version,
- "manager.instance_name", "manager",
- "manager.name", "manager",
- "manager.naming_formats", "%h.host_cxt/%n.mgr",
- "manager.pid", "",
- "manager.refstring_path", "/var/log/rtcmanager.ref",
- "os.name", "",
- "os.release", "",
- "os.version", "",
- "os.arch", "",
- "os.hostname", "",
- "logger.enable", "YES",
- "logger.file_name", "./rtc%p.log",
- "logger.date_format", "%b %d %H:%M:%S.%Q",
- "logger.log_level", "INFO",
- "logger.stream_lock", "NO",
- "logger.master_logger", "",
- "module.conf_path", "",
- "module.load_path", "",
- "naming.enable", "YES",
- "naming.type", "corba",
- "naming.formats", "%h.host_cxt/%n.rtc",
- "naming.update.enable", "YES",
- "naming.update.interval", "10.0",
- "timer.enable", "YES",
- "timer.tick", "0.1",
- "corba.args", "",
- "corba.endpoint", "", // hostname:port_number
- "corba.id", corba_name,
- "corba.nameservers", "localhost",
- "corba.master_manager", "localhost:2810",
- "corba.nameservice.replace_endpoint", "NO",
- "exec_cxt.periodic.type", "PeriodicExecutionContext",
- "exec_cxt.periodic.rate", "1000",
- "exec_cxt.evdriven.type", "EventDrivenExecutionContext",
- "manager.modules.load_path", "./",
- "manager.modules.abs_path_allowed", "YES",
- "manager.is_master", "NO",
- "manager.corba_servant", "YES",
- "manager.shutdown_on_nortcs", "YES",
- "manager.shutdown_auto", "YES",
- "manager.name", "manager",
- "manager.command", "rtcd",
- "manager.supported_languages", "C++, Python, Java",
- "manager.modules.C++.manager_cmd", "rtcd",
- "manager.modules.C++.profile_cmd", "rtcprof",
-#ifdef WIN32
- "manager.modules.C++.suffixes", "dll",
-#else
-#ifdef RTM_OS_DARWIN
- "manager.modules.C++.suffixes", "dylib",
-#else
- "manager.modules.C++.suffixes", "so",
-#endif
-#endif
- "manager.modules.C++.load_paths", "./",
- "manager.modules.Python.manager_cmd", "rtcd_python",
- "manager.modules.Python.profile_cmd", "rtcprof_python",
- "manager.modules.Python.suffixes", "py",
- "manager.modules.Python.load_paths", "./",
- "manager.modules.Java.manager_cmd", "rtcd_java",
- "manager.modules.Java.profile_cmd", "rtcprof_java",
- "manager.modules.Java.suffixes", "class",
- "manager.modules.Java.load_paths", "./",
+ "config.version", openrtm_version,
+ "openrtm.name", openrtm_name,
+ "openrtm.version", openrtm_version,
+ "manager.instance_name", "manager",
+ "manager.name", "manager",
+ "manager.naming_formats", "%h.host_cxt/%n.mgr",
+ "manager.pid", "",
+ "manager.refstring_path", "/var/log/rtcmanager.ref",
+ "os.name", "",
+ "os.release", "",
+ "os.version", "",
+ "os.arch", "",
+ "os.hostname", "",
+ "logger.enable", "YES",
+ "logger.file_name", "./rtc%p.log",
+ "logger.date_format", "%b %d %H:%M:%S.%Q",
+ "logger.log_level", "INFO",
+ "logger.stream_lock", "NO",
+ "logger.master_logger", "",
+ "module.conf_path", "",
+ "module.load_path", "",
+ "naming.enable", "YES",
+ "naming.type", "corba",
+ "naming.formats", "%h.host_cxt/%n.rtc",
+ "naming.update.enable", "YES",
+ "naming.update.interval", "10.0",
+ "timer.enable", "YES",
+ "timer.tick", "0.1",
+ "corba.args", "",
+ "corba.endpoint", "", // hostname:port_number
+ "corba.id", corba_name,
+ "corba.nameservers", "localhost",
+ "corba.master_manager", "localhost:2810",
+ "corba.nameservice.replace_endpoint", "NO",
+ "exec_cxt.periodic.type", "PeriodicExecutionContext",
+ "exec_cxt.periodic.rate", "1000",
+ "exec_cxt.evdriven.type", "EventDrivenExecutionContext",
+ "manager.modules.load_path", "./",
+ "manager.modules.abs_path_allowed", "YES",
+ "manager.is_master", "NO",
+ "manager.corba_servant", "YES",
+ "manager.shutdown_on_nortcs", "YES",
+ "manager.shutdown_auto", "YES",
+ "manager.name", "manager",
+ "manager.command", "rtcd",
+ "manager.supported_languages", "C++, Python, Java",
+ "manager.modules.C++.manager_cmd", "rtcd",
+ "manager.modules.C++.profile_cmd", "rtcprof",
+#ifdef WIN32
+ "manager.modules.C++.suffixes", "dll",
+#else
+#ifdef RTM_OS_DARWIN
+ "manager.modules.C++.suffixes", "dylib",
+#else
+ "manager.modules.C++.suffixes", "so",
+#endif
+#endif
+ "manager.modules.C++.load_paths", "./",
+ "manager.modules.Python.manager_cmd", "rtcd_python",
+ "manager.modules.Python.profile_cmd", "rtcprof_python",
+ "manager.modules.Python.suffixes", "py",
+ "manager.modules.Python.load_paths", "./",
+ "manager.modules.Java.manager_cmd", "rtcd_java",
+ "manager.modules.Java.profile_cmd", "rtcprof_java",
+ "manager.modules.Java.suffixes", "class",
+ "manager.modules.Java.load_paths", "./",
+ "sdo.service.provider.enabled_service", "ALL",
+ "sdo.service.consumer.enabled_service", "ALL",
""
};
Modified: trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp 2011-05-31 05:45:47 UTC (rev 2154)
+++ trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp 2011-05-31 09:32:17 UTC (rev 2155)
@@ -1914,6 +1914,57 @@
/*!
* @if jp
+ * @brief [local interface] SDO service provider をセットする
+ * @else
+ * @brief [local interface] Set a SDO service provider
+ * @endif
+ */
+ bool RTObject_impl::
+ addSdoServiceProvider(const SDOPackage::ServiceProfile& prof,
+ SdoServiceProviderBase* provider)
+ {
+ return m_sdoservice.addSdoServiceProvider(prof, provider);
+ }
+
+ /*!
+ * @if jp
+ * @brief [local interface] SDO service provider を削除する
+ * @else
+ * @brief [local interface] Remove a SDO service provider
+ * @endif
+ */
+ bool RTObject_impl::removeSdoServiceProvider(const char* id)
+ {
+ return m_sdoservice.removeSdoServiceProvider(id);
+ }
+
+ /*!
+ * @if jp
+ * @brief [local interface] SDO service provider をセットする
+ * @else
+ * @brief [local interface] Set a SDO service provider
+ * @endif
+ */
+ bool RTObject_impl::
+ addSdoServiceConsumer(const SDOPackage::ServiceProfile& prof)
+ {
+ return m_sdoservice.addSdoServiceConsumer(prof);
+ }
+
+ /*!
+ * @if jp
+ * @brief [local interface] SDO service provider を削除する
+ * @else
+ * @brief [local interface] Remove a SDO service provider
+ * @endif
+ */
+ bool RTObject_impl::removeSdoServiceConsumer(const char* id)
+ {
+ return m_sdoservice.removeSdoServiceConsumer(id);
+ }
+
+ /*!
+ * @if jp
* @brief 全 InPort のデータを読み込む。
* @return 読み込み結果(全ポートの読み込み成功:true,失敗:false)
* @else
Modified: trunk/OpenRTM-aist/src/lib/rtm/RTObject.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/RTObject.h 2011-05-31 05:45:47 UTC (rev 2154)
+++ trunk/OpenRTM-aist/src/lib/rtm/RTObject.h 2011-05-31 09:32:17 UTC (rev 2155)
@@ -3118,6 +3118,43 @@
/*!
* @if jp
+ * @brief [local interface] SDO service provider をセットする
+ * @else
+ * @brief [local interface] Set a SDO service provider
+ * @endif
+ */
+ bool addSdoServiceProvider(const SDOPackage::ServiceProfile& prof,
+ SdoServiceProviderBase* provider);
+
+ /*!
+ * @if jp
+ * @brief [local interface] SDO service provider を削除する
+ * @else
+ * @brief [local interface] Remove a SDO service provider
+ * @endif
+ */
+ bool removeSdoServiceProvider(const char* id);
+
+ /*!
+ * @if jp
+ * @brief [local interface] SDO service provider をセットする
+ * @else
+ * @brief [local interface] Set a SDO service provider
+ * @endif
+ */
+ bool addSdoServiceConsumer(const SDOPackage::ServiceProfile& prof);
+
+ /*!
+ * @if jp
+ * @brief [local interface] SDO service provider を削除する
+ * @else
+ * @brief [local interface] Remove a SDO service provider
+ * @endif
+ */
+ bool removeSdoServiceConsumer(const char* id);
+
+ /*!
+ * @if jp
*
* @brief 全 InPort のデータを読み込む。
*
Modified: trunk/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.cpp 2011-05-31 05:45:47 UTC (rev 2154)
+++ trunk/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.cpp 2011-05-31 09:32:17 UTC (rev 2155)
@@ -57,7 +57,7 @@
* @endif
*/
SdoServiceAdmin::SdoServiceAdmin(::RTC::RTObject_impl& rtobj)
- : m_rtobj(rtobj), m_allConsumerAllowed(true),
+ : m_rtobj(rtobj), m_allConsumerEnabled(true),
rtclog("SdoServiceAdmin")
{
RTC_TRACE(("SdoServiceAdmin::SdoServiceAdmin(%s)",
@@ -67,10 +67,10 @@
//------------------------------------------------------------
// SDO service provider
- ::coil::vstring allowedProviderTypes
- = ::coil::split(prop["sdo.service.provider.allowed_services"], ",", true);
- RTC_DEBUG(("sdo.service.provider.allowed_services: %s",
- prop["sdo.service.provider.allowed_services"].c_str()));
+ ::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();
@@ -80,21 +80,21 @@
prop["sdo.service.provider.available_services"].c_str()));
- // If types include '[Aa][Ll][Ll]', all types allowed in this RTC
+ // If types include '[Aa][Ll][Ll]', all types enabled in this RTC
::coil::vstring activeProviderTypes;
- for (size_t i(0); i < allowedProviderTypes.size(); ++i)
+ for (size_t i(0); i < enabledProviderTypes.size(); ++i)
{
- std::string tmp(allowedProviderTypes[i]);
+ std::string tmp(enabledProviderTypes[i]);
coil::toLower(tmp);
if (tmp == "all")
{
activeProviderTypes = availableProviderTypes;
- RTC_DEBUG(("sdo.service.provider.allowed_services: ALL"));
+ RTC_DEBUG(("sdo.service.provider.enabled_services: ALL"));
break;
}
for (size_t j(0); j < availableProviderTypes.size(); ++j)
{
- if (availableProviderTypes[j] == allowedProviderTypes[i])
+ if (availableProviderTypes[j] == enabledProviderTypes[i])
{
activeProviderTypes.push_back(availableProviderTypes[j]);
}
@@ -123,24 +123,24 @@
// SDO service consumer
// getting consumer types from RTC's properties
- ::std::string constypes = prop["sdo.service.consumer.allowed_services"];
+ ::std::string constypes = prop["sdo.service.consumer.enabled_services"];
m_consumerTypes = ::coil::split(constypes, ",", true);
- RTC_DEBUG(("sdo.service.consumer.allowed_services: %s", constypes.c_str()));
+ RTC_DEBUG(("sdo.service.consumer.enabled_services: %s", constypes.c_str()));
prop["sdo.service.consumer.available_services"]
= coil::flatten(SdoServiceConsumerFactory::instance().getIdentifiers());
RTC_DEBUG(("sdo.service.consumer.available_services: %s",
prop["sdo.service.consumer.available_services"].c_str()));
- // If types include '[Aa][Ll][Ll]', all types allowed in this RTC
+ // If types include '[Aa][Ll][Ll]', all types enabled in this RTC
for (size_t i(0); i < m_consumerTypes.size(); ++i)
{
std::string tmp(m_consumerTypes[i]);
coil::toLower(tmp);
if (tmp == "all")
{
- m_allConsumerAllowed = true;
- RTC_DEBUG(("sdo.service.consumer.allowed_services: ALL"));
+ m_allConsumerEnabled = true;
+ RTC_DEBUG(("sdo.service.consumer.enabled_services: ALL"));
}
}
}
@@ -230,6 +230,69 @@
/*!
* @if jp
+ * @brief SDO service provider をセットする
+ * @else
+ * @brief Set a SDO service provider
+ * @endif
+ */
+ bool SdoServiceAdmin::
+ addSdoServiceProvider(const SDOPackage::ServiceProfile& prof,
+ SdoServiceProviderBase* provider)
+ {
+ RTC_TRACE(("SdoServiceAdmin::addSdoServiceProvider(if=%s)",
+ static_cast<const char*>(prof.interface_type)));
+ Guard guard(m_provider_mutex);
+
+ std::string id(static_cast<const char*>(prof.id));
+ for (size_t i(0); i < m_providers.size(); ++i)
+ {
+ if (id == static_cast<const char*>(m_providers[i]->getProfile().id))
+ {
+ RTC_ERROR(("SDO service(id=%s, ifr=%s) already exists",
+ static_cast<const char*>(prof.id),
+ static_cast<const char*>(prof.interface_type)));
+ return false;
+ }
+ }
+ m_providers.push_back(provider);
+ return true;
+ }
+
+ /*!
+ * @if jp
+ * @brief SDO service provider を削除する
+ * @else
+ * @brief Remove a SDO service provider
+ * @endif
+ */
+ bool SdoServiceAdmin::removeSdoServiceProvider(const char* id)
+ {
+ RTC_TRACE(("removeSdoServiceProvider(%d)", id));
+ Guard gurad(m_provider_mutex);
+
+ std::string strid(id);
+ std::vector<SdoServiceProviderBase*>::iterator it = m_providers.begin();
+ std::vector<SdoServiceProviderBase*>::iterator it_end = m_providers.end();
+ while (it != it_end)
+ {
+ if (strid == static_cast<const char*>((*it)->getProfile().id))
+ {
+ (*it)->finalize();
+ SdoServiceProviderFactory&
+ factory(SdoServiceProviderFactory::instance());
+ factory.deleteObject(*it);
+ m_providers.erase(it);
+ RTC_INFO(("SDO service provider has been deleted: %s", id));
+ return true;
+ }
+ ++it;
+ }
+ RTC_WARN(("Specified SDO service provider not found: %s", id));
+ return false;
+ }
+
+ /*!
+ * @if jp
* @brief Service Consumer を追加する
* @else
* @brief Add Service Consumer
@@ -243,7 +306,7 @@
static_cast<const char*>(sProfile.interface_type)));
// Not supported consumer type -> error return
- if (!isAllowedConsumerType(sProfile)) { return false; }
+ if (!isEnabledConsumerType(sProfile)) { return false; }
if (!isExistingConsumerType(sProfile)) { return false; }
RTC_DEBUG(("Valid SDO service required"));
if (strncmp(sProfile.id, "", 1) == 0)
@@ -352,13 +415,13 @@
* @if jp
* @brief 許可されたサービス型かどうか調べる
* @else
- * @brief If it is allowed service type
+ * @brief If it is enabled service type
* @endif
*/
bool SdoServiceAdmin::
- isAllowedConsumerType(const SDOPackage::ServiceProfile& sProfile)
+ isEnabledConsumerType(const SDOPackage::ServiceProfile& sProfile)
{
- if (m_allConsumerAllowed) { return true; }
+ if (m_allConsumerEnabled) { return true; }
for (size_t i(0); i < m_consumerTypes.size(); ++i)
{
Modified: trunk/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.h 2011-05-31 05:45:47 UTC (rev 2154)
+++ trunk/OpenRTM-aist/src/lib/rtm/SdoServiceAdmin.h 2011-05-31 09:32:17 UTC (rev 2155)
@@ -259,6 +259,25 @@
/*!
* @if jp
+ * @brief SDO service provider をセットする
+ * @else
+ * @brief Set a SDO service provider
+ * @endif
+ */
+ bool addSdoServiceProvider(const SDOPackage::ServiceProfile& prof,
+ SdoServiceProviderBase* provider);
+
+ /*!
+ * @if jp
+ * @brief SDO service provider を削除する
+ * @else
+ * @brief Remove a SDO service provider
+ * @endif
+ */
+ bool removeSdoServiceProvider(const char* id);
+
+ /*!
+ * @if jp
*
* @brief Service Consumer を追加する
*
@@ -291,11 +310,11 @@
*
* @else
*
- * @brief If it is allowed service type
+ * @brief If it is enabled service type
*
* @endif
*/
- bool isAllowedConsumerType(const SDOPackage::ServiceProfile& sProfile);
+ bool isEnabledConsumerType(const SDOPackage::ServiceProfile& sProfile);
/*!
* @if jp
@@ -318,7 +337,7 @@
private:
RTC::RTObject_impl& m_rtobj;
coil::vstring m_consumerTypes;
- bool m_allConsumerAllowed;
+ bool m_allConsumerEnabled;
/*!
* @if jp
openrtm-commit メーリングリストの案内