[openrtm-commit:03311] r3277 - in trunk/OpenRTM-aist: src/lib/rtm win32/OpenRTM-aist/bin

openrtm @ openrtm.org openrtm @ openrtm.org
2018年 3月 28日 (水) 14:04:53 JST


Author: miyamoto
Date: 2018-03-28 14:04:53 +0900 (Wed, 28 Mar 2018)
New Revision: 3277

Modified:
   trunk/OpenRTM-aist/src/lib/rtm/ManagerConfig.cpp
   trunk/OpenRTM-aist/src/lib/rtm/ManagerConfig.h
   trunk/OpenRTM-aist/src/lib/rtm/ManagerServant.cpp
   trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp
   trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.h
   trunk/OpenRTM-aist/win32/OpenRTM-aist/bin/rtm-naming.bat
Log:
[merge] r3226-3232 have been merged from RELENG_1_2.

Modified: trunk/OpenRTM-aist/src/lib/rtm/ManagerConfig.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/ManagerConfig.cpp	2018-03-28 04:59:47 UTC (rev 3276)
+++ trunk/OpenRTM-aist/src/lib/rtm/ManagerConfig.cpp	2018-03-28 05:04:53 UTC (rev 3277)
@@ -24,6 +24,7 @@
 #include <coil/OS.h>
 #include <coil/stringutil.h>
 #include <rtm/DefaultConfiguration.h>
+#include <stdlib.h>
 
 #ifdef __QNX__
 using std::sprintf;
@@ -34,12 +35,12 @@
   
   // The list of default configuration file path.
 #ifdef RTM_OS_WIN32
-	const char* ManagerConfig::config_file_path[] = 
-	{
-		"./rtc.conf",
-		"${RTM_ROOT}bin/${RTM_VC_VERSION}/rtc.conf",
-		NULL
-	};
+  const char* ManagerConfig::config_file_path[] = 
+    {
+      "./rtc.conf",
+      "${RTM_ROOT}bin/${RTM_VC_VERSION}/rtc.conf",
+      NULL
+    };
 #else
   const char* ManagerConfig::config_file_path[] = 
     {
@@ -115,16 +116,16 @@
     prop.setDefaults(default_config);
     if (findConfigFile())
       {
-	std::ifstream f(m_configFile.c_str());
-	if (f.is_open())
-	  {
-	    prop.load(f);
-	    f.close();
-	  }
+        std::ifstream f(m_configFile.c_str());
+        if (f.is_open())
+          {
+            prop.load(f);
+            f.close();
+          }
       }
     setSystemInformation(prop);
     if (m_isMaster) { prop["manager.is_master"] = "YES"; }
-
+    
     // Properties from arguments are marged finally
     prop << m_argprop;
     prop["config_file"] = m_configFile;
@@ -146,30 +147,44 @@
     
     while ((opt = get_opts()) > 0)
       {
-	switch (opt)
-	  {
+        switch (opt)
+          {
           case 'a':
             {
               m_argprop["manager.corba_servant"] = "NO";
             }
             break;
-	    // Specify configuration file not default
-	  case 'f':
-	    m_configFile = get_opts.optarg;
-	    break;
-	  case 'l':
-	    //	    m_configFile = get_opts.optarg;
-	    break;
-	  case 'o':
+            // Specify configuration file not default
+          case 'f':
+            if (!fileExist(get_opts.optarg))
+              {
+                std::cerr << "Configuration file: " << m_configFile;
+                std::cerr << " not found." << std::endl;
+                abort();
+              }
+            m_configFile = get_opts.optarg;
+            break;
+          case 'o':
             {
               std::string optarg(get_opts.optarg);
               std::string::size_type pos(optarg.find(":"));
               if (pos != std::string::npos)
                 {
-                  m_argprop[optarg.substr(0, pos)] = optarg.substr(pos + 1);
+                  std::string key = optarg.substr(0, pos);
+                  std::string value = optarg.substr(pos + 1);
+
+                  key = coil::unescape(key);
+                  coil::eraseHeadBlank(key);
+                  coil::eraseTailBlank(key);
+
+                  value = coil::unescape(value);
+                  coil::eraseHeadBlank(value);
+                  coil::eraseTailBlank(value);
+
+                  m_argprop[key] = value;
                 }
             }
-	    break;
+            break;
           case 'p': // ORB's port number
             {
               int portnum;
@@ -180,12 +195,12 @@
                 }
             }
             break;
-	  case 'd':
+          case 'd':
             m_isMaster = true;
-	    break;
-	  default:
-	    break;
-	  }
+            break;
+          default:
+            break;
+          }
       }
     return;
   }
