[openrtm-commit:02043] r2775 - trunk/OpenRTM-aist/src/lib/rtm

openrtm @ openrtm.org openrtm @ openrtm.org
2016年 10月 12日 (水) 23:01:09 JST


Author: miyamoto
Date: 2016-10-12 23:01:09 +0900 (Wed, 12 Oct 2016)
New Revision: 2775

Modified:
   trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp
Log:
[compat,RELENG_1_2]refs #3656

Modified: trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp	2016-10-12 03:10:39 UTC (rev 2774)
+++ trunk/OpenRTM-aist/src/lib/rtm/RTObject.cpp	2016-10-12 14:01:09 UTC (rev 2775)
@@ -2741,22 +2741,65 @@
 
 	if (m_eclist.empty())
 	{
-	
-		coil::Properties prop;
-		prop.setDefaults(default_config);
+
+		coil::Properties default_prop;
+		default_prop.setDefaults(default_config);
 		RTC::ExecutionContextBase* ec = NULL;
 		ec = RTC::ExecutionContextFactory::
-			instance().createObject(prop["exec_cxt.periodic.type"].c_str());
+			instance().createObject(default_prop["exec_cxt.periodic.type"].c_str());
 		if (ec == NULL)
 		{
-			RTC_ERROR(("EC (%s) creation failed.", prop["exec_cxt.periodic.type"].c_str()));
+			RTC_ERROR(("EC (%s) creation failed.", default_prop["exec_cxt.periodic.type"].c_str()));
 			RTC_DEBUG(("Available EC list: %s",
 				coil::flatten(avail_ec).c_str()));
-			ret = RTC::RTC_ERROR;
+			
+			return RTC::RTC_ERROR;
 		}
+
+		coil::Properties default_opts;
+
+		coil::Properties* prop = default_prop.findNode("exec_cxt.periodic");
 		
+		if (prop == NULL)
+		{
+			RTC_WARN(("No global EC options found."));
+			return RTC::RTC_ERROR;
+		}
+
+		default_opts << *prop;
 		
-		ec->init(coil::Properties());
+		const char* inherited_opts[] =
+		{
+			"sync_transition",
+			"sync_activation",
+			"sync_deactivation",
+			"sync_reset",
+			"transition_timeout",
+			"activation_timeout",
+			"deactivation_timeout",
+			"reset_timeout",
+			""
+		};
+
+		coil::Properties* p = default_prop.findNode("exec_cxt");
+		if (p == NULL)
+		{
+			RTC_WARN(("No exec_cxt option found."));
+			return RTC::RTC_ERROR;
+		}
+		RTC_DEBUG(("Copying inherited EC options."));
+		for (size_t i(0); inherited_opts[i][0] != '\0'; ++i)
+		{
+			if ((*p).findNode(inherited_opts[i]) != NULL)
+			{
+				RTC_PARANOID(("Option %s exists.", inherited_opts[i]));
+				default_opts[inherited_opts[i]] = (*p)[inherited_opts[i]];
+			}
+		}
+		
+
+		
+		ec->init(default_opts);
 		m_eclist.push_back(ec);
 		ec->bindComponent(this);
 	}



More information about the openrtm-commit mailing list