[openrtm-commit:01342] r2524 - in trunk/OpenRTM-aist: etc src/lib/rtm

openrtm @ openrtm.org openrtm @ openrtm.org
2014年 3月 14日 (金) 12:17:27 JST


Author: n-ando
Date: 2014-03-14 12:17:27 +0900 (Fri, 14 Mar 2014)
New Revision: 2524

Modified:
   trunk/OpenRTM-aist/etc/rtc.conf.sample
   trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp
Log:
[compat,->RELENG_1_1] Module loader now accepts init func in parentheses. Module file extension is automatically supplied. rtc.conf.sample updated. refs #1607

Modified: trunk/OpenRTM-aist/etc/rtc.conf.sample
===================================================================
--- trunk/OpenRTM-aist/etc/rtc.conf.sample	2014-03-14 01:48:15 UTC (rev 2523)
+++ trunk/OpenRTM-aist/etc/rtc.conf.sample	2014-03-14 03:17:27 UTC (rev 2524)
@@ -225,11 +225,22 @@
 # Loadable modules, which is specified only as its file name, is searched
 # in each module load path specified in the "manager.modules.load_path".
 # If the "manager.modules.abs_path_allowed" option is YES, loadable file
-# can be specified as full-path name,
+# can be specified as full-path name.
 #
+# Module initialization function name is usually estimated module file
+# name.  If the module file name is ConsoleIn.so, the initialization
+# function name is set to "ConsleInInit." If you want to specify
+# specify the initialization function name, the initialization
+# function name in parenthesis after module file name can be
+# specified, like as "Hoge.so (ConsoleInInit)".  File extensions such
+# as ".so", ".dll", ".dylib" can be drop. If module file name without
+# file extension is specified, an extension specified in property
+# variable "manager.modules.C++.suffixes" is supplied.
+#
 # Valid settings:
 # manager.modules.preload: ConsoleIn.dll, ConsoleOut.dll
 # manager.modules.preload: ConsoleIn.so, ConsoleOut.so
+# manager.modules.preload: Hoge.so (ConsoleInInit), ConsoleOut
 # manager.modules.abs_path_allowed: YES
 # manager.modules.preload: /usr/lib/OpenRTM-aist/ConsoleIn.so
 #
@@ -268,7 +279,30 @@
 #
 manager.components.precreate: 
 
+#
+# Loading local service modules
+#
+# Local service mechanisms are provided for services provided among
+# components in the same process. Components can obtain and utilize
+# local services from the manager. By using this mechanism components
+# can share resources each other.
+#
+# Local service modules sometimes must be initialized before component
+# module loading and initialization. Loadable modules which is
+# specified in this option are previously loaded and initialized.
+#
+manager.local_service.modules: IEEE1394CameraService.so
 
+#
+# Specifying enabled local services
+#
+# All the loaded local service modules are activated and enabled in
+# default.  This option specify local serivces to be enabled when
+# manager enables local services.
+#
+manager.local_service.enabled_services: IEEE1394CameraService
+
+
 #============================================================
 # Logger configurations
 #============================================================

Modified: trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp	2014-03-14 01:48:15 UTC (rev 2523)
+++ trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp	2014-03-14 03:17:27 UTC (rev 2524)
@@ -271,11 +271,32 @@
 
     for (int i(0), len(lsvc.size()); i < len; ++i)
       {
-	std::string basename(coil::split(lsvc[i], ".").operator[](0));
-	basename += "Init";
+	size_t begin_pos(lsvc[i].find_first_of('('));
+	size_t end_pos(lsvc[i].find_first_of(')'));
+	std::string filename, initfunc;
+	if (begin_pos != std::string::npos && end_pos != std::string::npos &&
+	    begin_pos < end_pos)
+	  {
+	    initfunc = lsvc[i].substr(begin_pos + 1, end_pos - (begin_pos + 1));
+	    filename = lsvc[i].substr(0, begin_pos);
+	    coil::eraseBothEndsBlank(initfunc);
+	    coil::eraseBothEndsBlank(filename);
+	  }
+	else
+	  {
+	    initfunc = coil::split(lsvc[i], ".").operator[](0) + "Init";
+	    filename = lsvc[i];
+	  }
+	if (filename.find_first_of('.') == std::string::npos)
+	  {
+	    if (m_config.findNode("manager.modules.C++.suffixes") != 0)
+	      {
+		filename += "." + m_config["manager.modules.C++.suffixes"];
+	      }
+	  }
 	try
 	  {
-	    m_module->load(lsvc[i], basename);
+	    m_module->load(filename, initfunc);
 	  }
 	catch (ModuleManager::Error& e)
 	  {
@@ -302,11 +323,33 @@
 
     for (int i(0), len(mods.size()); i < len; ++i)
       {
-	std::string basename(coil::split(mods[i], ".").operator[](0));
-	basename += "Init";
+	size_t begin_pos(mods[i].find_first_of('('));
+	size_t end_pos(mods[i].find_first_of(')'));
+	std::string filename, initfunc;
+	if (begin_pos != std::string::npos && end_pos != std::string::npos &&
+	    begin_pos < end_pos)
+	  {
+	    initfunc = mods[i].substr(begin_pos + 1, end_pos - (begin_pos + 1));
+	    filename = mods[i].substr(0, begin_pos);
+	    coil::eraseBothEndsBlank(initfunc);
+	    coil::eraseBothEndsBlank(filename);
+	  }
+	else
+	  {
+	    initfunc = coil::split(mods[i], ".").operator[](0) + "Init";
+	    filename = mods[i];
+	  }
+	if (filename.find_first_of('.') == std::string::npos)
+	  {
+	    std::cout <<  m_config["manager.modules.C++.suffixes"] << std::endl;
+	    if (m_config.findNode("manager.modules.C++.suffixes") != 0)
+	      {
+		filename += "." + m_config["manager.modules.C++.suffixes"];
+	      }
+	  }
 	try
 	  {
-	    m_module->load(mods[i], basename);
+	    m_module->load(filename, initfunc);
 	  }
 	catch (ModuleManager::Error& e)
 	  {



More information about the openrtm-commit mailing list