[openrtm-commit:02989] r3123 - in branches/RELENG_1_2/OpenRTM-aist: examples/SimpleIO src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 12月 11日 (月) 09:52:14 JST
Author: n-ando
Date: 2017-12-11 09:52:14 +0900 (Mon, 11 Dec 2017)
New Revision: 3123
Added:
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/Timestamp.h
Modified:
branches/RELENG_1_2/OpenRTM-aist/examples/SimpleIO/ConsoleIn.h
branches/RELENG_1_2/OpenRTM-aist/examples/SimpleIO/ConsoleOut.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ConnectorListener.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ConnectorListener.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPort.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortConsumer.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortPushConnector.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortPushConnector.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/Makefile.am
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPort.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortConnector.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherBase.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherFlush.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherFlush.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherNew.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherNew.h
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.cpp
branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.h
Log:
merged changes from branches/FSM4RTC/OpenRTM-aist r2877-2880:
[FSM4RTC,incompat,->RELENG_1_2,->RELENG_2_0] Connector listeners intarfaces have been changed to modify info and data in the listeners and return its status. refs #3871
[FSM4RTC,incompat,->RELENG_1_2,->RELENG_2_0] Some callback points have been added. refs #3871
[FSM4RTC,incomapt,->RELENG_1_2,->RELENG_2_0] Timestamp class template has been added. Timestamp listeners have been added to InPort and OutPort. refs #3871
[FSM4RTC,incompat,->RELENG_1_2,->RELENG_2_0] ConnectorListener, ConnectorDataListener interfaces have been changed. refs #3871
Modified: branches/RELENG_1_2/OpenRTM-aist/examples/SimpleIO/ConsoleIn.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/examples/SimpleIO/ConsoleIn.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/examples/SimpleIO/ConsoleIn.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -35,6 +35,7 @@
class DataListener
: public ConnectorDataListenerT<RTC::TimedLong>
{
+ USE_CONNLISTENER_STATUS;
public:
DataListener(const char* name) : m_name(name) {}
virtual ~DataListener()
@@ -42,8 +43,8 @@
std::cout << "dtor of " << m_name << std::endl;
}
- virtual void operator()(const ConnectorInfo& info,
- const TimedLong& data)
+ virtual ReturnCode operator()(ConnectorInfo& info,
+ TimedLong& data)
{
std::cout << "------------------------------" << std::endl;
std::cout << "Data Listener: " << m_name << std::endl;
@@ -54,6 +55,7 @@
// std::cout << std::endl;
std::cout << "Data: " << data.data << std::endl;
std::cout << "------------------------------" << std::endl;
+ return NO_CHANGE;
};
std::string m_name;
};
@@ -62,6 +64,7 @@
class ConnListener
: public ConnectorListener
{
+ USE_CONNLISTENER_STATUS;
public:
ConnListener(const char* name) : m_name(name) {}
virtual ~ConnListener()
@@ -69,7 +72,7 @@
std::cout << "dtor of " << m_name << std::endl;
}
- virtual void operator()(const ConnectorInfo& info)
+ virtual ReturnCode operator()(ConnectorInfo& info)
{
std::cout << "------------------------------" << std::endl;
std::cout << "Connector Listener: " << m_name << std::endl;
@@ -79,6 +82,7 @@
std::cout << info.properties;
std::cout << std::endl;
std::cout << "------------------------------" << std::endl;
+ return NO_CHANGE;
};
std::string m_name;
};
Modified: branches/RELENG_1_2/OpenRTM-aist/examples/SimpleIO/ConsoleOut.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/examples/SimpleIO/ConsoleOut.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/examples/SimpleIO/ConsoleOut.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -35,6 +35,7 @@
class DataListener
: public ConnectorDataListenerT<RTC::TimedLong>
{
+ USE_CONNLISTENER_STATUS;
public:
DataListener(const char* name) : m_name(name) {}
virtual ~DataListener()
@@ -42,8 +43,8 @@
std::cout << "dtor of " << m_name << std::endl;
}
- virtual void operator()(const ConnectorInfo& info,
- const TimedLong& data)
+ virtual ReturnCode operator()(ConnectorInfo& info,
+ TimedLong& data)
{
std::cout << "------------------------------" << std::endl;
std::cout << "Data Listener: " << m_name << std::endl;
@@ -54,6 +55,7 @@
// std::cout << std::endl;
std::cout << "Data: " << data.data << std::endl;
std::cout << "------------------------------" << std::endl;
+ return NO_CHANGE;
};
std::string m_name;
};
@@ -62,6 +64,7 @@
class ConnListener
: public ConnectorListener
{
+ USE_CONNLISTENER_STATUS;
public:
ConnListener(const char* name) : m_name(name) {}
virtual ~ConnListener()
@@ -69,7 +72,7 @@
std::cout << "dtor of " << m_name << std::endl;
}
- virtual void operator()(const ConnectorInfo& info)
+ virtual ReturnCode operator()(ConnectorInfo& info)
{
std::cout << "------------------------------" << std::endl;
std::cout << "Connector Listener: " << m_name << std::endl;
@@ -79,6 +82,7 @@
std::cout << info.properties;
std::cout << std::endl;
std::cout << "------------------------------" << std::endl;
+ return NO_CHANGE;
};
std::string m_name;
};
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ConnectorListener.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ConnectorListener.cpp 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ConnectorListener.cpp 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ConnectorListener.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ConnectorListener.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ConnectorListener.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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,24 +247,16 @@
* - 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
@@ -164,16 +263,15 @@
* - 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
@@ -180,14 +278,131 @@
* @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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPort.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPort.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPort.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -36,6 +36,7 @@
#include <rtm/CdrBufferBase.h>
#include <rtm/PortCallback.h>
#include <rtm/InPortConnector.h>
+#include <rtm/Timestamp.h>
namespace RTC
{
@@ -157,6 +158,10 @@
m_OnRead(NULL), m_OnReadConvert(NULL),
m_status(1), m_directNewData(false)
{
+ this->addConnectorDataListener(ON_RECEIVED,
+ new Timestamp<DataType>("on_received"));
+ this->addConnectorDataListener(ON_BUFFER_READ,
+ new Timestamp<DataType>("on_read"));
}
/*!
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortConsumer.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortConsumer.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortConsumer.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -144,7 +144,7 @@
*
* @endif
*/
- virtual ReturnCode put(const cdrMemoryStream& data) = 0;
+ virtual ReturnCode put(cdrMemoryStream& data) = 0;
/*!
* @if jp
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.cpp 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.cpp 2017-12-11 00:52:14 UTC (rev 3123)
@@ -67,7 +67,7 @@
* @endif
*/
InPortConsumer::ReturnCode InPortCorbaCdrConsumer::
- put(const cdrMemoryStream& data)
+ put(cdrMemoryStream& data)
{
RTC_PARANOID(("put()"));
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrConsumer.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -155,7 +155,7 @@
*
* @endif
*/
- virtual ReturnCode put(const cdrMemoryStream& data);
+ virtual ReturnCode put(cdrMemoryStream& data);
/*!
* @if jp
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.cpp 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.cpp 2017-12-11 00:52:14 UTC (rev 3123)
@@ -179,7 +179,7 @@
*/
::OpenRTM::PortStatus
InPortCorbaCdrProvider::convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data)
+ cdrMemoryStream& data)
{
switch(status)
{
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortCorbaCdrProvider.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.cpp 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.cpp 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortDirectConsumer.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -154,7 +154,7 @@
*
* @endif
*/
- virtual ReturnCode put(const cdrMemoryStream& data);
+ virtual ReturnCode put(cdrMemoryStream& data);
/*!
* @if jp
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortDirectProvider.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortPushConnector.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortPushConnector.cpp 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortPushConnector.cpp 2017-12-11 00:52:14 UTC (rev 3123)
@@ -93,12 +93,15 @@
switch (ret)
{
case BufferStatus::BUFFER_OK:
+ onBufferRead(data);
return PORT_OK;
break;
case BufferStatus::BUFFER_EMPTY:
+ onBufferEmpty(data);
return BUFFER_EMPTY;
break;
case BufferStatus::TIMEOUT:
+ onBufferReadTimeout(data);
return BUFFER_TIMEOUT;
break;
case BufferStatus::PRECONDITION_NOT_MET:
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortPushConnector.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortPushConnector.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/InPortPushConnector.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -271,7 +271,25 @@
* @endif
*/
void onDisconnect();
+
+ inline void onBufferRead(cdrMemoryStream& data)
+ {
+ m_listeners.
+ connectorData_[ON_BUFFER_READ].notify(m_profile, data);
+ }
+ void onBufferEmpty(cdrMemoryStream& data)
+ {
+ m_listeners.
+ connectorData_[ON_BUFFER_EMPTY].notify(m_profile, data);
+
+ }
+ void onBufferReadTimeout(cdrMemoryStream& data)
+ {
+ m_listeners.
+ connectorData_[ON_BUFFER_READ_TIMEOUT].notify(m_profile, data);
+ }
+
private:
/*!
* @if jp
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/Makefile.am
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/Makefile.am 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/Makefile.am 2017-12-11 00:52:14 UTC (rev 3123)
@@ -175,6 +175,7 @@
SdoServiceConsumerBase.h \
StateMachine.h \
Typename.h \
+ Timestamp.h \
LocalServiceBase.h \
LogstreamBase.h \
ListenerHolder.h \
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPort.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPort.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPort.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -144,6 +144,11 @@
m_propValueIndex = NVUtil::find_index(m_profile.properties,
"dataport.data_value");
}
+ this->addConnectorDataListener(ON_BUFFER_WRITE,
+ new Timestamp<DataType>("on_write"));
+ this->addConnectorDataListener(ON_SEND,
+ new Timestamp<DataType>("on_send"));
+
}
/*!
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortConnector.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortConnector.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortConnector.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.cpp 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.cpp 2017-12-11 00:52:14 UTC (rev 3123)
@@ -224,7 +224,7 @@
*/
OutPortConsumer::ReturnCode
OutPortCorbaCdrConsumer::convertReturn(::OpenRTM::PortStatus status,
- const cdrMemoryStream& data)
+ cdrMemoryStream& data)
{
switch(status)
{
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrConsumer.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.cpp 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.cpp 2017-12-11 00:52:14 UTC (rev 3123)
@@ -199,7 +199,7 @@
*/
::OpenRTM::PortStatus
OutPortCorbaCdrProvider::convertReturn(BufferStatus::Enum status,
- const cdrMemoryStream& data)
+ cdrMemoryStream& data)
{
switch(status)
{
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortCorbaCdrProvider.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.cpp 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.cpp 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPullConnector.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -162,7 +162,7 @@
*
* @endif
*/
- virtual ReturnCode write(const cdrMemoryStream& data);
+ virtual ReturnCode write(cdrMemoryStream& data);
/*!
* @if jp
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.cpp 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.cpp 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/OutPortPushConnector.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -189,7 +189,7 @@
*
* @endif
*/
- virtual ReturnCode write(const cdrMemoryStream& data);
+ virtual ReturnCode write(cdrMemoryStream& data);
/*!
* @if jp
Modified: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherBase.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherBase.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherBase.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherFlush.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherFlush.cpp 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherFlush.cpp 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherFlush.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherFlush.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherFlush.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherNew.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherNew.cpp 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherNew.cpp 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherNew.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherNew.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherNew.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.cpp
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.cpp 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.cpp 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.h 2017-12-11 00:49:35 UTC (rev 3122)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/PublisherPeriodic.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -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);
Copied: branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/Timestamp.h (from rev 2880, branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/Timestamp.h)
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/Timestamp.h (rev 0)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/Timestamp.h 2017-12-11 00:52:14 UTC (rev 3123)
@@ -0,0 +1,48 @@
+// -*- C++ -*-
+/*!
+ * @file Timestamp.h
+ * @brief Timestamp listener class
+ * @date $Date$
+ * @author Noriaki Ando <n-ando at aist.go.jp>
+ *
+ * Copyright (C) 2017
+ * Noriaki Ando
+ * National Institute of
+ * Advanced Industrial Science and Technology (AIST), Japan
+ * All rights reserved.
+ *
+ * $Id$
+ *
+ */
+
+#ifndef RTM_TIMESTAMP_H
+#define RTM_TIMESTAMP_H
+
+#include <rtm/ConnectorListener.h>
+
+namespace RTC
+{
+ template <class DataType>
+ class Timestamp
+ : public ConnectorDataListenerT<DataType>
+ {
+ USE_CONNLISTENER_STATUS;
+ public:
+ Timestamp(const char* ts_type) : m_tstype(ts_type) {}
+ virtual ~Timestamp() {}
+ virtual ReturnCode operator()(ConnectorInfo& info, DataType& data)
+ {
+ if (info.properties["timestamp_policy"] != m_tstype)
+ {
+ return NO_CHANGE;
+ }
+ coil::TimeValue tm(coil::gettimeofday());
+ data.tm.sec = tm.sec();
+ data.tm.nsec = tm.usec() * 1000;
+ return DATA_CHANGED;
+ }
+ std::string m_tstype;
+ };
+}; // End of namesepace RTM
+
+#endif // RTM_TIMESTAMP_H
More information about the openrtm-commit
mailing list