[openrtm-commit:01575] r2642 - trunk/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2015年 6月 29日 (月) 09:49:25 JST
Author: n-ando
Date: 2015-06-29 09:49:25 +0900 (Mon, 29 Jun 2015)
New Revision: 2642
Added:
trunk/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.cpp
trunk/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.h
trunk/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.cpp
trunk/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.h
Modified:
trunk/OpenRTM-aist/src/lib/rtm/FactoryInit.cpp
trunk/OpenRTM-aist/src/lib/rtm/InPortBase.cpp
trunk/OpenRTM-aist/src/lib/rtm/InPortBase.h
trunk/OpenRTM-aist/src/lib/rtm/InPortConnector.cpp
trunk/OpenRTM-aist/src/lib/rtm/InPortConnector.h
trunk/OpenRTM-aist/src/lib/rtm/InPortPullConnector.cpp
trunk/OpenRTM-aist/src/lib/rtm/InPortPushConnector.cpp
trunk/OpenRTM-aist/src/lib/rtm/Makefile.am
trunk/OpenRTM-aist/src/lib/rtm/OutPortBase.cpp
trunk/OpenRTM-aist/src/lib/rtm/OutPortConnector.cpp
trunk/OpenRTM-aist/src/lib/rtm/OutPortConnector.h
trunk/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.cpp
trunk/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.cpp
Log:
[incompat,new_func,new_file] Direct data put mode has been implemented as a new interface_type=direct. Callbacks have been implemented. refs #3242
Modified: trunk/OpenRTM-aist/src/lib/rtm/FactoryInit.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/FactoryInit.cpp 2015-06-29 00:22:55 UTC (rev 2641)
+++ trunk/OpenRTM-aist/src/lib/rtm/FactoryInit.cpp 2015-06-29 00:49:25 UTC (rev 2642)
@@ -32,6 +32,8 @@
#include <rtm/InPortCorbaCdrConsumer.h>
#include <rtm/OutPortCorbaCdrConsumer.h>
#include <rtm/OutPortCorbaCdrProvider.h>
+#include <rtm/InPortDirectProvider.h>
+#include <rtm/InPortDirectConsumer.h>
void FactoryInit()
{
@@ -51,4 +53,6 @@
InPortCorbaCdrConsumerInit();
OutPortCorbaCdrConsumerInit();
OutPortCorbaCdrProviderInit();
+ InPortDirectProviderInit();
+ InPortDirectConsumerInit();
}
Modified: trunk/OpenRTM-aist/src/lib/rtm/InPortBase.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/InPortBase.cpp 2015-06-29 00:22:55 UTC (rev 2641)
+++ trunk/OpenRTM-aist/src/lib/rtm/InPortBase.cpp 2015-06-29 00:49:25 UTC (rev 2642)
@@ -1012,4 +1012,8 @@
return 0;
}
+ ConnectorListeners& InPortBase::getListeners()
+ {
+ return m_listeners;
+ }
};
Modified: trunk/OpenRTM-aist/src/lib/rtm/InPortBase.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/InPortBase.h 2015-06-29 00:22:55 UTC (rev 2641)
+++ trunk/OpenRTM-aist/src/lib/rtm/InPortBase.h 2015-06-29 00:49:25 UTC (rev 2642)
@@ -598,6 +598,25 @@
connect(ConnectorProfile& connector_profile)
throw (CORBA::SystemException);
+ /*!
+ * @if jp
+ * @brief リスナホルダを取得する
+ *
+ * InPortBaseが保持するリスナホルダを返す。
+ *
+ * @return ConnectorListeners
+ *
+ * @else
+ * @brief Getting listeners holder
+ *
+ * This operation returns listeners holder.
+ *
+ * @return ConnectorListeners
+ *
+ * @endif
+ */
+ virtual ConnectorListeners& getListeners();
+
protected:
/*!
@@ -793,7 +812,6 @@
InPortConnector*
createConnector(const ConnectorProfile& cprof, coil::Properties& prop,
OutPortConsumer* consumer);
-
protected:
/*!
* @if jp
Modified: trunk/OpenRTM-aist/src/lib/rtm/InPortConnector.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/InPortConnector.cpp 2015-06-29 00:22:55 UTC (rev 2641)
+++ trunk/OpenRTM-aist/src/lib/rtm/InPortConnector.cpp 2015-06-29 00:49:25 UTC (rev 2642)
@@ -29,9 +29,10 @@
* @endif
*/
InPortConnector::InPortConnector(ConnectorInfo& info,
+ ConnectorListeners& listeners,
CdrBufferBase* buffer)
: rtclog("InPortConnector"), m_profile(info),
- m_buffer(buffer), m_littleEndian(true)
+ m_listeners(listeners), m_buffer(buffer), m_littleEndian(true)
{
}
Modified: trunk/OpenRTM-aist/src/lib/rtm/InPortConnector.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/InPortConnector.h 2015-06-29 00:22:55 UTC (rev 2641)
+++ trunk/OpenRTM-aist/src/lib/rtm/InPortConnector.h 2015-06-29 00:49:25 UTC (rev 2642)
@@ -20,6 +20,7 @@
#ifndef RTC_INPORTCONNECTOR_H
#define RTC_INPORTCONNECTOR_H
+#include <rtm/ConnectorListener.h>
#include <rtm/ConnectorBase.h>
namespace RTC
@@ -64,6 +65,7 @@
* @endif
*/
InPortConnector(ConnectorInfo& info,
+ ConnectorListeners& listeners,
CdrBufferBase* buffer);
/*!
@@ -249,6 +251,14 @@
ConnectorInfo m_profile;
/*!
* @if jp
+ * @brief ConnectorListenrs への参照
+ * @else
+ * @brief A reference to a ConnectorListener
+ * @endif
+ */
+ ConnectorListeners& m_listeners;
+ /*!
+ * @if jp
* @brief Connector が保持している Buffer
* @else
* @brief Connector's buffer
@@ -263,6 +273,15 @@
* @endif
*/
bool m_littleEndian;
+ /*!
+ * @if jp
+ * @brief OutPort 側の ConnectorListenrs への参照
+ * @else
+ * @brief A pointer to a OutPort's ConnectorListener
+ * @endif
+ */
+ ConnectorListeners* m_outPortListeners;
+
};
}; // namespace RTC
Added: trunk/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.cpp (rev 0)
+++ trunk/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.cpp 2015-06-29 00:49:25 UTC (rev 2642)
@@ -0,0 +1,135 @@
+// -*- C++ -*-
+/*!
+ * @file InPortDirectConsumer.h
+ * @brief InPortDirectConsumer class
+ * @date $Date$
+ * @author Noriaki Ando <n-ando at aist.go.jp>
+ *
+ * Copyright (C) 2015
+ * Noriaki Ando
+ * Task-intelligence Research Group,
+ * Intelligent Systems Research Institute,
+ * National Institute of
+ * Advanced Industrial Science and Technology (AIST), Japan
+ * All rights reserved.
+ *
+ * $Id$
+ *
+ */
+
+#include <rtm/NVUtil.h>
+#include <rtm/InPortDirectConsumer.h>
+
+namespace RTC
+{
+ /*!
+ * @if jp
+ * @brief コンストラクタ
+ * @else
+ * @brief Constructor
+ * @param buffer The buffer object that is attached to this Consumer
+ * @endif
+ */
+ InPortDirectConsumer::InPortDirectConsumer(void)
+ : rtclog("InPortDirectConsumer")
+ {
+ }
+
+ /*!
+ * @if jp
+ * @brief デストラクタ
+ * @else
+ * @brief Destructor
+ * @endif
+ */
+ InPortDirectConsumer::~InPortDirectConsumer(void)
+ {
+ RTC_PARANOID(("~InPortDirectConsumer()"));
+ }
+
+ /*!
+ * @if jp
+ * @brief 設定初期化
+ * @else
+ * @brief Initializing configuration
+ * @endif
+ */
+ void InPortDirectConsumer::init(coil::Properties& prop)
+ {
+ m_properties = prop;
+ }
+
+ /*!
+ * @if jp
+ * @brief バッファへのデータ書込
+ * @else
+ * @brief Write data into the buffer
+ * @endif
+ */
+ InPortConsumer::ReturnCode InPortDirectConsumer::
+ put(const cdrMemoryStream& data)
+ {
+ RTC_PARANOID(("put(): never called."));
+ return UNKNOWN_ERROR;
+ }
+
+ /*!
+ * @if jp
+ * @brief InterfaceProfile情報を公開する
+ * @else
+ * @brief Publish InterfaceProfile information
+ * @endif
+ */
+ void InPortDirectConsumer::
+ publishInterfaceProfile(SDOPackage::NVList& properties)
+ {
+ return;
+ }
+
+ /*!
+ * @if jp
+ * @brief データ送信通知への登録
+ * @else
+ * @brief Subscribe to the data sending notification
+ * @endif
+ */
+ bool InPortDirectConsumer::
+ subscribeInterface(const SDOPackage::NVList& properties)
+ {
+ RTC_TRACE(("subscribeInterface(): do nothing"));
+ return true;
+ }
+
+ /*!
+ * @if jp
+ * @brief データ送信通知からの登録解除
+ * @else
+ * @brief Unsubscribe the data send notification
+ * @endif
+ */
+ void InPortDirectConsumer::
+ unsubscribeInterface(const SDOPackage::NVList& properties)
+ {
+ RTC_TRACE(("unsubscribeInterface(): do nothing"));
+ }
+}; // namespace RTC
+
+extern "C"
+{
+ /*!
+ * @if jp
+ * @brief モジュール初期化関数
+ * @else
+ * @brief Module initialization
+ * @endif
+ */
+ void InPortDirectConsumerInit(void)
+ {
+ RTC::InPortConsumerFactory& factory(RTC::InPortConsumerFactory::instance());
+ factory.addFactory("direct",
+ ::coil::Creator< ::RTC::InPortConsumer,
+ ::RTC::InPortDirectConsumer>,
+ ::coil::Destructor< ::RTC::InPortConsumer,
+ ::RTC::InPortDirectConsumer>);
+ }
+};
Property changes on: trunk/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.cpp
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.h (rev 0)
+++ trunk/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.h 2015-06-29 00:49:25 UTC (rev 2642)
@@ -0,0 +1,252 @@
+// -*- C++ -*-
+/*!
+ * @file InPortDirectConsumer.h
+ * @brief InPortDirectConsumer class
+ * @date $Date: 2007-12-31 03:08:03 $
+ * @author Noriaki Ando <n-ando at aist.go.jp>
+ *
+ * Copyright (C) 2006
+ * Noriaki Ando
+ * Task-intelligence Research Group,
+ * Intelligent Systems Research Institute,
+ * National Institute of
+ * Advanced Industrial Science and Technology (AIST), Japan
+ * All rights reserved.
+ *
+ * $Id: InPortDirectConsumer.h 1255 2009-04-07 01:09:47Z kurihara $
+ *
+ */
+
+#ifndef RTC_INPORTDIRECTCONSUMER_H
+#define RTC_INPORTDIRECTCONSUMER_H
+
+
+//#include <rtm/BufferBase.h>
+
+#include <rtm/idl/DataPortSkel.h>
+#include <rtm/CorbaConsumer.h>
+#include <rtm/InPortConsumer.h>
+#include <rtm/Manager.h>
+
+namespace RTC
+{
+ /*!
+ * @if jp
+ * @class InPortDirectConsumer
+ * @brief InPortDirectConsumer クラス
+ *
+ * InPortConsumer
+ *
+ * データ転送に CORBA の OpenRTM::InPortCdr インターフェースを利用し
+ * た、push 型データフロー型を実現する InPort コンシューマクラス。
+ *
+ * @since 0.4.0
+ *
+ * @else
+ * @class InPortDirectConsumer
+ * @brief InPortDirectConsumer class
+ *
+ * The InPort consumer class which uses the OpenRTM::InPortCdr
+ * interface in CORBA for data transfer and realizes a push-type
+ * dataflow.
+ *
+ * @since 0.4.0
+ *
+ * @endif
+ */
+ class InPortDirectConsumer
+ : public InPortConsumer
+ {
+ public:
+ DATAPORTSTATUS_ENUM
+ /*!
+ * @if jp
+ * @brief コンストラクタ
+ *
+ * コンストラクタ
+ *
+ * @param buffer 当該コンシューマに割り当てるバッファオブジェクト
+ *
+ * @else
+ * @brief Constructor
+ *
+ * Constructor
+ *
+ * @param buffer The buffer object that is attached to this Consumer
+ *
+ * @endif
+ */
+ InPortDirectConsumer(void);
+
+ /*!
+ * @if jp
+ * @brief デストラクタ
+ *
+ * デストラクタ
+ *
+ * @else
+ * @brief Destructor
+ *
+ * Destructor
+ *
+ * @endif
+ */
+ virtual ~InPortDirectConsumer(void);
+
+ /*!
+ * @if jp
+ * @brief 設定初期化
+ *
+ * InPortConsumerの各種設定を行う。実装クラスでは、与えられた
+ * Propertiesから必要な情報を取得して各種設定を行う。この init() 関
+ * 数は、InPortProvider生成直後および、接続時にそれぞれ呼ばれる可
+ * 能性がある。したがって、この関数は複数回呼ばれることを想定して記
+ * 述されるべきである。
+ *
+ * @param prop 設定情報
+ *
+ * @else
+ *
+ * @brief Initializing configuration
+ *
+ * This operation would be called to configure in initialization.
+ * In the concrete class, configuration should be performed
+ * getting appropriate information from the given Properties data.
+ * This function might be called right after instantiation and
+ * connection sequence respectivly. Therefore, this function
+ * should be implemented assuming multiple call.
+ *
+ * @param prop Configuration information
+ *
+ * @endif
+ */
+ virtual void init(coil::Properties& prop);
+
+ /*!
+ * @if jp
+ * @brief 接続先へのデータ送信
+ *
+ * 接続先のポートへデータを送信するための純粋仮想関数。
+ *
+ * この関数は、以下のリターンコードを返す。
+ *
+ * - PORT_OK: 正常終了。
+ * - PORT_ERROR: データ送信の過程で何らかのエラーが発生した。
+ * - SEND_FULL: データを送信したが、相手側バッファがフルだった。
+ * - SEND_TIMEOUT: データを送信したが、相手側バッファがタイムアウトした。
+ * - UNKNOWN_ERROR: 原因不明のエラー
+ *
+ * @param data 送信するデータ
+ * @return リターンコード
+ *
+ * @else
+ * @brief Send data to the destination port
+ *
+ * Pure virtual function to send data to the destination port.
+ *
+ * This function might the following return codes
+ *
+ * - PORT_OK: Normal return
+ * - PORT_ERROR: Error occurred in data transfer process
+ * - SEND_FULL: Buffer full although OutPort tried to send data
+ * - SEND_TIMEOUT: Timeout although OutPort tried to send data
+ * - UNKNOWN_ERROR: Unknown error
+ *
+ * @endif
+ */
+ virtual ReturnCode put(const cdrMemoryStream& data);
+
+ /*!
+ * @if jp
+ * @brief InterfaceProfile情報を公開する
+ *
+ * InterfaceProfile情報を公開する。
+ * 引数で指定するプロパティ情報内の NameValue オブジェクトの
+ * dataport.interface_type 値を調べ、当該ポートに設定されている
+ * インターフェースタイプと一致する場合のみ情報を取得する。
+ *
+ * @param properties InterfaceProfile情報を受け取るプロパティ
+ *
+ * @else
+ * @brief Publish InterfaceProfile information
+ *
+ * Publish interfaceProfile information.
+ * Check the dataport.interface_type value of the NameValue object
+ * specified by an argument in property information and get information
+ * only when the interface type of the specified port is matched.
+ *
+ * @param properties Properties to get InterfaceProfile information
+ *
+ * @endif
+ */
+ virtual void publishInterfaceProfile(SDOPackage::NVList& properties);
+
+ /*!
+ * @if jp
+ * @brief データ送信通知への登録
+ *
+ * 指定されたプロパティに基づいて、データ送出通知の受け取りに登録する。
+ *
+ * @param properties 登録情報
+ *
+ * @return 登録処理結果(登録成功:true、登録失敗:false)
+ *
+ * @else
+ * @brief Subscribe to the data sending notification
+ *
+ * Subscribe to the data sending notification based on specified
+ * property information.
+ *
+ * @param properties Information for subscription
+ *
+ * @return Subscription result (Successful:true, Failed:false)
+ *
+ * @endif
+ */
+ virtual bool subscribeInterface(const SDOPackage::NVList& properties);
+
+ /*!
+ * @if jp
+ * @brief データ送信通知からの登録解除
+ *
+ * データ送出通知の受け取りから登録を解除する。
+ *
+ * @param properties 登録解除情報
+ *
+ * @else
+ * @brief Unsubscribe the data send notification
+ *
+ * Unsubscribe the data send notification.
+ *
+ * @param properties Information for unsubscription
+ *
+ * @endif
+ */
+ virtual void unsubscribeInterface(const SDOPackage::NVList& properties);
+
+ private:
+ mutable Logger rtclog;
+ coil::Properties m_properties;
+ };
+}; // namespace RTC
+
+extern "C"
+{
+ /*!
+ * @if jp
+ * @brief モジュール初期化関数
+ *
+ * InPortDirectConsumer のファクトリを登録する初期化関数。
+ *
+ * @else
+ * @brief Module initialization
+ *
+ * This initialization function registers InPortDirectConsumer's factory.
+ *
+ * @endif
+ */
+ void InPortDirectConsumerInit(void);
+};
+
+#endif // RTC_INPORTDIRECTCONSUMER_H
+
Property changes on: trunk/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.h
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.cpp (rev 0)
+++ trunk/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.cpp 2015-06-29 00:49:25 UTC (rev 2642)
@@ -0,0 +1,117 @@
+// -*- C++ -*-
+/*!
+ * @file InPortDirectProvider.cpp
+ * @brief InPortDirectProvider class
+ * @date $Date: 2008-01-14 07:49:59 $
+ * @author Noriaki Ando <n-ando at aist.go.jp>
+ *
+ * Copyright (C) 2009-2010
+ * Noriaki Ando
+ * Task-intelligence Research Group,
+ * Intelligent Systems Research Institute,
+ * National Institute of
+ * Advanced Industrial Science and Technology (AIST), Japan
+ * All rights reserved.
+ *
+ * $Id: InPortDirectProvider.cpp 1244 2009-03-13 07:25:42Z n-ando $
+ *
+ */
+
+#include <rtm/InPortDirectProvider.h>
+
+#ifdef WIN32
+#pragma warning( disable : 4290 )
+#endif
+
+namespace RTC
+{
+ /*!
+ * @if jp
+ * @brief コンストラクタ
+ * @else
+ * @brief Constructor
+ * @endif
+ */
+ InPortDirectProvider::InPortDirectProvider(void)
+ : m_buffer(0)
+ {
+ // PortProfile setting
+ setInterfaceType("direct");
+ }
+
+ /*!
+ * @if jp
+ * @brief デストラクタ
+ * @else
+ * @brief Destructor
+ * @endif
+ */
+ InPortDirectProvider::~InPortDirectProvider(void)
+ {
+ }
+
+ void InPortDirectProvider::init(coil::Properties& prop)
+ {
+ }
+
+ /*!
+ * @if jp
+ * @brief バッファをセットする
+ * @else
+ * @brief Setting outside buffer's pointer
+ * @endif
+ */
+ void InPortDirectProvider::
+ setBuffer(BufferBase<cdrMemoryStream>* buffer)
+ {
+ m_buffer = buffer;
+ }
+
+ /*!
+ * @if jp
+ * @brief リスナを設定する
+ * @else
+ * @brief Set the listener
+ * @endif
+ */
+ void InPortDirectProvider::setListener(ConnectorInfo& info,
+ ConnectorListeners* listeners)
+ {
+ m_profile = info;
+ m_listeners = listeners;
+ }
+
+ /*!
+ * @if jp
+ * @brief Connectorを設定する。
+ * @else
+ * @brief set Connector
+ * @endif
+ */
+ void InPortDirectProvider::setConnector(InPortConnector* connector)
+ {
+ m_connector = connector;
+ }
+
+}; // namespace RTC
+
+
+extern "C"
+{
+ /*!
+ * @if jp
+ * @brief モジュール初期化関数
+ * @else
+ * @brief Module initialization
+ * @endif
+ */
+ void InPortDirectProviderInit(void)
+ {
+ RTC::InPortProviderFactory& factory(RTC::InPortProviderFactory::instance());
+ factory.addFactory("direct",
+ ::coil::Creator< ::RTC::InPortProvider,
+ ::RTC::InPortDirectProvider>,
+ ::coil::Destructor< ::RTC::InPortProvider,
+ ::RTC::InPortDirectProvider>);
+ }
+};
Property changes on: trunk/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.cpp
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.h (rev 0)
+++ trunk/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.h 2015-06-29 00:49:25 UTC (rev 2642)
@@ -0,0 +1,376 @@
+// -*- C++ -*-
+/*!
+ * @file InPortDirectProvider.h
+ * @brief InPortDirectProvider class
+ * @date $Date: 2008-01-14 07:49:59 $
+ * @author Noriaki Ando <n-ando at aist.go.jp>
+ *
+ * Copyright (C) 2009
+ * Noriaki Ando
+ * Task-intelligence Research Group,
+ * Intelligent Systems Research Institute,
+ * National Institute of
+ * Advanced Industrial Science and Technology (AIST), Japan
+ * All rights reserved.
+ *
+ * $Id: InPortDirectProvider.h 1244 2009-03-13 07:25:42Z n-ando $
+ *
+ */
+
+#ifndef RTC_INPORTDIRECTPROVIDER_H
+#define RTC_INPORTDIRECTPROVIDER_H
+
+#include <rtm/BufferBase.h>
+#include <rtm/InPortProvider.h>
+#include <rtm/Manager.h>
+#include <rtm/ConnectorListener.h>
+#include <rtm/ConnectorBase.h>
+
+#ifdef WIN32
+#pragma warning( disable : 4290 )
+#endif
+
+namespace RTC
+{
+ /*!
+ * @if jp
+ * @class InPortDirectProvider
+ * @brief InPortDirectProvider クラス
+ *
+ * InPortProvider
+ *
+ * データ転送に CORBA の OpenRTM::InPortCdr インターフェースを利用し
+ * た、push 型データフロー型を実現する InPort プロバイダクラス。
+ *
+ * @since 0.4.0
+ *
+ * @else
+ * @class InPortDirectProvider
+ * @brief InPortDirectProvider class
+ *
+ * The InPort provider class which uses the OpenRTM::InPortCdr
+ * interface in CORBA for data transfer and realizes a push-type
+ * dataflow.
+ *
+ * @since 0.4.0
+ *
+ * @endif
+ */
+ class InPortDirectProvider
+ : public InPortProvider
+ {
+ public:
+ /*!
+ * @if jp
+ * @brief コンストラクタ
+ *
+ * コンストラクタ
+ *
+ * @else
+ * @brief Constructor
+ *
+ * Constructor
+ *
+ * @endif
+ */
+ InPortDirectProvider(void);
+
+ /*!
+ * @if jp
+ * @brief デストラクタ
+ *
+ * デストラクタ
+ *
+ * @else
+ * @brief Destructor
+ *
+ * Destructor
+ *
+ * @endif
+ */
+ virtual ~InPortDirectProvider(void);
+
+ /*!
+ * @if jp
+ * @brief 設定初期化
+ *
+ * InPortDirectProvider の各種設定を行う。与えられた
+ * Propertiesから必要な情報を取得して各種設定を行う。この init() 関
+ * 数は、InPortProvider生成直後および、接続時にそれぞれ呼ばれる可
+ * 能性がある。したがって、この関数は複数回呼ばれることを想定して記
+ * 述されるべきである。
+ *
+ * @param prop 設定情報
+ *
+ * @else
+ *
+ * @brief Initializing configuration
+ *
+ * This operation would be called to configure in initialization.
+ * In the concrete class, configuration should be performed
+ * getting appropriate information from the given Properties data.
+ * This function might be called right after instantiation and
+ * connection sequence respectivly. Therefore, this function
+ * should be implemented assuming multiple call.
+ *
+ * @param prop Configuration information
+ *
+ * @endif
+ */
+ virtual void init(coil::Properties& prop);
+
+ /*!
+ * @if jp
+ * @brief バッファをセットする
+ *
+ * OutPortProvider がデータを取り出すバッファをセットする。
+ * すでにセットされたバッファがある場合、以前のバッファへの
+ * ポインタに対して上書きされる。
+ * OutPortProviderはバッファの所有権を仮定していないので、
+ * バッファの削除はユーザの責任で行わなければならない。
+ *
+ * @param buffer OutPortProviderがデータを取り出すバッファへのポインタ
+ *
+ * @else
+ * @brief Setting outside buffer's pointer
+ *
+ * A pointer to a buffer from which OutPortProvider retrieve data.
+ * If already buffer is set, previous buffer's pointer will be
+ * overwritten by the given pointer to a buffer. Since
+ * OutPortProvider does not assume ownership of the buffer
+ * pointer, destructor of the buffer should be done by user.
+ *
+ * @param buffer A pointer to a data buffer to be used by OutPortProvider
+ *
+ * @endif
+ */
+ virtual void setBuffer(BufferBase<cdrMemoryStream>* buffer);
+
+ /*!
+ * @if jp
+ * @brief リスナを設定する。
+ *
+ * InPort はデータ送信処理における各種イベントに対して特定のリスナ
+ * オブジェクトをコールするコールバック機構を提供する。詳細は
+ * ConnectorListener.h の ConnectorDataListener, ConnectorListener
+ * 等を参照のこと。InPortDirectProvider では、以下のコールバック
+ * が提供される。
+ *
+ * - ON_BUFFER_WRITE
+ * - ON_BUFFER_FULL
+ * - ON_BUFFER_WRITE_TIMEOUT
+ * - ON_BUFFER_OVERWRITE
+ * - ON_RECEIVED
+ * - ON_RECEIVER_FULL
+ * - ON_RECEIVER_FULL
+ * - ON_RECEIVER_TIMEOUT
+ * - ON_RECEIVER_ERROR
+ *
+ * @param info 接続情報
+ * @param listeners リスナオブジェクト
+ *
+ * @else
+ * @brief Set the listener.
+ *
+ * InPort provides callback functionality that calls specific
+ * listener objects according to the events in the data publishing
+ * process. For details, see documentation of
+ * ConnectorDataListener class and ConnectorListener class in
+ * ConnectorListener.h. In this InPortDirectProvider provides
+ * the following callbacks.
+ *
+ * - ON_BUFFER_WRITE
+ * - ON_BUFFER_FULL
+ * - ON_BUFFER_WRITE_TIMEOUT
+ * - ON_BUFFER_OVERWRITE
+ * - ON_RECEIVED
+ * - ON_RECEIVER_FULL
+ * - ON_RECEIVER_FULL
+ * - ON_RECEIVER_TIMEOUT
+ * - ON_RECEIVER_ERROR
+ *
+ * @param info Connector information
+ * @param listeners Listener objects
+ *
+ * @endif
+ */
+ virtual void setListener(ConnectorInfo& info,
+ ConnectorListeners* listeners);
+
+ /*!
+ * @if jp
+ * @brief Connectorを設定する。
+ *
+ * InPort は接続確立時に InPortConnector オブジェクトを生成し、生
+ * 成したオブジェクトのポインタと共にこの関数を呼び出す。所有権は
+ * InPort が保持するので InPortProvider は InPortConnector を削
+ * 除してはいけない。
+ *
+ * @param connector InPortConnector
+ *
+ * @else
+ * @brief set Connector
+ *
+ * InPort creates InPortConnector object when it establishes
+ * connection between InPort and InPort, and it calls this
+ * function with a pointer to the connector object. Since the
+ * InPort has the ownership of this connector, InPortProvider
+ * should not delete it.
+ *
+ * @param connector InPortConnector
+ *
+ * @endif
+ */
+ virtual void setConnector(InPortConnector* connector);
+
+ private:
+
+ /*!
+ * @if jp
+ * @brief ON_BUFFER_WRITE のリスナへ通知する。
+ * @param data cdrMemoryStream
+ * @else
+ * @brief Notify an ON_BUFFER_WRITE event to listeners
+ * @param data cdrMemoryStream
+ * @endif
+ */
+ inline void onBufferWrite(const cdrMemoryStream& data)
+ {
+ m_listeners->
+ connectorData_[ON_BUFFER_WRITE].notify(m_profile, data);
+ }
+
+ /*!
+ * @if jp
+ * @brief ON_BUFFER_FULL のリスナへ通知する。
+ * @param data cdrMemoryStream
+ * @else
+ * @brief Notify an ON_BUFFER_FULL event to listeners
+ * @param data cdrMemoryStream
+ * @endif
+ */
+ inline void onBufferFull(const cdrMemoryStream& data)
+ {
+ m_listeners->
+ connectorData_[ON_BUFFER_FULL].notify(m_profile, data);
+ }
+
+ /*!
+ * @if jp
+ * @brief ON_BUFFER_WRITE_TIMEOUT のリスナへ通知する。
+ * @param data cdrMemoryStream
+ * @else
+ * @brief Notify an ON_BUFFER_WRITE_TIMEOUT event to listeners
+ * @param data cdrMemoryStream
+ * @endif
+ */
+ inline void onBufferWriteTimeout(const cdrMemoryStream& data)
+ {
+ m_listeners->
+ connectorData_[ON_BUFFER_WRITE_TIMEOUT].notify(m_profile, data);
+ }
+
+ /*!
+ * @if jp
+ * @brief ON_BUFFER_WRITE_OVERWRITE のリスナへ通知する。
+ * @param data cdrMemoryStream
+ * @else
+ * @brief Notify an ON_BUFFER_WRITE_OVERWRITE event to listeners
+ * @param data cdrMemoryStream
+ * @endif
+ */
+ inline void onBufferWriteOverwrite(const cdrMemoryStream& data)
+ {
+ m_listeners->
+ connectorData_[ON_BUFFER_OVERWRITE].notify(m_profile, data);
+ }
+
+ /*!
+ * @if jp
+ * @brief ON_RECEIVED のリスナへ通知する。
+ * @param data cdrMemoryStream
+ * @else
+ * @brief Notify an ON_RECEIVED event to listeners
+ * @param data cdrMemoryStream
+ * @endif
+ */
+ inline void onReceived(const cdrMemoryStream& data)
+ {
+ m_listeners->
+ connectorData_[ON_RECEIVED].notify(m_profile, data);
+ }
+
+ /*!
+ * @if jp
+ * @brief ON_RECEIVER_FULL のリスナへ通知する。
+ * @param data cdrMemoryStream
+ * @else
+ * @brief Notify an ON_RECEIVER_FULL event to listeners
+ * @param data cdrMemoryStream
+ * @endif
+ */
+ inline void onReceiverFull(const cdrMemoryStream& data)
+ {
+ m_listeners->
+ connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
+ }
+
+ /*!
+ * @if jp
+ * @brief ON_RECEIVER_TIMEOUT のリスナへ通知する。
+ * @else
+ * @brief Notify an ON_RECEIVER_TIMEOUT event to listeners
+ * @endif
+ */
+ inline void onReceiverTimeout(const cdrMemoryStream& data)
+ {
+ m_listeners->
+ connectorData_[ON_RECEIVER_TIMEOUT].notify(m_profile, data);
+ }
+
+ /*!
+ * @if jp
+ * @brief ON_RECEIVER_ERRORのリスナへ通知する。
+ * @else
+ * @Brief Notify an ON_RECEIVER_ERROR event to listeners
+ * @endif
+ */
+ inline void onReceiverError(const cdrMemoryStream& data)
+ {
+ m_listeners->
+ connectorData_[ON_RECEIVER_ERROR].notify(m_profile, data);
+ }
+
+ private:
+ CdrBufferBase* m_buffer;
+ ConnectorListeners* m_listeners;
+ ConnectorInfo m_profile;
+ InPortConnector* m_connector;
+
+ }; // class InPortCorCdrbaProvider
+}; // namespace RTC
+
+extern "C"
+{
+ /*!
+ * @if jp
+ * @brief モジュール初期化関数
+ *
+ * InPortDirectConsumer のファクトリを登録する初期化関数。
+ *
+ * @else
+ * @brief Module initialization
+ *
+ * This initialization function registers InPortDirectConsumer's factory.
+ *
+ * @endif
+ */
+ void InPortDirectProviderInit(void);
+};
+
+#ifdef WIN32
+#pragma warning( default : 4290 )
+#endif
+
+#endif // RTC_INPORTDIRECTPROVIDER_H
+
Property changes on: trunk/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.h
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/OpenRTM-aist/src/lib/rtm/InPortPullConnector.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/InPortPullConnector.cpp 2015-06-29 00:22:55 UTC (rev 2641)
+++ trunk/OpenRTM-aist/src/lib/rtm/InPortPullConnector.cpp 2015-06-29 00:49:25 UTC (rev 2642)
@@ -34,7 +34,7 @@
OutPortConsumer* consumer,
ConnectorListeners& listeners,
CdrBufferBase* buffer)
- : InPortConnector(info, buffer), m_consumer(consumer),
+ : InPortConnector(info, listeners, buffer), m_consumer(consumer),
m_listeners(listeners)
{
if (buffer == 0)
Modified: trunk/OpenRTM-aist/src/lib/rtm/InPortPushConnector.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/InPortPushConnector.cpp 2015-06-29 00:22:55 UTC (rev 2641)
+++ trunk/OpenRTM-aist/src/lib/rtm/InPortPushConnector.cpp 2015-06-29 00:49:25 UTC (rev 2642)
@@ -34,7 +34,7 @@
InPortProvider* provider,
ConnectorListeners& listeners,
CdrBufferBase* buffer)
- : InPortConnector(info, buffer),
+ : InPortConnector(info, listeners, buffer),
m_provider(provider),
m_listeners(listeners),
m_deleteBuffer(buffer == 0 ? true : false)
Modified: trunk/OpenRTM-aist/src/lib/rtm/Makefile.am
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/Makefile.am 2015-06-29 00:22:55 UTC (rev 2641)
+++ trunk/OpenRTM-aist/src/lib/rtm/Makefile.am 2015-06-29 00:49:25 UTC (rev 2642)
@@ -103,7 +103,9 @@
InPortCorbaCdrProvider.cpp \
OutPortCorbaCdrConsumer.cpp \
OutPortCorbaCdrProvider.cpp \
- InPortCorbaCdrConsumer.cpp
+ InPortCorbaCdrConsumer.cpp \
+ InPortDirectProvider.cpp \
+ InPortDirectConsumer.cpp
RTC_SRC = \
Modified: trunk/OpenRTM-aist/src/lib/rtm/OutPortBase.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/OutPortBase.cpp 2015-06-29 00:22:55 UTC (rev 2641)
+++ trunk/OpenRTM-aist/src/lib/rtm/OutPortBase.cpp 2015-06-29 00:49:25 UTC (rev 2642)
@@ -971,17 +971,20 @@
// endian type set
connector->setEndian(m_littleEndian);
- // set direct InPort if ConnectorProfile
- // .properties["dataport.outport.direct_dataput.disable"] != YES
- if (!coil::toBool(prop["direct_dataput.disable"], "YES", "NO", false))
+ // "interface_type" == "direct"
+ if (coil::normalize(prop["interface_type"]) == "direct")
{
InPortBase* inport = getLocalInPort(profile);
- if (inport != NULL)
+ if (inport == NULL)
{
- connector->setInPort(inport);
+ RTC_DEBUG(("interface_type is direct, "
+ "but a peer InPort servant could not be obtained."));
+ delete connector;
+ return 0;
}
+ connector->setInPort(inport);
}
- // end of direct port
+ // end of direct interface_type
m_connectors.push_back(connector);
RTC_PARANOID(("connector pushback done: size = %d",
@@ -1079,7 +1082,7 @@
}
catch (...)
{
- RTC_DEBUG(("Peer port is remote port"));
+ RTC_DEBUG(("Peer port might be a remote port"));
}
}
return NULL;
Modified: trunk/OpenRTM-aist/src/lib/rtm/OutPortConnector.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/OutPortConnector.cpp 2015-06-29 00:22:55 UTC (rev 2641)
+++ trunk/OpenRTM-aist/src/lib/rtm/OutPortConnector.cpp 2015-06-29 00:49:25 UTC (rev 2642)
@@ -28,9 +28,10 @@
* @brief Constructor
* @endif
*/
- OutPortConnector::OutPortConnector(ConnectorInfo& info)
+ OutPortConnector::OutPortConnector(ConnectorInfo& info,
+ ConnectorListeners& listeners)
: rtclog("OutPortConnector"), m_profile(info), m_littleEndian(true),
- m_directInPort(NULL)
+ m_directInPort(NULL), m_listeners(listeners)
{
}
Modified: trunk/OpenRTM-aist/src/lib/rtm/OutPortConnector.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/OutPortConnector.h 2015-06-29 00:22:55 UTC (rev 2641)
+++ trunk/OpenRTM-aist/src/lib/rtm/OutPortConnector.h 2015-06-29 00:49:25 UTC (rev 2642)
@@ -61,7 +61,7 @@
* @brief Constructor
* @endif
*/
- OutPortConnector(ConnectorInfo& info);
+ OutPortConnector(ConnectorInfo& info, ConnectorListeners& listeners);
/*!
* @if jp
@@ -213,16 +213,48 @@
{
if (m_directInPort != NULL)
{
- static_cast<InPort<DataType>*>(m_directInPort)->write(data);
+ InPort<DataType>* inport;
+ inprot = static_cast<InPort<DataType>*>(m_directInPort);
+ if (inport->isNew())
+ {
+ // ON_BUFFER_OVERWRITE(In,Out), ON_RECEIVER_FULL(In,Out) callback
+ m_listeners.
+ connectorData_[ON_BUFFER_OVERWRITE].notify(m_profile, data);
+ m_inPortListeners->
+ connectorData_[ON_BUFFER_OVERWRITE].notify(m_profile, data);
+ m_listeners.
+ connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
+ m_inPortListeners->
+ connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
+ RTC_PARANOID(("ONBUFFER_OVERWRITE(InPort,OutPort), "
+ "ON_RECEIVER_FULL(InPort,OutPort) "
+ "callback called in direct mode."));
+ }
+ // ON_BUFFER_WRITE(In,Out) callback
+ m_listeners.
+ connectorData_[ON_BUFFER_WRITE].notify(m_profile, data);
+ m_inPortListeners->
+ connectorData_[ON_BUFFER_WRITE].notify(m_profile, data);
+ RTC_PARANOID(("ON_BUFFER_WRITE(InPort,OutPort), "
+ "callback called in direct mode."));
+ inport->write(data); // write to InPort variable!!
+ // ON_RECEIVED(In,Out) callback
+ m_listeners.
+ connectorData_[ON_RECEIVED].notify(m_profile, data);
+ m_inPortListeners->
+ connectorData_[ON_RECEIVED].notify(m_profile, data);
+ RTC_PARANOID(("ON_RECEIVED(InPort,OutPort), "
+ "callback called in direct mode."));
return PORT_OK;
}
+ // normal case
m_cdr.rewindPtrs();
RTC_TRACE(("connector endian: %s", isLittleEndian() ? "little":"big"));
m_cdr.setByteSwapFlag(isLittleEndian());
data >>= m_cdr;
return write(m_cdr);
}
-
+
bool setInPort(InPortBase* directInPort)
{
if (directInPort == NULL)
@@ -230,6 +262,7 @@
return false;
}
m_directInPort = directInPort;
+ m_inPortListeners = &(m_directInPort->getListeners());
return true;
}
protected:
@@ -275,6 +308,24 @@
*/
InPortBase* m_directInPort;
+ /*!
+ * @if jp
+ * @brief ConnectorListenrs への参照
+ * @else
+ * @brief A reference to a ConnectorListener
+ * @endif
+ */
+ ConnectorListeners& m_listeners;
+
+ /*!
+ * @if jp
+ * @brief InPort 側の ConnectorListenrs への参照
+ * @else
+ * @brief A pointer to a InPort's ConnectorListener
+ * @endif
+ */
+ ConnectorListeners* m_inPortListeners;
+
};
}; // namespace RTC
Modified: trunk/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.cpp 2015-06-29 00:22:55 UTC (rev 2641)
+++ trunk/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.cpp 2015-06-29 00:49:25 UTC (rev 2642)
@@ -33,7 +33,7 @@
OutPortProvider* provider,
ConnectorListeners& listeners,
CdrBufferBase* buffer)
- : OutPortConnector(info),
+ : OutPortConnector(info, listeners),
m_provider(provider),
m_listeners(listeners),
m_buffer(buffer)
Modified: trunk/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.cpp 2015-06-29 00:22:55 UTC (rev 2641)
+++ trunk/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.cpp 2015-06-29 00:49:25 UTC (rev 2642)
@@ -35,7 +35,7 @@
InPortConsumer* consumer,
ConnectorListeners& listeners,
CdrBufferBase* buffer)
- : OutPortConnector(info),
+ : OutPortConnector(info, listeners),
m_consumer(consumer), m_publisher(0),
m_listeners(listeners), m_buffer(buffer)
{
More information about the openrtm-commit
mailing list