@@ -202,34 +217,37 @@
     // Check existance of configuration file given command arg
     if (m_configFile != "") 
       {
-	if (fileExist(m_configFile))
-	  {
-	    return true;
-	  }
+        if (fileExist(m_configFile))
+          {
+            return true;
+          }
+        std::cerr << "Configuration file: " << m_configFile;
+        std::cerr << " not found." << std::endl;
       }
-    
     // Search rtc configuration file from environment variable
     char* env = getenv(config_file_env);
     if (env != NULL)
       {
-	if (fileExist(env))
-	  {
-	    m_configFile = env;
-	    return true;
-	  }
+        if (fileExist(env))
+          {
+            m_configFile = env;
+            return true;
+          }
+        std::cerr << "Configuration file: " << m_configFile;
+        std::cerr << " not found." << std::endl;
       }
     // Search rtc configuration file from default search path
     int i = 0;
     while (config_file_path[i] != NULL)
       {
-		  std::string cpath = coil::replaceEnv(config_file_path[i]);
+        std::string cpath = coil::replaceEnv(config_file_path[i]);
 
-		  if (fileExist(cpath))
-		  {
-			  m_configFile = cpath;
-			  return true;
-		  }
-		++i;
+        if (fileExist(cpath))
+          {
+            m_configFile = cpath;
+            return true;
+          }
+        ++i;
       }
     return false;
   }
@@ -249,7 +267,7 @@
     coil::utsname  sysinfo;
     if (coil::uname(&sysinfo) != 0)
       {
-	return;
+        return;
       }
     
     //
@@ -283,13 +301,13 @@
     // fial() 0: ok, !0: fail
     if (infile.fail() != 0) 
       {
-	infile.close();
-	return false;
+        infile.close();
+        return false;
       }
     else
       {
-	infile.close();
-	return true;
+        infile.close();
+        return true;
       }
     return false;
   }

Modified: trunk/OpenRTM-aist/src/lib/rtm/ManagerConfig.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/ManagerConfig.h	2018-03-28 04:59:47 UTC (rev 3276)
+++ trunk/OpenRTM-aist/src/lib/rtm/ManagerConfig.h	2018-03-28 05:04:53 UTC (rev 3277)
@@ -37,6 +37,7 @@
    * ¥×¥í¥Ñ¥Æ¥£¾ðÊó¤òÀßÄꤹ¤ë¡£
    *
    * ³ÆÀßÄê¤ÎÍ¥ÀèÅ٤ϰʲ¼¤Î¤È¤ª¤ê¤Ç¤¢¤ë¡£
+   * - UNIX/Linux
    * <OL>
    * <LI>¥³¥Þ¥ó¥É¥é¥¤¥ó¥ª¥×¥·¥ç¥ó "-f"
    * <LI>´Ä¶­ÊÑ¿ô "RTC_MANAGER_CONFIG"
@@ -47,9 +48,13 @@
    * <LI>¥Ç¥Õ¥©¥ë¥ÈÀßÄê¥Õ¥¡¥¤¥ë "/usr/local/etc/rtc/rtc.conf"
    * <LI>Ëä¤á¹þ¤ß¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥óÃÍ
    *</OL>
-   * ¤¿¤À¤·¡¢¥³¥Þ¥ó¥É¥é¥¤¥ó¥ª¥×¥·¥ç¥ó "-d" ¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¤Ï¡¢
-   * (¤¿¤È¤¨ -f ¤ÇÀßÄê¥Õ¥¡¥¤¥ë¤ò»ØÄꤷ¤Æ¤â)Ëä¤á¹þ¤ß¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥óÃÍ
-   * ¤¬»ÈÍѤµ¤ì¤ë¡£
+   * - Windows
+   * <OL>
+   * <LI>¥³¥Þ¥ó¥É¥é¥¤¥ó¥ª¥×¥·¥ç¥ó "-f"
+   * <LI>´Ä¶­ÊÑ¿ô "RTC_MANAGER_CONFIG"
+   * <LI>¥Ç¥Õ¥©¥ë¥ÈÀßÄê¥Õ¥¡¥¤¥ë "./rtc.conf"
+   * <LI>¥Ç¥Õ¥©¥ë¥ÈÀßÄê¥Õ¥¡¥¤¥ë "%RTM_ROOT%/%RTM_VC_VERSION%/rtc.conf"
+   * </OL>
    *
    * @since 0.4.0
    *
