[openrtm-commit:02273] r2877 - branches/FSM4RTC/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 1月 19日 (木) 17:29:58 JST
Author: n-ando
Date: 2017-01-19 17:29:58 +0900 (Thu, 19 Jan 2017)
New Revision: 2877
Modified:
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/ConnectorListener.cpp
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/ConnectorListener.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortConsumer.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.cpp
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.cpp
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.cpp
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortConnector.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.cpp
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.cpp
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.cpp
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.cpp
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherBase.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherFlush.cpp
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherFlush.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherNew.cpp
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherNew.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.cpp
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.h
Log:
[FSM4RTC,incompat] Connector listeners intarfaces have been changed to modify info and data in the listeners and return its status. refs #3871
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/ConnectorListener.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/ConnectorListener.cpp 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/ConnectorListener.cpp 2017-01-19 08:29:58 UTC (rev 2877)
@@ -21,6 +21,18 @@
namespace RTC
{
+ ConnectorListenerStatus::Enum operator|(ConnectorListenerStatus::Enum L,
+ ConnectorListenerStatus::Enum R)
+ {
+ return static_cast<ConnectorListenerStatus::Enum>(static_cast<uint64_t>(L) |
+ static_cast<uint64_t>(R));
+ }
+ ConnectorListenerStatus::Enum operator&(ConnectorListenerStatus::Enum L,
+ ConnectorListenerStatus::Enum R)
+ {
+ return static_cast<ConnectorListenerStatus::Enum>(static_cast<uint64_t>(L) &
+ static_cast<uint64_t>(R));
+ }
/*!
* @if jp
* @class ConnectorDataListener クラス
@@ -98,14 +110,17 @@
return m_listeners.size();
}
- void ConnectorDataListenerHolder::notify(const ConnectorInfo& info,
- const cdrMemoryStream& cdrdata)
+ ConnectorDataListenerHolder::ReturnCode
+ ConnectorDataListenerHolder::notify(ConnectorInfo& info,
+ cdrMemoryStream& cdrdata)
{
Guard guard(m_mutex);
+ ConnectorListenerHolder::ReturnCode ret(NO_CHANGE);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
- m_listeners[i].first->operator()(info, cdrdata);
+ ret = ret | m_listeners[i].first->operator()(info, cdrdata);
}
+ return ret;
}
@@ -119,8 +134,8 @@
ConnectorListenerHolder::ConnectorListenerHolder()
{
}
-
-
+
+
ConnectorListenerHolder::~ConnectorListenerHolder()
{
Guard guard(m_mutex);
@@ -159,22 +174,24 @@
return;
}
}
-
}
-
+
size_t ConnectorListenerHolder::size()
{
Guard guard(m_mutex);
return m_listeners.size();
}
-
- void ConnectorListenerHolder::notify(const ConnectorInfo& info)
+
+ ConnectorListenerHolder::ReturnCode
+ ConnectorListenerHolder::notify(ConnectorInfo& info)
{
Guard guard(m_mutex);
+ ConnectorListenerHolder::ReturnCode ret;
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
- m_listeners[i].first->operator()(info);
+ ret = ret | m_listeners[i].first->operator()(info);
}
+ return ret;
}
};
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/ConnectorListener.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/ConnectorListener.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/ConnectorListener.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -5,10 +5,8 @@
* @date $Date$
* @author Noriaki Ando <n-ando at aist.go.jp>
*
- * Copyright (C) 2009
+ * Copyright (C) 2009-2017
* Noriaki Ando
- * Task-intelligence Research Group,
- * Intelligent Systems Research Institute,
* National Institute of
* Advanced Industrial Science and Technology (AIST), Japan
* All rights reserved.
@@ -32,9 +30,82 @@
namespace RTC
{
class ConnectorInfo;
+ /*!
+ * @if jp
+ * @class ConnectorListenerStatus mixin class
+ * @brief ConnectorListenerStatus mixin クラス
+ *
+ * このクラスは、enum定義されたリターンコードを、ConnectorListener関
+ * 連のサブクラスで共通利用するための mixin クラスである。このリター
+ * ンコードを使用するクラスでは、ConnectorListenerStatus クラスを
+ * public 継承し、下にdefine してある CONNLISTENER_STATUS_ENUM をクラ
+ * ス内に記述することで利用可能となる。これにより、enum を
+ * ReturnCode 型として typedef し、以後 ReturnCode を利用できるように
+ * するとともに、名前空間に enum 定義された各識別子を当該クラス名前空
+ * 間内に導入する。
+ *
+ * @else
+ * @class DataPortStatus mixin class
+ * @brief DataPortStatus mixin class
+ *
+ * This is a mixin class to provide enumed return codes that are
+ * commonly utilised in connector listener related sub-classes. To
+ * use this class, sub-class should inherit this class as a public
+ * super class, and declare CONNLISTENERSTATUS_ENUM defined
+ * below. Consequently, ReturnCode type that is typedefed by this
+ * macro can be used in the sub-class, and enumed identifiers are
+ * imported to the class's namespace.
+ *
+ * @endif
+ */
+ class ConnectorListenerStatus
+ {
+ public:
+ enum Enum
+ {
+ NO_CHANGE = 0,
+ INFO_CHANGED = 1 << 0,
+ DATA_CHANGED = 1 << 1,
+ BOTH_CHANGED = INFO_CHANGED | DATA_CHANGED
+ };
+ };
+ ConnectorListenerStatus::Enum operator|(ConnectorListenerStatus::Enum L,
+ ConnectorListenerStatus::Enum R);
+ ConnectorListenerStatus::Enum operator&(ConnectorListenerStatus::Enum L,
+ ConnectorListenerStatus::Enum R);
/*!
* @if jp
+ *
+ * @brief ::RTC::ConnDataPortStatus 導入
+ *
+ * ::RTC::DataPortStatus で宣言されている Enum のすべてのメンバをネーム
+ * スペースに導入するためのマクロ。DataPortStatus を利用するクラスにお
+ * いて、クラス宣言の先頭において DATAPORTSTATUS_ENUM を記載するだけで、
+ * DataPortStatus で宣言されている enum メンバが名前解決演算子なしにア
+ * クセス可能になる。
+ *
+ * @else
+ *
+ * @brief Importing ::RTC::DataPortStatus macro
+ *
+ * This macro imports all the member of enum declared in
+ * ::RTC::DataPortStatus into the current namespace. Inserting at the
+ * head of class declaration, classes which utilize DataPortStatus can
+ * access Enum members of DataPortStatus without using namespace
+ * resolve operator.
+ *
+ * @endif
+ */
+#define USE_CONNLISTENER_STATUS \
+ typedef ::RTC::ConnectorListenerStatus::Enum ReturnCode; \
+ using ::RTC::ConnectorListenerStatus::NO_CHANGE; \
+ using ::RTC::ConnectorListenerStatus::INFO_CHANGED; \
+ using ::RTC::ConnectorListenerStatus::DATA_CHANGED; \
+ using ::RTC::ConnectorListenerStatus::BOTH_CHANGED;
+
+ /*!
+ * @if jp
* @brief ConnectorDataListener のタイプ
*
* - ON_BUFFER_WRITE: バッファ書き込み時
@@ -50,7 +121,7 @@
*
* @else
* @brief The types of ConnectorDataListener
- *
+ *
* - ON_BUFFER_WRITE: At the time of buffer write
* - ON_BUFFER_FULL: At the time of buffer full
* - ON_BUFFER_WRITE_TIMEOUT: At the time of buffer write timeout
@@ -66,15 +137,15 @@
*/
enum ConnectorDataListenerType
{
- ON_BUFFER_WRITE = 0,
- ON_BUFFER_FULL,
- ON_BUFFER_WRITE_TIMEOUT,
- ON_BUFFER_OVERWRITE,
- ON_BUFFER_READ,
- ON_SEND,
+ ON_BUFFER_WRITE = 0,
+ ON_BUFFER_FULL,
+ ON_BUFFER_WRITE_TIMEOUT,
+ ON_BUFFER_OVERWRITE,
+ ON_BUFFER_READ,
+ ON_SEND,
ON_RECEIVED,
- ON_RECEIVER_FULL,
- ON_RECEIVER_TIMEOUT,
+ ON_RECEIVER_FULL,
+ ON_RECEIVER_TIMEOUT,
ON_RECEIVER_ERROR,
CONNECTOR_DATA_LISTENER_NUM
};
@@ -96,14 +167,55 @@
* 場合などにコールされるファンクタの引数に何もとらならい
* ConnecotorListener がある。
*
- * データポートには、接続時にデータの送受信方法についてデータフロー型、
- * サブスクリプション型等を設定することができる。
- * ConnectorDaataListener/ConnectorListener はともに、様々なイベント
- * に対するコールバックを設定することができるが、これらデータフロー型
- * およびサブスクリプション型の設定に応じて、利用可能なもの利用不可能
- * なものや、呼び出されるタイミングが異なる。
- * 以下に、インターフェースがCORBA CDR型の場合のコールバック一覧を示す。
+ * ConnectorDataListener クラスによってデータが関連する動作をフックし
+ * たい場合、以下の例のように、このクラスを継承し、コネクタの情報とデー
+ * タを引数に取る以下のようなコールバックオブジェクトを定義し、データ
+ * ポートの適切なコールバック設定関数からコールバックオブジェクトをセッ
+ * トする必要がある。なお、Data Listener には、データとしてマーシャリ
+ * ング後のデータを引数に取る ConnectorDataListener と、データを特定
+ * の型にアンマーシャルした後の値を引数に取る、
+ * ConnectorDataListenerT がある。以下の例は、ConnectorDataListenerT
+ * の定義例である。
*
+ * <pre>
+ * class MyDataListener
+ * : public ConnectorDataListenerT<RTC::TimedLong>
+ * {
+ * public:
+ * MyDataListener(const char* name) : m_name(name) {}
+ * virtual ~MyDataListener() {}
+ * virtual ReturnCode operator()(ConnectorInfo& info, TimedLong& data)
+ * {
+ * std::cout << "Data Listener: " << m_name << std::endl;
+ * std::cout << "Data: " << data.data << std::endl;
+ * std::cout << "Profile::name: " << info.name << std::endl;
+ * std::cout << "Profile::id: " << info.id << std::endl;
+ * std::cout << "Profile::properties: " << std::endl;
+ * std::cout << info.properties;
+ * };
+ * std::string m_name;
+ * };
+ * </pre>
+ *
+ * このようにして定義されたリスナクラスは、以下のようにデータポートに
+ * 対して、以下のようにセットされる。
+ *
+ * <pre>
+ * RTC::ReturnCode_t ConsoleIn::onInitialize()
+ * {
+ * m_outOut.
+ * addConnectorDataListener(ON_BUFFER_WRITE,
+ * new MyDataListener("ON_BUFFER_WRITE"));
+ * :
+ * </pre>
+ *
+ * 第1引数の "ON_BUFFER_WRITE" は、コールバックをフックするポイントで
+ * あり、以下に列挙する値を取ることが可能である。データポートには、接
+ * 続時にデータの送受信方法について、インターフェース型、データフロー
+ * 型、サブスクリプション型等を設定することができるが、これらの設定に
+ * よりフックされるポイントは異なる。以下に、インターフェースがCORBA
+ * CDR型の場合のコールバック一覧を示す。
+ *
* OutPort:
* - Push型: Subscription Typeによりさらにイベントの種類が分かれる。
* - Flush: Flush型にはバッファがないため ON_BUFFER 系のイベントは発生しない
@@ -112,8 +224,6 @@
* - ON_RECEIVER_FULL
* - ON_RECEIVER_TIMEOUT
* - ON_RECEIVER_ERROR
- * - ON_CONNECT
- * - ON_DISCONNECT
* .
* - New型
* - ON_BUFFER_WRITE
@@ -126,9 +236,6 @@
* - ON_RECEIVER_FULL
* - ON_RECEIVER_TIMEOUT
* - ON_RECEIVER_ERROR
- * - ON_SENDER_ERROR
- * - ON_CONNECT
- * - ON_DISCONNECT
* .
* - Periodic型
* - ON_BUFFER_WRITE
@@ -140,54 +247,162 @@
* - ON_RECEIVER_FULL
* - ON_RECEIVER_TIMEOUT
* - ON_RECEIVER_ERROR
- * - ON_BUFFER_EMPTY
- * - ON_SENDER_EMPTY
- * - ON_SENDER_ERROR
- * - ON_CONNECT
- * - ON_DISCONNECT
* .
* .
* - Pull型
+ * - ON_BUFFER_WRITE
+ * - ON_BUFFER_FULL
+ * - ON_BUFFER_WRITE_TIMEOUT
+ * - ON_BUFFER_OVERWRITE
* - ON_BUFFER_READ
* - ON_SEND
- * - ON_BUFFER_EMPTY
- * - ON_BUFFER_READ_TIMEOUT
- * - ON_SENDER_EMPTY
- * - ON_SENDER_TIMEOUT
- * - ON_SENDER_ERROR
- * - ON_CONNECT
- * - ON_DISCONNECT
- *
+ * .
* InPort:
* - Push型:
* - ON_BUFFER_WRITE
* - ON_BUFFER_FULL
* - ON_BUFFER_WRITE_TIMEOUT
* - ON_BUFFER_WRITE_OVERWRITE
+ * - ON_BUFFER_READ
+ * - ON_BUFFER_READ_TIMEOUT
* - ON_RECEIVED
* - ON_RECEIVER_FULL
* - ON_RECEIVER_TIMEOUT
* - ON_RECEIVER_ERROR
- * - ON_CONNECT
- * - ON_DISCONNECT
* .
* - Pull型
- * - ON_CONNECT
- * - ON_DISCONNECT
+ * - ON_BUFFER_READ
*
* @else
* @class ConnectorDataListener class
* @brief ConnectorDataListener class
*
* This class is abstract base class for listener classes that
- * provides callbacks for various events in the data port's
+ * realize callbacks for various events in the data port's
* connectors.
*
+ * Callbacks can be hooked to the various kind of events which occur
+ * throgh OutPort side data write action to InPort side data-read
+ * action. Two types listener classes exist. One is
+ * ConnectorDataListener which receives valid data-port's data value
+ * at that time such as buffer-full event, data-send event, and so
+ * on. Other is ConnectorListener which does not receive any data
+ * such as buffer-empty event, buffer-read-timeout event and so on.
+ *
+ * If you want to hook actions which related data-port's data by
+ * ConnectorDataListener, a class which inherits this class should
+ * be defined, and the functor should receive a connector
+ * information and a data value as arguments. And then, the defined
+ * class must be set to data-port object through its member
+ * function, as follows. Two types of ConnectorDataListeners are
+ * available. One is "ConnectorDataListener" which receives
+ * marshalled data as data value, the other is
+ * "ConnectorDataListenerT" which receives unmarshalled data as data
+ * value. The following example is the use of ConnectorDataListenerT.
+ *
+ * <pre>
+ * class MyDataListener
+ * : public ConnectorDataListenerT<RTC::TimedLong>
+ * {
+ * public:
+ * MyDataListener(const char* name) : m_name(name) {}
+ * virtual ~MyDataListener() {}
+ * virtual ReturnCode operator()(ConnectorInfo& info, TimedLong& data)
+ * {
+ * std::cout << "Data Listener: " << m_name << std::endl;
+ * std::cout << "Data: " << data.data << std::endl;
+ * std::cout << "Profile::name: " << info.name << std::endl;
+ * std::cout << "Profile::id: " << info.id << std::endl;
+ * std::cout << "Profile::properties: " << std::endl;
+ * std::cout << info.properties;
+ * };
+ * std::string m_name;
+ * };
+ * </pre>
+ *
+ * The listener class defained as above can be attached to a
+ * data-port as follows.
+ *
+ * <pre>
+ * RTC::ReturnCode_t ConsoleIn::onInitialize()
+ * {
+ * m_outOut.
+ * addConnectorDataListener(ON_BUFFER_WRITE,
+ * new MyDataListener("ON_BUFFER_WRITE"));
+ * :
+ * </pre>
+ *
+ * The first argument "ON_BUFFER_WRITE" specifies hook point of
+ * callback, and the following values are available. Data-port can
+ * be specified some properties such as interface-type,
+ * dataflow-type, subscription type and so on. Available hook points
+ * vary by the those settings. The following hook points are
+ * available when interface type is CORBA CDR type.
+ *
+ * OutPort:
+ * - Push type: Available hook event varies by subscription type.
+ * - Flush: No ON_BUFFER* events since flush-type has no buffer.
+ * - ON_SEND
+ * - ON_RECEIVED
+ * - ON_RECEIVER_FULL
+ * - ON_RECEIVER_TIMEOUT
+ * - ON_RECEIVER_ERROR
+ * .
+ * - New type:
+ * - ON_BUFFER_WRITE
+ * - ON_BUFFER_FULL
+ * - ON_BUFFER_WRITE_TIMEOUT
+ * - ON_BUFFER_OVERWRITE
+ * - ON_BUFFER_READ
+ * - ON_SEND
+ * - ON_RECEIVED
+ * - ON_RECEIVER_FULL
+ * - ON_RECEIVER_TIMEOUT
+ * - ON_RECEIVER_ERROR
+ * .
+ * - Periodic type:
+ * - ON_BUFFER_WRITE
+ * - ON_BUFFER_FULL
+ * - ON_BUFFER_WRITE_TIMEOUT
+ * - ON_BUFFER_READ
+ * - ON_SEND
+ * - ON_RECEIVED
+ * - ON_RECEIVER_FULL
+ * - ON_RECEIVER_TIMEOUT
+ * - ON_RECEIVER_ERROR
+ * .
+ * .
+ * - Pull type:
+ * - ON_BUFFER_WRITE
+ * - ON_BUFFER_FULL
+ * - ON_BUFFER_WRITE_TIMEOUT
+ * - ON_BUFFER_OVERWRITE
+ * - ON_BUFFER_READ
+ * - ON_SEND
+ * .
+ * InPort:
+ * - Push type:
+ * - ON_BUFFER_WRITE
+ * - ON_BUFFER_FULL
+ * - ON_BUFFER_WRITE_TIMEOUT
+ * - ON_BUFFER_WRITE_OVERWRITE
+ * - ON_BUFFER_READ
+ * - ON_BUFFER_READ_TIMEOUT
+ * - ON_RECEIVED
+ * - ON_RECEIVER_FULL
+ * - ON_RECEIVER_TIMEOUT
+ * - ON_RECEIVER_ERROR
+ * .
+ * - Pull type
+ * - ON_BUFFER_READ
+ *
* @endif
*/
class ConnectorDataListener
+ : public ConnectorListenerStatus
{
public:
+ USE_CONNLISTENER_STATUS;
/*!
* @if jp
*
@@ -256,8 +471,8 @@
*
* @endif
*/
- virtual void operator()(const ConnectorInfo& info,
- const cdrMemoryStream& data) = 0;
+ virtual ReturnCode operator()(ConnectorInfo& info,
+ cdrMemoryStream& data) = 0;
};
/*!
@@ -323,12 +538,12 @@
*
* @endif
*/
- virtual void operator()(const ConnectorInfo& info,
- const cdrMemoryStream& cdrdata)
+ virtual ReturnCode operator()(ConnectorInfo& info,
+ cdrMemoryStream& cdrdata)
{
DataType data;
cdrMemoryStream cdr(cdrdata.bufPtr(), cdrdata.bufSize());
-
+
// endian type check
std::string endian_type;
endian_type = info.properties.getProperty("serializer.cdr.endian",
@@ -344,7 +559,13 @@
cdr.setByteSwapFlag(false);
}
data <<= cdr;
- this->operator()(info, data);
+ ReturnCode ret = this->operator()(info, data);
+ if (ret == DATA_CHANGED || ret == BOTH_CHANGED)
+ {
+ cdrdata.rewindPtrs();
+ data >>= cdrdata;
+ }
+ return ret;
}
/*!
@@ -364,9 +585,8 @@
*
* @endif
*/
- virtual void operator()(const ConnectorInfo& info,
- const DataType& data) = 0;
-
+ virtual ReturnCode operator()(ConnectorInfo& info,
+ DataType& data) = 0;
};
@@ -399,9 +619,9 @@
{
ON_BUFFER_EMPTY = 0,
ON_BUFFER_READ_TIMEOUT,
- ON_SENDER_EMPTY,
- ON_SENDER_TIMEOUT,
- ON_SENDER_ERROR,
+ ON_SENDER_EMPTY,
+ ON_SENDER_TIMEOUT,
+ ON_SENDER_ERROR,
ON_CONNECT,
ON_DISCONNECT,
CONNECTOR_LISTENER_NUM
@@ -424,51 +644,62 @@
* 場合などにコールされるファンクタの引数に何もとらならい
* ConnecotorListener がある。
*
- * データポートには、接続時にデータの送受信方法についてデータフロー型、
- * サブスクリプション型等を設定することができる。
- * ConnectorDaataListener/ConnectorListener は共にに、様々なイベント
- * に対するコールバックを設定することができるが、これらデータフロー型
- * およびサブスクリプション型の設定に応じて、利用できるもの、できない
- * もの、また呼び出されるタイミングが異なる。以下に、インターフェース
- * がCORBA CDR型の場合のコールバック一覧を示す。
+ * ConnectorListener クラスによって関連する動作をフックしたい場合、以
+ * 下の例のように、このクラスを継承し、コネクタの情報を引数に取る以下
+ * のようなコールバックオブジェクトを定義し、データポートの適切なコー
+ * ルバック設定関数からコールバックオブジェクトをセットする必要がある。
*
+ * <pre>
+ * class MyListener
+ * : public ConnectorListener
+ * {
+ * public:
+ * MyListener(const char* name) : m_name(name) {}
+ * virtual ~MyListener() {}
+ * virtual ReturnCode operator()(ConnectorInfo& info)
+ * {
+ * std::cout << "Data Listener: " << m_name << std::endl;
+ * std::cout << "Profile::name: " << info.name << std::endl;
+ * std::cout << "Profile::id: " << info.id << std::endl;
+ * std::cout << "Profile::properties: " << std::endl;
+ * std::cout << info.properties;
+ * };
+ * std::string m_name;
+ * };
+ * </pre>
+ *
+ * このようにして定義されたリスナクラスは、以下のようにデータポートに
+ * 対して、以下のようにセットされる。
+ *
+ * <pre>
+ * RTC::ReturnCode_t ConsoleIn::onInitialize()
+ * {
+ * m_outOut.
+ * addConnectorListener(ON_BUFFER_EMPTY,
+ * new MyListener("ON_BUFFER_EMPTY"));
+ * :
+ * </pre>
+ *
+ * 第1引数の "ON_BUFFER_EMPTY" は、コールバックをフックするポイントで
+ * あり、以下に列挙する値を取ることが可能である。データポートには、接
+ * 続時にデータの送受信方法について、インターフェース型、データフロー
+ * 型、サブスクリプション型等を設定することができるが、これらの設定に
+ * よりフックされるポイントは異なる。以下に、インターフェースがCORBA
+ * CDR型の場合のコールバック一覧を示す。
+ *
* OutPort:
* - Push型: Subscription Typeによりさらにイベントの種類が分かれる。
* - Flush: Flush型にはバッファがないため ON_BUFFER 系のイベントは発生しない
- * - ON_SEND
- * - ON_RECEIVED
- * - ON_RECEIVER_FULL
- * - ON_RECEIVER_TIMEOUT
- * - ON_RECEIVER_ERROR
* - ON_CONNECT
* - ON_DISCONNECT
* .
* - New型
- * - ON_BUFFER_WRITE
- * - ON_BUFFER_FULL
- * - ON_BUFFER_WRITE_TIMEOUT
- * - ON_BUFFER_OVERWRITE
- * - ON_BUFFER_READ
- * - ON_SEND
- * - ON_RECEIVED
- * - ON_RECEIVER_FULL
- * - ON_RECEIVER_TIMEOUT
- * - ON_RECEIVER_ERROR
- * - ON_SENDER_ERROR
* - ON_CONNECT
* - ON_DISCONNECT
* .
* - Periodic型
- * - ON_BUFFER_WRITE
- * - ON_BUFFER_FULL
- * - ON_BUFFER_WRITE_TIMEOUT
- * - ON_BUFFER_READ
- * - ON_SEND
- * - ON_RECEIVED
- * - ON_RECEIVER_FULL
- * - ON_RECEIVER_TIMEOUT
- * - ON_RECEIVER_ERROR
* - ON_BUFFER_EMPTY
+ * - ON_BUFFER_READ_TIMEOUT
* - ON_SENDER_EMPTY
* - ON_SENDER_ERROR
* - ON_CONNECT
@@ -476,8 +707,6 @@
* .
* .
* - Pull型
- * - ON_BUFFER_READ
- * - ON_SEND
* - ON_BUFFER_EMPTY
* - ON_BUFFER_READ_TIMEOUT
* - ON_SENDER_EMPTY
@@ -485,17 +714,11 @@
* - ON_SENDER_ERROR
* - ON_CONNECT
* - ON_DISCONNECT
- *
+ * .
* InPort:
* - Push型:
- * - ON_BUFFER_WRITE
- * - ON_BUFFER_FULL
- * - ON_BUFFER_WRITE_TIMEOUT
- * - ON_BUFFER_WRITE_OVERWRITE
- * - ON_RECEIVED
- * - ON_RECEIVER_FULL
- * - ON_RECEIVER_TIMEOUT
- * - ON_RECEIVER_ERROR
+ * - ON_BUFFER_EMPTY
+ * - ON_BUFFER_READ_TIMEOUT
* - ON_CONNECT
* - ON_DISCONNECT
* .
@@ -508,14 +731,108 @@
* @brief ConnectorListener class
*
* This class is abstract base class for listener classes that
- * provides callbacks for various events in the data port's
+ * realize callbacks for various events in the data port's
* connectors.
*
+ * Callbacks can be hooked to the various kind of events which occur
+ * throgh OutPort side data write action to InPort side data-read
+ * action. Two types listener classes exist. One is
+ * ConnectorDataListener which receives valid data-port's data value
+ * at that time such as buffer-full event, data-send event, and so
+ * on. Other is ConnectorListener which does not receive any data
+ * such as buffer-empty event, buffer-read-timeout event and so on.
+ *
+ * If you want to hook related actions by
+ * ConnectorListener, a class which inherits this class should
+ * be defined, and the functor should receive a connector
+ * information as an argument. And then, the defined
+ * class must be set to data-port object through its member
+ * function, as follows.
+ *
+ * <pre>
+ * class MyListener
+ * : public ConnectorListener
+ * {
+ * public:
+ * MyListener(const char* name) : m_name(name) {}
+ * virtual ~MyListener() {}
+ * virtual ReturnCode operator()(ConnectorInfo& info)
+ * {
+ * std::cout << "Data Listener: " << m_name << std::endl;
+ * std::cout << "Profile::name: " << info.name << std::endl;
+ * std::cout << "Profile::id: " << info.id << std::endl;
+ * std::cout << "Profile::properties: " << std::endl;
+ * std::cout << info.properties;
+ * };
+ * std::string m_name;
+ * };
+ * </pre>
+ *
+ * The listener class defained as above can be attached to a
+ * data-port as follows.
+ *
+ * <pre>
+ * RTC::ReturnCode_t ConsoleIn::onInitialize()
+ * {
+ * m_outOut.
+ * addConnectorListener(ON_BUFFER_EMPTY,
+ * new MyDataListener("ON_BUFFER_EMPTY"));
+ * :
+ * </pre>
+ *
+ * The first argument "ON_BUFFER_EMPTY" specifies hook point of
+ * callback, and the following values are available. Data-port can
+ * be specified some properties such as interface-type,
+ * dataflow-type, subscription type and so on. Available hook points
+ * vary by the those settings. The following hook points are
+ * available when interface type is CORBA CDR type.
+ *
+ * OutPort:
+ * - Push type: Available hook event varies by subscription type.
+ * - Flush: No ON_BUFFER* events since flush-type has no buffer.
+ * - ON_CONNECT
+ * - ON_DISCONNECT
+ * .
+ * - New type:
+ * - ON_CONNECT
+ * - ON_DISCONNECT
+ * .
+ * - Periodic type:
+ * - ON_BUFFER_EMPTY
+ * - ON_BUFFER_READ_TIMEOUT
+ * - ON_SENDER_EMPTY
+ * - ON_SENDER_ERROR
+ * - ON_CONNECT
+ * - ON_DISCONNECT
+ * .
+ * .
+ * - Pull type:
+ * - ON_BUFFER_EMPTY
+ * - ON_BUFFER_READ_TIMEOUT
+ * - ON_SENDER_EMPTY
+ * - ON_SENDER_TIMEOUT
+ * - ON_SENDER_ERROR
+ * - ON_CONNECT
+ * - ON_DISCONNECT
+ * .
+ * InPort:
+ * - Push type:
+ * - ON_BUFFER_EMPTY
+ * - ON_BUFFER_READ_TIMEOUT
+ * - ON_CONNECT
+ * - ON_DISCONNECT
+ * .
+ * - Pull type:
+ * - ON_CONNECT
+ * - ON_DISCONNECT
+ *
* @endif
*/
class ConnectorListener
+ : public ConnectorListenerStatus
{
public:
+ USE_CONNLISTENER_STATUS;
/*!
* @if jp
*
@@ -582,7 +899,7 @@
*
* @endif
*/
- virtual void operator()(const ConnectorInfo& info) = 0;
+ virtual ReturnCode operator()(ConnectorInfo& info) = 0;
};
@@ -602,10 +919,12 @@
* @endif
*/
class ConnectorDataListenerHolder
+ : public ConnectorListenerStatus
{
typedef std::pair<ConnectorDataListener*, bool> Entry;
typedef coil::Guard<coil::Mutex> Guard;
public:
+ USE_CONNLISTENER_STATUS;
/*!
* @if jp
* @brief コンストラクタ
@@ -703,8 +1022,8 @@
* @param cdrdata Data
* @endif
*/
- void notify(const ConnectorInfo& info,
- const cdrMemoryStream& cdrdata);
+ ReturnCode notify(ConnectorInfo& info,
+ cdrMemoryStream& cdrdata);
/*!
* @if jp
@@ -712,7 +1031,7 @@
* @brief リスナーへ通知する(データ型指定版)
*
* 登録されているリスナのコールバックメソッドを呼び出す。
- * COnnectorDataListenerT 型のコールバックのみコールされる。
+ * ConnectorDataListenerT 型のコールバックのみコールされる。
*
* @param info ConnectorInfo
* @param typeddata データ(データ型指定あり)
@@ -728,9 +1047,10 @@
* @endif
*/
template <class DataType>
- void notify(const ConnectorInfo& info, const DataType& typeddata)
+ ReturnCode notify(ConnectorInfo& info, DataType& typeddata)
{
Guard guard(m_mutex);
+ ReturnCode ret(NO_CHANGE);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
ConnectorDataListenerT<DataType>* listener(0);
@@ -738,9 +1058,16 @@
dynamic_cast<ConnectorDataListenerT<DataType>*>(m_listeners[i].first);
if (listener != 0)
{
- listener->operator()(info, typeddata);
+ ret = ret | listener->operator()(info, typeddata);
}
+ else
+ {
+ cdrMemoryStream cdr;
+ typeddata >>= cdr;
+ ret = ret | m_listeners[i].first->operator()(info, cdr);
+ }
}
+ return ret;
}
private:
@@ -765,10 +1092,12 @@
* @endif
*/
class ConnectorListenerHolder
+ : public ConnectorListenerStatus
{
typedef std::pair<ConnectorListener*, bool> Entry;
typedef coil::Guard<coil::Mutex> Guard;
public:
+ USE_CONNLISTENER_STATUS;
/*!
* @if jp
* @brief コンストラクタ
@@ -865,7 +1194,7 @@
* @param info ConnectorInfo
* @endif
*/
- void notify(const ConnectorInfo& info);
+ ReturnCode notify(ConnectorInfo& info);
private:
std::vector<Entry> m_listeners;
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortConsumer.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortConsumer.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortConsumer.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -144,7 +144,7 @@
*
* @endif
*/
- virtual ReturnCode put(const cdrMemoryStream& data) = 0;
+ virtual ReturnCode put(cdrMemoryStream& data) = 0;
/*!
* @if jp
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.cpp 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.cpp 2017-01-19 08:29:58 UTC (rev 2877)
@@ -67,7 +67,7 @@
* @endif
*/
InPortConsumer::ReturnCode InPortCorbaCdrConsumer::
- put(const cdrMemoryStream& data)
+ put(cdrMemoryStream& data)
{
RTC_PARANOID(("put()"));
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -155,7 +155,7 @@
*
* @endif
*/
- virtual ReturnCode put(const cdrMemoryStream& data);
+ virtual ReturnCode put(cdrMemoryStream& data);
/*!
* @if jp
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.cpp 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.cpp 2017-01-19 08:29:58 UTC (rev 2877)
@@ -170,7 +170,7 @@
*/
::OpenRTM::PortStatus
InPortCorbaCdrProvider::convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data)
+ cdrMemoryStream& data)
{
switch(status)
{
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -257,7 +257,7 @@
*/
::OpenRTM::PortStatus
convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data);
+ cdrMemoryStream& data);
/*!
@@ -269,7 +269,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferWrite(const cdrMemoryStream& data)
+ inline void onBufferWrite(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_WRITE].notify(m_profile, data);
@@ -284,7 +284,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferFull(const cdrMemoryStream& data)
+ inline void onBufferFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_FULL].notify(m_profile, data);
@@ -299,7 +299,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferWriteTimeout(const cdrMemoryStream& data)
+ inline void onBufferWriteTimeout(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_WRITE_TIMEOUT].notify(m_profile, data);
@@ -314,7 +314,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferWriteOverwrite(const cdrMemoryStream& data)
+ inline void onBufferWriteOverwrite(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_OVERWRITE].notify(m_profile, data);
@@ -329,7 +329,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceived(const cdrMemoryStream& data)
+ inline void onReceived(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVED].notify(m_profile, data);
@@ -344,7 +344,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceiverFull(const cdrMemoryStream& data)
+ inline void onReceiverFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
@@ -357,7 +357,7 @@
* @brief Notify an ON_RECEIVER_TIMEOUT event to listeners
* @endif
*/
- inline void onReceiverTimeout(const cdrMemoryStream& data)
+ inline void onReceiverTimeout(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_TIMEOUT].notify(m_profile, data);
@@ -370,7 +370,7 @@
* @Brief Notify an ON_RECEIVER_ERROR event to listeners
* @endif
*/
- inline void onReceiverError(const cdrMemoryStream& data)
+ inline void onReceiverError(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_ERROR].notify(m_profile, data);
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.cpp 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.cpp 2017-01-19 08:29:58 UTC (rev 2877)
@@ -67,7 +67,7 @@
* @endif
*/
InPortConsumer::ReturnCode InPortDirectConsumer::
- put(const cdrMemoryStream& data)
+ put(cdrMemoryStream& data)
{
RTC_PARANOID(("put(): never called."));
return UNKNOWN_ERROR;
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -154,7 +154,7 @@
*
* @endif
*/
- virtual ReturnCode put(const cdrMemoryStream& data);
+ virtual ReturnCode put(cdrMemoryStream& data);
/*!
* @if jp
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -234,7 +234,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferWrite(const cdrMemoryStream& data)
+ inline void onBufferWrite(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_WRITE].notify(m_profile, data);
@@ -249,7 +249,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferFull(const cdrMemoryStream& data)
+ inline void onBufferFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_FULL].notify(m_profile, data);
@@ -264,7 +264,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferWriteTimeout(const cdrMemoryStream& data)
+ inline void onBufferWriteTimeout(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_WRITE_TIMEOUT].notify(m_profile, data);
@@ -279,7 +279,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferWriteOverwrite(const cdrMemoryStream& data)
+ inline void onBufferWriteOverwrite(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_OVERWRITE].notify(m_profile, data);
@@ -294,7 +294,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceived(const cdrMemoryStream& data)
+ inline void onReceived(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVED].notify(m_profile, data);
@@ -309,7 +309,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceiverFull(const cdrMemoryStream& data)
+ inline void onReceiverFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
@@ -322,7 +322,7 @@
* @brief Notify an ON_RECEIVER_TIMEOUT event to listeners
* @endif
*/
- inline void onReceiverTimeout(const cdrMemoryStream& data)
+ inline void onReceiverTimeout(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_TIMEOUT].notify(m_profile, data);
@@ -335,7 +335,7 @@
* @Brief Notify an ON_RECEIVER_ERROR event to listeners
* @endif
*/
- inline void onReceiverError(const cdrMemoryStream& data)
+ inline void onReceiverError(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_ERROR].notify(m_profile, data);
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortConnector.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortConnector.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortConnector.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -159,7 +159,7 @@
*
* @endif
*/
- virtual ReturnCode write(const cdrMemoryStream& data) = 0;
+ virtual ReturnCode write(cdrMemoryStream& data) = 0;
/*!
* @if jp
@@ -226,7 +226,7 @@
connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
m_inPortListeners->
connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
- RTC_PARANOID(("ONBUFFER_OVERWRITE(InPort,OutPort), "
+ RTC_PARANOID(("ON_BUFFER_OVERWRITE(InPort,OutPort), "
"ON_RECEIVER_FULL(InPort,OutPort) "
"callback called in direct mode."));
}
@@ -270,7 +270,7 @@
* @if jp
* @brief ロガーストリーム
* @else
- * @brief Logger stream
+ * @brief Logger streamf
* @endif
*/
Logger rtclog;
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.cpp 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.cpp 2017-01-19 08:29:58 UTC (rev 2877)
@@ -224,7 +224,7 @@
*/
OutPortConsumer::ReturnCode
OutPortCorbaCdrConsumer::convertReturn(::OpenRTM::PortStatus status,
- const cdrMemoryStream& data)
+ cdrMemoryStream& data)
{
switch(status)
{
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -267,7 +267,7 @@
* @endif
*/
OutPortConsumer::ReturnCode convertReturn(::OpenRTM::PortStatus status,
- const cdrMemoryStream& data);
+ cdrMemoryStream& data);
/*!
* @if jp
@@ -278,7 +278,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferWrite(const cdrMemoryStream& data)
+ inline void onBufferWrite(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_WRITE].notify(m_profile, data);
@@ -293,7 +293,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferFull(const cdrMemoryStream& data)
+ inline void onBufferFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_FULL].notify(m_profile, data);
@@ -308,7 +308,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceived(const cdrMemoryStream& data)
+ inline void onReceived(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVED].notify(m_profile, data);
@@ -323,7 +323,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceiverFull(const cdrMemoryStream& data)
+ inline void onReceiverFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.cpp 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.cpp 2017-01-19 08:29:58 UTC (rev 2877)
@@ -191,7 +191,7 @@
*/
::OpenRTM::PortStatus
OutPortCorbaCdrProvider::convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data)
+ cdrMemoryStream& data)
{
switch(status)
{
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -253,7 +253,7 @@
* @endif
*/
::OpenRTM::PortStatus convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data);
+ cdrMemoryStream& data);
/*!
@@ -265,7 +265,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferRead(const cdrMemoryStream& data)
+ inline void onBufferRead(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_READ].notify(m_profile, data);
@@ -280,7 +280,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onSend(const cdrMemoryStream& data)
+ inline void onSend(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_SEND].notify(m_profile, data);
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.cpp 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.cpp 2017-01-19 08:29:58 UTC (rev 2877)
@@ -76,7 +76,7 @@
* @endif
*/
ConnectorBase::ReturnCode
- OutPortPullConnector::write(const cdrMemoryStream& data)
+ OutPortPullConnector::write(cdrMemoryStream& data)
{
m_buffer->write(data);
return PORT_OK;
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -162,7 +162,7 @@
*
* @endif
*/
- virtual ReturnCode write(const cdrMemoryStream& data);
+ virtual ReturnCode write(cdrMemoryStream& data);
/*!
* @if jp
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.cpp 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.cpp 2017-01-19 08:29:58 UTC (rev 2877)
@@ -83,7 +83,7 @@
* @endif
*/
ConnectorBase::ReturnCode
- OutPortPushConnector::write(const cdrMemoryStream& data)
+ OutPortPushConnector::write(cdrMemoryStream& data)
{
RTC_TRACE(("write()"));
RTC_PARANOID(("data size = %d bytes", data.bufSize()));
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -189,7 +189,7 @@
*
* @endif
*/
- virtual ReturnCode write(const cdrMemoryStream& data);
+ virtual ReturnCode write(cdrMemoryStream& data);
/*!
* @if jp
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherBase.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherBase.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherBase.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -253,7 +253,7 @@
*
* @endif
*/
- virtual ReturnCode write(const cdrMemoryStream& data,
+ virtual ReturnCode write(cdrMemoryStream& data,
unsigned long sec,
unsigned long usec) = 0;
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherFlush.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherFlush.cpp 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherFlush.cpp 2017-01-19 08:29:58 UTC (rev 2877)
@@ -35,8 +35,7 @@
*/
PublisherFlush::PublisherFlush()
: rtclog("PublisherFlush"),
- m_consumer(0), m_listeners(0), m_active(false),
- m_retcode(PORT_OK)
+ m_consumer(0), m_listeners(0), m_retcode(PORT_OK), m_active(false)
{
}
@@ -133,7 +132,7 @@
* @brief Write data
* @endif
*/
- PublisherBase::ReturnCode PublisherFlush::write(const cdrMemoryStream& data,
+ PublisherBase::ReturnCode PublisherFlush::write(cdrMemoryStream& data,
unsigned long sec,
unsigned long usec)
{
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherFlush.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherFlush.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherFlush.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -265,7 +265,7 @@
*
* @endif
*/
- virtual ReturnCode write(const cdrMemoryStream& data,
+ virtual ReturnCode write(cdrMemoryStream& data,
unsigned long sec,
unsigned long usec);
/*!
@@ -361,7 +361,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onSend(const cdrMemoryStream& data)
+ inline void onSend(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_SEND].notify(m_profile, data);
@@ -376,7 +376,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceived(const cdrMemoryStream& data)
+ inline void onReceived(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVED].notify(m_profile, data);
@@ -391,7 +391,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceiverFull(const cdrMemoryStream& data)
+ inline void onReceiverFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
@@ -406,7 +406,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceiverTimeout(const cdrMemoryStream& data)
+ inline void onReceiverTimeout(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_TIMEOUT].notify(m_profile, data);
@@ -421,7 +421,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceiverError(const cdrMemoryStream& data)
+ inline void onReceiverError(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_ERROR].notify(m_profile, data);
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherNew.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherNew.cpp 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherNew.cpp 2017-01-19 08:29:58 UTC (rev 2877)
@@ -162,7 +162,7 @@
* @brief Write data
* @endif
*/
- PublisherBase::ReturnCode PublisherNew::write(const cdrMemoryStream& data,
+ PublisherBase::ReturnCode PublisherNew::write(cdrMemoryStream& data,
unsigned long sec,
unsigned long usec)
{
@@ -423,7 +423,7 @@
{
m_buffer->advanceRptr(postskip);
- const cdrMemoryStream& cdr(m_buffer->get());
+ cdrMemoryStream& cdr(m_buffer->get());
onBufferRead(cdr);
onSend(cdr);
@@ -491,7 +491,7 @@
*/
PublisherBase::ReturnCode
PublisherNew::convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data)
+ cdrMemoryStream& data)
{
/*
* BufferStatus -> DataPortStatus
@@ -539,7 +539,7 @@
*/
PublisherNew::ReturnCode
PublisherNew::invokeListener(DataPortStatus::Enum status,
- const cdrMemoryStream& data)
+ cdrMemoryStream& data)
{
// ret:
// PORT_OK, PORT_ERROR, SEND_FULL, SEND_TIMEOUT, CONNECTION_LOST,
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherNew.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherNew.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherNew.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -323,7 +323,7 @@
*
* @endif
*/
- virtual ReturnCode write(const cdrMemoryStream& data,
+ virtual ReturnCode write(cdrMemoryStream& data,
unsigned long sec,
unsigned long usec);
@@ -528,7 +528,7 @@
* @endif
*/
ReturnCode convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data);
+ cdrMemoryStream& data);
/*!
* @if jp
@@ -548,7 +548,7 @@
* @endif
*/
ReturnCode invokeListener(DataPortStatus::Enum status,
- const cdrMemoryStream& data);
+ cdrMemoryStream& data);
/*!
* @if jp
@@ -559,7 +559,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferWrite(const cdrMemoryStream& data)
+ inline void onBufferWrite(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_WRITE].notify(m_profile, data);
@@ -574,7 +574,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferFull(const cdrMemoryStream& data)
+ inline void onBufferFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_FULL].notify(m_profile, data);
@@ -589,7 +589,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferWriteTimeout(const cdrMemoryStream& data)
+ inline void onBufferWriteTimeout(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_WRITE_TIMEOUT].notify(m_profile, data);
@@ -604,7 +604,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferWriteOverwrite(const cdrMemoryStream& data)
+ inline void onBufferWriteOverwrite(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_OVERWRITE].notify(m_profile, data);
@@ -619,7 +619,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferRead(const cdrMemoryStream& data)
+ inline void onBufferRead(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_READ].notify(m_profile, data);
@@ -634,7 +634,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onSend(const cdrMemoryStream& data)
+ inline void onSend(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_SEND].notify(m_profile, data);
@@ -649,7 +649,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceived(const cdrMemoryStream& data)
+ inline void onReceived(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVED].notify(m_profile, data);
@@ -664,7 +664,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceiverFull(const cdrMemoryStream& data)
+ inline void onReceiverFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
@@ -679,7 +679,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceiverTimeout(const cdrMemoryStream& data)
+ inline void onReceiverTimeout(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_TIMEOUT].notify(m_profile, data);
@@ -694,7 +694,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceiverError(const cdrMemoryStream& data)
+ inline void onReceiverError(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_ERROR].notify(m_profile, data);
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.cpp
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.cpp 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.cpp 2017-01-19 08:29:58 UTC (rev 2877)
@@ -170,7 +170,7 @@
* @endif
*/
PublisherBase::ReturnCode
- PublisherPeriodic::write(const cdrMemoryStream& data,
+ PublisherPeriodic::write(cdrMemoryStream& data,
unsigned long sec,
unsigned long usec)
{
@@ -284,7 +284,7 @@
while (m_buffer->readable() > 0)
{
- const cdrMemoryStream& cdr(m_buffer->get());
+ cdrMemoryStream& cdr(m_buffer->get());
onBufferRead(cdr);
onSend(cdr);
@@ -310,7 +310,7 @@
RTC_TRACE(("pushFifo()"));
if (bufferIsEmpty()) { return BUFFER_EMPTY; }
- const cdrMemoryStream& cdr(m_buffer->get());
+ cdrMemoryStream& cdr(m_buffer->get());
onBufferRead(cdr);
onSend(cdr);
@@ -346,7 +346,7 @@
m_buffer->advanceRptr(postskip);
readable -= postskip;
- const cdrMemoryStream& cdr(m_buffer->get());
+ cdrMemoryStream& cdr(m_buffer->get());
onBufferRead(cdr);
onSend(cdr);
@@ -381,7 +381,7 @@
m_readback = true;
m_buffer->advanceRptr(m_buffer->readable() - 1);
- const cdrMemoryStream& cdr(m_buffer->get());
+ cdrMemoryStream& cdr(m_buffer->get());
onBufferRead(cdr);
onSend(cdr);
@@ -514,7 +514,7 @@
*/
PublisherBase::ReturnCode
PublisherPeriodic::convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data)
+ cdrMemoryStream& data)
{
/*
* BufferStatus -> DataPortStatus
@@ -562,7 +562,7 @@
*/
PublisherPeriodic::ReturnCode
PublisherPeriodic::invokeListener(DataPortStatus::Enum status,
- const cdrMemoryStream& data)
+ cdrMemoryStream& data)
{
// ret:
// PORT_OK, PORT_ERROR, SEND_FULL, SEND_TIMEOUT, CONNECTION_LOST,
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.h 2017-01-19 06:46:54 UTC (rev 2876)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.h 2017-01-19 08:29:58 UTC (rev 2877)
@@ -323,7 +323,7 @@
*
* @endif
*/
- virtual ReturnCode write(const cdrMemoryStream& data,
+ virtual ReturnCode write(cdrMemoryStream& data,
unsigned long sec,
unsigned long usec);
/*!
@@ -527,7 +527,7 @@
* @endif
*/
ReturnCode convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data);
+ cdrMemoryStream& data);
/*!
@@ -548,7 +548,7 @@
* @endif
*/
ReturnCode invokeListener(DataPortStatus::Enum status,
- const cdrMemoryStream& data);
+ cdrMemoryStream& data);
/*!
* @if jp
@@ -559,7 +559,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferWrite(const cdrMemoryStream& data)
+ inline void onBufferWrite(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_WRITE].notify(m_profile, data);
@@ -574,7 +574,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferFull(const cdrMemoryStream& data)
+ inline void onBufferFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_FULL].notify(m_profile, data);
@@ -589,7 +589,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferWriteTimeout(const cdrMemoryStream& data)
+ inline void onBufferWriteTimeout(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_WRITE_TIMEOUT].notify(m_profile, data);
@@ -604,7 +604,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onBufferRead(const cdrMemoryStream& data)
+ inline void onBufferRead(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_BUFFER_READ].notify(m_profile, data);
@@ -619,7 +619,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onSend(const cdrMemoryStream& data)
+ inline void onSend(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_SEND].notify(m_profile, data);
@@ -634,7 +634,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceived(const cdrMemoryStream& data)
+ inline void onReceived(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVED].notify(m_profile, data);
@@ -649,7 +649,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceiverFull(const cdrMemoryStream& data)
+ inline void onReceiverFull(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_FULL].notify(m_profile, data);
@@ -664,7 +664,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceiverTimeout(const cdrMemoryStream& data)
+ inline void onReceiverTimeout(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_TIMEOUT].notify(m_profile, data);
@@ -679,7 +679,7 @@
* @param data cdrMemoryStream
* @endif
*/
- inline void onReceiverError(const cdrMemoryStream& data)
+ inline void onReceiverError(cdrMemoryStream& data)
{
m_listeners->
connectorData_[ON_RECEIVER_ERROR].notify(m_profile, data);
More information about the openrtm-commit
mailing list