[openrtm-commit:03298] r3264 - trunk/OpenRTM-aist/src/lib/rtm

openrtm @ openrtm.org openrtm @ openrtm.org
2018年 3月 28日 (水) 12:17:00 JST


Author: miyamoto
Date: 2018-03-28 12:17:00 +0900 (Wed, 28 Mar 2018)
New Revision: 3264

Modified:
   trunk/OpenRTM-aist/src/lib/rtm/InPortBase.cpp
   trunk/OpenRTM-aist/src/lib/rtm/InPortBase.h
   trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp
   trunk/OpenRTM-aist/src/lib/rtm/OutPortBase.cpp
   trunk/OpenRTM-aist/src/lib/rtm/OutPortBase.h
   trunk/OpenRTM-aist/src/lib/rtm/PortBase.cpp
   trunk/OpenRTM-aist/src/lib/rtm/PortBase.h
Log:
[merge] r3169-3170 have been merged from RELENG_1_2.

Modified: trunk/OpenRTM-aist/src/lib/rtm/InPortBase.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/InPortBase.cpp	2018-03-28 02:44:30 UTC (rev 3263)
+++ trunk/OpenRTM-aist/src/lib/rtm/InPortBase.cpp	2018-03-28 03:17:00 UTC (rev 3264)
@@ -1032,4 +1032,36 @@
   {
    return m_listeners; 
   }
+
+  ReturnCode_t InPortBase::notify_connect(ConnectorProfile& connector_profile)
+	  throw (CORBA::SystemException)
+  {
+	  Properties prop;
+	  NVUtil::copyToProperties(prop, connector_profile.properties);
+
+	  Properties node = prop.getNode("dataport.inport");
+
+	  Properties portprop(m_properties);
+
+	  node << portprop;
+
+	  NVUtil::copyFromProperties(connector_profile.properties, prop);
+
+	  std::string _str = node["fan_in"];
+	  unsigned int value = 100;
+
+	  coil::stringTo<unsigned int>(value, _str.c_str());
+	  
+
+	  if (value <= m_connectors.size())
+	  {
+		  return RTC::PRECONDITION_NOT_MET;
+	  }
+
+
+
+
+
+	  return PortBase::notify_connect(connector_profile);
+  }
 };

Modified: trunk/OpenRTM-aist/src/lib/rtm/InPortBase.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/InPortBase.h	2018-03-28 02:44:30 UTC (rev 3263)
+++ trunk/OpenRTM-aist/src/lib/rtm/InPortBase.h	2018-03-28 03:17:00 UTC (rev 3264)
@@ -622,6 +622,8 @@
      * @endif
      */
     virtual ConnectorListeners& getListeners();
+    virtual ReturnCode_t notify_connect(ConnectorProfile& connector_profile)
+		throw (CORBA::SystemException);
 
   protected:
 