@@ -58,12 +63,13 @@
    * @class ManagerConfig
    * @brief Manager configuration class
    *
-   * Modify Manager's configuration. 
+   * Modify Manager's configuration.
    * This class receives the command line arguments and will be instantiated.
    * Set property information of Manager with the configuration file specified
    * by the command line argument or the environment variable etc.
    *
    * The priorities of each configuration are as follows:
+   * - UNIX/Linux
    * <OL>
    * <LI>Command option "-f"
    * <LI>Environment variable "RTC_MANAGER_CONFIG"
@@ -74,8 +80,13 @@
    * <LI>Default configuration file "/usr/local/etc/rtc/rtc.conf"
    * <LI>Embedded configuration value
    *</OL>
-   * If the command option "-d" is specified (even if specify configuration file
-   * by "-f" option), the embedded configuration values will be used.
+   * - Windows
+   * <OL>
+   * <LI>Command option "-f"
+   * <LI>Environment variable "RTC_MANAGER_CONFIG"
+   * <LI>Default configuration file "./rtc.conf"
+   * <LI>Default configuration file "%RTM_ROOT%/%RTM_VC_VERSION%/rtc.conf"
+   * </OL>
    *
    * @since 0.4.0
    *
@@ -167,10 +178,11 @@
      * ¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¿ô¤Ë±þ¤¸¤Æ½é´ü²½¤ò¼Â¹Ô¤¹¤ë¡£¥³¥Þ¥ó¥É¥é¥¤¥ó¥ª¥×¥·¥ç¥ó¤Ï
      * °Ê²¼¤Î¤â¤Î¤¬»ÈÍѲÄǽ¤Ç¤¢¤ë¡£
      *
-     *  - -f file   : ¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¥Õ¥¡¥¤¥ë¤ò»ØÄꤹ¤ë¡£
-     *  - -l module : ¥í¡¼¥É¤¹¤ë¥â¥¸¥å¡¼¥ë¤ò»ØÄꤹ¤ë¡£(̤¼ÂÁõ)
-     *  - -o options: ¤½¤Î¾¥ª¥×¥·¥ç¥ó¤ò»ØÄꤹ¤ë¡£(̤¼ÂÁõ)
-     *  - -d        : ¥Ç¥Õ¥©¥ë¥È¤Î¥³¥ó¥Õ¥£¥®¥å¥ì¡¼¥·¥ç¥ó¤ò»È¤¦¡£(̤¼ÂÁõ)
+     * - -a              : ¥Þ¥Í¡¼¥¸¥ã¥µ¡¼¥Ó¥¹OFF
+     * - -f <file name>  : ÀßÄê¥Õ¥¡¥¤¥ë¤Î»ØÄê
+     * - -o <option>     ; ¥ª¥×¥·¥ç¥ó»ØÄê
+     * - -p <port number>: ¥Ý¡¼¥ÈÈÖ¹æ»ØÄê
+     * - -d              : ¥Þ¥¹¥¿¡¼¥Þ¥Í¡¼¥¸¥ã»ØÄê
      *
      * @param argc ¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¿ô¤Î¿ô
      * @param argv ¥³¥Þ¥ó¥É¥é¥¤¥ó°ú¿ô
@@ -182,10 +194,11 @@
      * Initialize with command line options. The following command options
      * are available.
      *
-     * - -f file   : Specify the configuration file.
-     * - -l module : Specify modules to be loaded. (Not implemented)
-     * - -o options: Specify other options. (Not implemented)
-     * - -d        : Use default static configuration. (Not implemented)
+     * - -a              : Disable manager service
+     * - -f <file name>  : Specify a configuration file
+     * - -o <option>     ; Specify options
+     * - -p <port number>: Specify a port number
+     * - -d              : Run as the master manager
      *
      * @param argc Number of command line arguments
      * @param argv The command line arguments

