[openrtm-commit:00211] r2195 - trunk/OpenRTM-aist/src/lib/rtm

openrtm @ openrtm.org openrtm @ openrtm.org
2011年 7月 1日 (金) 00:53:54 JST


Author: n-ando
Date: 2011-07-01 00:53:54 +0900 (Fri, 01 Jul 2011)
New Revision: 2195

Modified:
   trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp
Log:
Post-component-action callbacks were not called when component-actions
throw exception.  Now post-component-action callbacks are called with
RTC::ERROR return value when exception is thrown. refs #2178


Modified: trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp	2011-06-30 15:34:13 UTC (rev 2194)
+++ trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp	2011-06-30 15:53:54 UTC (rev 2195)
@@ -780,23 +780,23 @@
       {
         preOnInitialize(0);
         ret = onInitialize();
-        postOnInitialize(0, ret);
-        std::string active_set;
-        active_set = m_properties.getProperty("configuration.active_config",
-                                              "default");
-        if (m_configsets.haveConfig(active_set.c_str()))
-          {
-            m_configsets.update(active_set.c_str());
-          }
-        else
-          {
-            m_configsets.update("default");
-          }
       }
     catch (...)
       {
-	return RTC::RTC_ERROR;
+	ret = RTC::RTC_ERROR;
       }
+    std::string active_set;
+    active_set = m_properties.getProperty("configuration.active_config",
+                                          "default");
+    if (m_configsets.haveConfig(active_set.c_str()))
+      {
+        m_configsets.update(active_set.c_str());
+      }
+    else
+      {
+        m_configsets.update("default");
+      }
+    postOnInitialize(0, ret);
     return ret;
   }
   
@@ -816,12 +816,12 @@
       {
         preOnFinalize(0);
 	ret = onFinalize();
-        postOnFinalize(0, ret);
       }
     catch (...)
       {
-	return RTC::RTC_ERROR;
+	ret = RTC::RTC_ERROR;
       }
+    postOnFinalize(0, ret);
     return ret;
   }
   
@@ -841,12 +841,12 @@
       {
         preOnStartup(ec_id);
 	ret = onStartup(ec_id);
-        postOnStartup(ec_id, ret);
       }
     catch (...)
       {
-	return RTC::RTC_ERROR;
+	ret = RTC::RTC_ERROR;
       }
+    postOnStartup(ec_id, ret);
     return ret;
   }
   
@@ -866,12 +866,12 @@
       {
         preOnShutdown(ec_id);
 	ret = onShutdown(ec_id);
-        postOnShutdown(ec_id, ret);
       }
     catch (...)
       {
-	return RTC::RTC_ERROR;
+	ret = RTC::RTC_ERROR;
       }
+    postOnShutdown(ec_id, ret);
     return ret;
   }
   
@@ -893,12 +893,12 @@
 	m_configsets.update();
 	ret = onActivated(ec_id);
         m_portAdmin.activatePorts();
-        postOnActivated(ec_id, ret);
       }
     catch (...)
       {
-	return RTC::RTC_ERROR;
+	ret = RTC::RTC_ERROR;
       }
+    postOnActivated(ec_id, ret);
     return ret;
   }
   
@@ -919,12 +919,12 @@
         preOnDeactivated(ec_id);
         m_portAdmin.deactivatePorts();
 	ret = onDeactivated(ec_id);
-        postOnDeactivated(ec_id, ret);
       }
     catch (...)
       {
-	return RTC::RTC_ERROR;
+	ret = RTC::RTC_ERROR;
       }
+    postOnDeactivated(ec_id, ret);
     return ret;
   }
   
@@ -944,12 +944,12 @@
       {
         preOnAborting(ec_id);
 	ret = onAborting(ec_id);
-        postOnAborting(ec_id, ret);
       }
     catch (...)
       {
-	return RTC::RTC_ERROR;
+	ret = RTC::RTC_ERROR;
       }
+    postOnAborting(ec_id, ret);
     return ret;
   }
   
@@ -969,13 +969,13 @@
       {
         preOnError(ec_id);
 	ret = onError(ec_id);
-	m_configsets.update();
-        postOnError(ec_id, ret);
       }
     catch (...)
       {
-	return RTC::RTC_ERROR;
+	ret = RTC::RTC_ERROR;
       }
+    m_configsets.update();
+    postOnError(ec_id, ret);
     return ret;
   }
   
@@ -995,12 +995,12 @@
       {
         preOnReset(ec_id);
 	ret = onReset(ec_id);
-        postOnReset(ec_id, ret);
       }
     catch (...)
       {
-	return RTC::RTC_ERROR;
+	ret = RTC::RTC_ERROR;
       }
+    postOnReset(ec_id, ret);
     return ret;
   }
   
@@ -1023,12 +1023,12 @@
 	if (m_readAll) {readAll(); }
 	ret = onExecute(ec_id);
 	if (m_writeAll) { writeAll();}
-        postOnExecute(ec_id, ret);
       }
     catch (...)
       {
-	return RTC::RTC_ERROR;
+	ret = RTC::RTC_ERROR;
       }
+    postOnExecute(ec_id, ret);
     return ret;
   }
   
@@ -1050,12 +1050,12 @@
         preOnStateUpdate(ec_id);
 	ret = onStateUpdate(ec_id);
 	m_configsets.update();
-        postOnStateUpdate(ec_id, ret);
       }
     catch (...)
       {
-	return RTC::RTC_ERROR;
+	ret = RTC::RTC_ERROR;
       }
+    postOnStateUpdate(ec_id, ret);
     return ret;
   }
   
@@ -1075,12 +1075,12 @@
       {
         preOnRateChanged(ec_id);
 	ret = onRateChanged(ec_id);
-        postOnRateChanged(ec_id, ret);
       }
     catch (...)
       {
-	return RTC::RTC_ERROR;
+	ret = RTC::RTC_ERROR;
       }
+    postOnRateChanged(ec_id, ret);
     return ret;
   }
   



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