@@ -845,14 +847,6 @@
     CdrBufferBase* m_thebuffer;
     /*!
      * @if jp
-     * @brief ¥×¥í¥Ñ¥Æ¥£
-     * @else
-     * @brief Properties
-     * @endif
-     */
-    coil::Properties m_properties;
-    /*!
-     * @if jp
      * @brief ÍøÍѲÄǽprovider
      * @else
      * @brief Available providers

Modified: trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp	2018-03-28 02:44:30 UTC (rev 3263)
+++ trunk/OpenRTM-aist/src/lib/rtm/Manager.cpp	2018-03-28 03:17:00 UTC (rev 3264)
@@ -787,6 +787,9 @@
       ""
     };
 
+    coil::Properties &_prop = prop.getNode("port");
+    _prop << m_config.getNode("port");
+
     RTObject_impl* comp;
     comp = factory->create(this);
     if (comp == NULL)

Modified: trunk/OpenRTM-aist/src/lib/rtm/OutPortBase.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/OutPortBase.cpp	2018-03-28 02:44:30 UTC (rev 3263)
+++ trunk/OpenRTM-aist/src/lib/rtm/OutPortBase.cpp	2018-03-28 03:17:00 UTC (rev 3264)
@@ -1100,4 +1100,37 @@
     return NULL;
   }
 
+  ReturnCode_t OutPortBase::notify_connect(ConnectorProfile& connector_profile)
+	  throw (CORBA::SystemException)
+  {
+	  Properties prop;
+	  NVUtil::copyToProperties(prop, connector_profile.properties);
+
+	  Properties node = prop.getNode("dataport.outport");
+
+	  Properties portprop(m_properties);
+
+	  node << portprop;
+
+	  
+
+	  NVUtil::copyFromProperties(connector_profile.properties, prop);
+
+	  std::string _str = node["fan_out"];
+	  unsigned int value = 100;
+
+	  coil::stringTo<unsigned int>(value, _str.c_str());
+
+	  if (value <= m_connectors.size())
+	  {
+		  return RTC::PRECONDITION_NOT_MET;
+	  }
+	  
+	  
+
+
+
+	  return PortBase::notify_connect(connector_profile);
+  }
+
 }; // end of namespace RTM

Modified: trunk/OpenRTM-aist/src/lib/rtm/OutPortBase.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/OutPortBase.h	2018-03-28 02:44:30 UTC (rev 3263)
+++ trunk/OpenRTM-aist/src/lib/rtm/OutPortBase.h	2018-03-28 03:17:00 UTC (rev 3264)
@@ -1018,6 +1018,9 @@
                                       coil::Properties& prop,
                                       OutPortProvider* provider);
 
+    virtual ReturnCode_t notify_connect(ConnectorProfile& connector_profile)
+		throw (CORBA::SystemException);
+
   protected:
     /*!
      * @if jp
@@ -1028,16 +1031,9 @@
      */
     InPortBase* getLocalInPort(const ConnectorInfo& profile);
     
+
     /*!
      * @if jp
-     * @brief ¥×¥í¥Ñ¥Æ¥£
-     * @else
-     * @brief Properties
-     * @endif
-     */
-    coil::Properties m_properties;
-    /*!
-     * @if jp
      * @brief Àܳ¥ê¥¹¥È
      * @else
      * @brief Connection list

Modified: trunk/OpenRTM-aist/src/lib/rtm/PortBase.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/PortBase.cpp	2018-03-28 02:44:30 UTC (rev 3263)
+++ trunk/OpenRTM-aist/src/lib/rtm/PortBase.cpp	2018-03-28 03:17:00 UTC (rev 3264)
@@ -239,6 +239,30 @@
   {
     RTC_TRACE(("notify_connect()"));
     Guard guard(m_connectorsMutex);
+
+
+
+	Properties prop;
+	NVUtil::copyToProperties(prop, connector_profile.properties);
+	bool default_value = coil::toBool(m_properties["allow_dup_connection"], "YES", "NO", false);
+
+	if (!coil::toBool(prop.getProperty("dataport.allow_dup_connection"), "YES", "NO", default_value))
+	{
+		for (int i = 0; i < connector_profile.ports.length(); i++)
+		{
+			if (!getPortRef()->_is_equivalent(connector_profile.ports[i]))
+			{
+				bool ret = CORBA_RTCUtil::already_connected(connector_profile.ports[i], m_objref);
+				if(ret)
+				{
+					return RTC::PRECONDITION_NOT_MET;
+				}
+			}
+		}
+	}
+
+
+
     ReturnCode_t retval[] = {RTC::RTC_OK, RTC::RTC_OK, RTC::RTC_OK};
 
     onNotifyConnect(getName(), connector_profile);

Modified: trunk/OpenRTM-aist/src/lib/rtm/PortBase.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/PortBase.h	2018-03-28 02:44:30 UTC (rev 3263)
+++ trunk/OpenRTM-aist/src/lib/rtm/PortBase.h	2018-03-28 03:17:00 UTC (rev 3264)
@@ -1908,7 +1908,14 @@
     {
       NVUtil::appendStringValue(m_profile.properties, key, value);
     }
-    
+    /*!
+     * @if jp
+     * @brief ¥×¥í¥Ñ¥Æ¥£
+     * @else
+     * @brief Properties
+     * @endif
+     */
+    coil::Properties m_properties;
   protected:
     /*!
      * @if jp



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