Modified: trunk/OpenRTM-aist/src/lib/rtm/ManagerServant.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/ManagerServant.cpp	2018-03-28 04:59:47 UTC (rev 3276)
+++ trunk/OpenRTM-aist/src/lib/rtm/ManagerServant.cpp	2018-03-28 05:04:53 UTC (rev 3277)
@@ -117,6 +117,20 @@
       }
     m_slaves.length(0);
 
+
+
+#ifndef ORB_IS_RTORB
+	CORBA::Object_ptr obj = m_mgr.theORB()->resolve_initial_references("omniINSPOA");
+#else // ROB_IS_RTORB
+	CORBA::Object_ptr obj = m_mgr.theORB()->resolve_initial_references((char*)"omniINSPOA");
+#endif // ORB_IS_RTORB
+	
+	PortableServer::POA_ptr poa = PortableServer::POA::_narrow(obj);
+	PortableServer::ObjectId_var id;
+	id = poa->servant_to_id(this);
+
+	poa->deactivate_object(id.in());
+
   }
   
   /*!

Modified: trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp	2018-03-28 04:59:47 UTC (rev 3276)
+++ trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp	2018-03-28 05:04:53 UTC (rev 3277)
@@ -404,6 +404,14 @@
     if (m_created) { return RTC::PRECONDITION_NOT_MET; }
     if (m_exiting) { return RTC::RTC_OK; }
 
+
+    SDOPackage::OrganizationList* organizations = get_organizations();
+    CORBA::ULong len = organizations->length();
+
+    for (CORBA::ULong i = 0; i < len; i++)
+      {
+        (*organizations)[i]->remove_member(getInstanceName());
+      }
     // deactivate myself on owned EC
     CORBA_SeqUtil::for_each(m_ecMine,
 			    deactivate_comps(m_objref));
@@ -2651,6 +2659,20 @@
         oid2 = m_pPOA->servant_to_id(this);
         m_pPOA->deactivate_object(oid1);
         m_pPOA->deactivate_object(oid2);
+
+
+#ifndef ORB_IS_RTORB
+        CORBA::Object_ptr obj = m_pORB->resolve_initial_references("omniINSPOA");
+#else // ROB_IS_RTORB
+        CORBA::Object_ptr obj = m_pORB->resolve_initial_references((char*)"omniINSPOA");
+#endif // ORB_IS_RTORB
+        PortableServer::POA_ptr poa = PortableServer::POA::_narrow(obj);
+
+        PortableServer::ObjectId_var oid3;
+        oid3 = poa->servant_to_id(this);
+
+
+        poa->deactivate_object(oid3.in());
       }
     catch (PortableServer::POA::ServantNotActive &e)
       {

Modified: trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.h	2018-03-28 04:59:47 UTC (rev 3276)
+++ trunk/OpenRTM-aist/src/lib/rtm/SystemLogger.h	2018-03-28 05:04:53 UTC (rev 3277)
@@ -425,7 +425,7 @@
    * @brief ¥¨¥é¡¼¥í¥°½ÐÎÏ¥Þ¥¯¥í¡£
    *
    * ¥¨¥é¡¼¥ì¥Ù¥ë¤Î¥í¥°½ÐÎÏ¥Þ¥¯¥í¡£<BR>¥í¥°¥ì¥Ù¥ë¤¬
-   * ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE, PARANOID
+   * FATAL, ERROR, WARN, INFO, DEBUG, TRACE, VERBOSE, PARANOID
    * ¤Î¾ì¹ç¤Ë¥í¥°½ÐÎϤµ¤ì¤ë¡£
    *
    * @else
@@ -433,7 +433,7 @@
    * @brief Error log output macro
    *
    * This is a log output macro of the error level.
-   * If log levels are ERROR, WARN, INFO, NORMAL, DEBUG, TRACE,
+   * If log levels are FATAL, ERROR, WARN, INFO, NORMAL, DEBUG, TRACE,
    * VERBOSE or PARANOID, message will be output to log.
    *
    * @endif
@@ -447,7 +447,7 @@
    * @brief ¥¨¥é¡¼¥í¥°½ÐÎÏ¥Þ¥¯¥í¡£
    *
    * ¥¨¥é¡¼¥ì¥Ù¥ë¤Î¥í¥°½ÐÎÏ¥Þ¥¯¥í¡£<BR>¥í¥°¥ì¥Ù¥ë¤¬
-   * ERROR, WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE, PARANOID
+   * ERROR, WARN, INFO, DEBUG, TRACE, VERBOSE, PARANOID
    * ¤Î¾ì¹ç¤Ë¥í¥°½ÐÎϤµ¤ì¤ë¡£
    *
    * @else
@@ -455,8 +455,8 @@
    * @brief Error log output macro
    *
    * This is a log output macro of the error level.
-   * If log levels are ERROR, WARN, INFO, NORMAL, DEBUG, TRACE,
-   * VERBOSE or PARANOID, message will be output to log.
+   * If log levels are ERROR, WARN, INFO, DEBUG, TRACE,
+   * VERBOSE and PARANOID, message will be output to log.
    *
    * @endif
    */
@@ -469,7 +469,7 @@
    * @brief ¥ï¡¼¥Ë¥ó¥°¥í¥°½ÐÎÏ¥Þ¥¯¥í¡£
    *
    * ¥ï¡¼¥Ë¥ó¥°¥ì¥Ù¥ë¤Î¥í¥°½ÐÎÏ¥Þ¥¯¥í¡£<BR>¥í¥°¥ì¥Ù¥ë¤¬
-   * ( WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE, PARANOID )
+   * ( WARN, INFO, DEBUG, TRACE, VERBOSE, PARANOID )
    * ¤Î¾ì¹ç¤Ë¥í¥°½ÐÎϤµ¤ì¤ë¡£
    *
    * @else
@@ -477,7 +477,7 @@
    * @brief Warning log output macro
    *
    * If log levels are
-   * ( WARN, INFO, NORMAL, DEBUG, TRACE, VERBOSE, PARANOID ),
+   * ( WARN, INFO, DEBUG, TRACE, VERBOSE, PARANOID ),
    * message will be output to log.
    *
    * @endif
@@ -491,7 +491,7 @@
    * @brief ¥¤¥ó¥Õ¥©¥í¥°½ÐÎÏ¥Þ¥¯¥í¡£
    *
    * ¥¤¥ó¥Õ¥©¥ì¥Ù¥ë¤Î¥í¥°½ÐÎÏ¥Þ¥¯¥í¡£<BR>¥í¥°¥ì¥Ù¥ë¤¬
-   * ( INFO, NORMAL, DEBUG, TRACE, VERBOSE, PARANOID )
+   * ( INFO, DEBUG, TRACE, VERBOSE, PARANOID )
    * ¤Î¾ì¹ç¤Ë¥í¥°½ÐÎϤµ¤ì¤ë¡£
    *
    * @else
@@ -499,7 +499,7 @@
    * @brief Information level log output macro
    *
    *  If log levels are
-   * ( INFO, NORMAL, DEBUG, TRACE, VERBOSE, PARANOID ),
+   * ( INFO, DEBUG, TRACE, VERBOSE, PARANOID ),
    * message will be output to log.
    *
    * @endif
@@ -597,12 +597,12 @@
 #define RTC_PARANOID_STR(str) RTC_LOG_STR(::RTC::Logger::RTL_PARANOID, str)
   
 #else
+#define RTC_FATAL(fmt)
+#define RTC_FATAL_STR(str)
 #define RTC_ERROR(fmt)
 #define RTC_ERROR_STR(str)
 #define RTC_WARN(fmt)
 #define RTC_WARN_STR(str)
-#define RTC_NORMAL(fmt)
-#define RTC_NORMAL_STR(str)
 #define RTC_INFO(fmt)
 #define RTC_INFO_STR(str)
 #define RTC_DEBUG(fmt)

Modified: trunk/OpenRTM-aist/win32/OpenRTM-aist/bin/rtm-naming.bat
===================================================================
--- trunk/OpenRTM-aist/win32/OpenRTM-aist/bin/rtm-naming.bat	2018-03-28 04:59:47 UTC (rev 3276)
+++ trunk/OpenRTM-aist/win32/OpenRTM-aist/bin/rtm-naming.bat	2018-03-28 05:04:53 UTC (rev 3277)
@@ -1,5 +1,10 @@
 @echo off
 
+TASKLIST | FIND "omniNames.exe" > NUL
+IF NOT ERRORLEVEL 1  (
+        TASKKILL /F /IM omniNames.exe
+)
+
 set cosnames="omninames"
 set orb="omniORB"
 set port=%1



openrtm-commit メーリングリストの案内