[openrtm-commit:03027] r3152 - in branches/RELENG_1_2/OpenRTM-aist: examples/SimpleIO src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 12月 16日 (土) 15:13:34 JST
Author: n-ando
Date: 2017-12-16 15:13:34 +0900 (Sat, 16 Dec 2017)
New Revision: 3152
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
Log:
[revert,incompat] ConnectorDataListener's arguments have been changed non-const->const.
Modified: branches/RELENG_1_2/OpenRTM-aist/examples/SimpleIO/ConsoleIn.h
===================================================================
--- branches/RELENG_1_2/OpenRTM-aist/examples/SimpleIO/ConsoleIn.h 2017-12-15 05:26:38 UTC (rev 3151)
+++ branches/RELENG_1_2/OpenRTM-aist/examples/SimpleIO/ConsoleIn.h 2017-12-16 06:13:34 UTC (rev 3152)
@@ -35,7 +35,6 @@
class DataListener
: public ConnectorDataListenerT<RTC::TimedLong>
{
- USE_CONNLISTENER_STATUS;
public:
DataListener(const char* name) : m_name(name) {}
virtual ~DataListener()
@@ -43,8 +42,8 @@
std::cout << "dtor of " << m_name << std::endl;
}
- virtual ReturnCode operator()(ConnectorInfo& info,
- TimedLong& data)
+ virtual void operator()(const ConnectorInfo& info,
+ const TimedLong& data)
{
std::cout << "------------------------------" << std::endl;
std::cout << "Data Listener: " << m_name << std::endl;
@@ -55,7 +54,6 @@
// std::cout << std::endl;
std::cout << "Data: " << data.data << std::endl;
std::cout << "------------------------------" << std::endl;
- return NO_CHANGE;
};
std::string m_name;
};
@@ -64,7 +62,6 @@
class ConnListener
: public ConnectorListener
{
- USE_CONNLISTENER_STATUS;
public:
ConnListener(const char* name) : m_name(name) {}
virtual ~ConnListener()
@@ -72,7 +69,7 @@
std::cout << "dtor of " << m_name << std::endl;
}
- virtual ReturnCode operator()(ConnectorInfo& info)
+ virtual void operator()(const ConnectorInfo& info)
{
std::cout << "------------------------------" << std::endl;
std::cout << "Connector Listener: " << m_name << std::endl;
@@ -82,7 +79,6 @@
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-15 05:26:38 UTC (rev 3151)
+++ branches/RELENG_1_2/OpenRTM-aist/examples/SimpleIO/ConsoleOut.h 2017-12-16 06:13:34 UTC (rev 3152)
@@ -35,7 +35,6 @@
class DataListener
: public ConnectorDataListenerT<RTC::TimedLong>
{
- USE_CONNLISTENER_STATUS;
public:
DataListener(const char* name) : m_name(name) {}
virtual ~DataListener()
@@ -43,8 +42,8 @@
std::cout << "dtor of " << m_name << std::endl;
}
- virtual ReturnCode operator()(ConnectorInfo& info,
- TimedLong& data)
+ virtual void operator()(const ConnectorInfo& info,
+ const TimedLong& data)
{
std::cout << "------------------------------" << std::endl;
std::cout << "Data Listener: " << m_name << std::endl;
@@ -55,7 +54,6 @@
// std::cout << std::endl;
std::cout << "Data: " << data.data << std::endl;
std::cout << "------------------------------" << std::endl;
- return NO_CHANGE;
};
std::string m_name;
};
@@ -64,7 +62,6 @@
class ConnListener
: public ConnectorListener
{
- USE_CONNLISTENER_STATUS;
public:
ConnListener(const char* name) : m_name(name) {}
virtual ~ConnListener()
@@ -72,7 +69,7 @@
std::cout << "dtor of " << m_name << std::endl;
}
- virtual ReturnCode operator()(ConnectorInfo& info)
+ virtual void operator()(const ConnectorInfo& info)
{
std::cout << "------------------------------" << std::endl;
std::cout << "Connector Listener: " << m_name << std::endl;
@@ -82,7 +79,6 @@
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-15 05:26:38 UTC (rev 3151)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ConnectorListener.cpp 2017-12-16 06:13:34 UTC (rev 3152)
@@ -21,18 +21,6 @@
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 ¥¯¥é¥¹
@@ -110,17 +98,14 @@
return m_listeners.size();
}
- ConnectorDataListenerHolder::ReturnCode
- ConnectorDataListenerHolder::notify(ConnectorInfo& info,
- cdrMemoryStream& cdrdata)
+ void ConnectorDataListenerHolder::notify(const ConnectorInfo& info,
+ const cdrMemoryStream& cdrdata)
{
Guard guard(m_mutex);
- ConnectorListenerHolder::ReturnCode ret(NO_CHANGE);
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
- ret = ret | m_listeners[i].first->operator()(info, cdrdata);
+ m_listeners[i].first->operator()(info, cdrdata);
}
- return ret;
}
@@ -134,8 +119,8 @@
ConnectorListenerHolder::ConnectorListenerHolder()
{
}
-
-
+
+
ConnectorListenerHolder::~ConnectorListenerHolder()
{
Guard guard(m_mutex);
@@ -174,24 +159,22 @@
return;
}
}
+
}
-
+
size_t ConnectorListenerHolder::size()
{
Guard guard(m_mutex);
return m_listeners.size();
}
-
- ConnectorListenerHolder::ReturnCode
- ConnectorListenerHolder::notify(ConnectorInfo& info)
+
+ void ConnectorListenerHolder::notify(const ConnectorInfo& info)
{
Guard guard(m_mutex);
- ConnectorListenerHolder::ReturnCode ret;
for (int i(0), len(m_listeners.size()); i < len; ++i)
{
- ret = ret | m_listeners[i].first->operator()(info);
+ 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-15 05:26:38 UTC (rev 3151)
+++ branches/RELENG_1_2/OpenRTM-aist/src/lib/rtm/ConnectorListener.h 2017-12-16 06:13:34 UTC (rev 3152)
@@ -5,8 +5,10 @@
* @date $Date$
* @author Noriaki Ando <n-ando at aist.go.jp>
*
- * Copyright (C) 2009-2017
+ * Copyright (C) 2009
* Noriaki Ando
+ * Task-intelligence Research Group,
+ * Intelligent Systems Research Institute,
* National Institute of
* Advanced Industrial Science and Technology (AIST), Japan
* All rights reserved.
@@ -30,82 +32,9 @@
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: ¥Ð¥Ã¥Õ¥¡½ñ¤¹þ¤ß»þ
@@ -121,7 +50,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
@@ -137,15 +66,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
};
@@ -167,55 +96,14 @@
* ¾ì¹ç¤Ê¤É¤Ë¥³¡¼¥ë¤µ¤ì¤ë¥Õ¥¡¥ó¥¯¥¿¤Î°ú¿ô¤Ë²¿¤â¤È¤é¤Ê¤é¤¤
* ConnecotorListener ¤¬¤¢¤ë¡£
*
- * ConnectorDataListener ¥¯¥é¥¹¤Ë¤è¤Ã¤Æ¥Ç¡¼¥¿¤¬´ØÏ¢¤¹¤ëÆ°ºî¤ò¥Õ¥Ã¥¯¤·
- * ¤¿¤¤¾ì¹ç¡¢°Ê²¼¤ÎÎã¤Î¤è¤¦¤Ë¡¢¤³¤Î¥¯¥é¥¹¤ò·Ñ¾µ¤·¡¢¥³¥Í¥¯¥¿¤Î¾ðÊó¤È¥Ç¡¼
- * ¥¿¤ò°ú¿ô¤Ë¼è¤ë°Ê²¼¤Î¤è¤¦¤Ê¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤òÄêµÁ¤·¡¢¥Ç¡¼¥¿
- * ¥Ý¡¼¥È¤ÎŬÀڤʥ³¡¼¥ë¥Ð¥Ã¥¯ÀßÄê´Ø¿ô¤«¤é¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤ò¥»¥Ã
- * ¥È¤¹¤ëɬÍפ¬¤¢¤ë¡£¤Ê¤ª¡¢Data Listener ¤Ë¤Ï¡¢¥Ç¡¼¥¿¤È¤·¤Æ¥Þ¡¼¥·¥ã¥ê
- * ¥ó¥°¸å¤Î¥Ç¡¼¥¿¤ò°ú¿ô¤Ë¼è¤ë ConnectorDataListener ¤È¡¢¥Ç¡¼¥¿¤òÆÃÄê
- * ¤Î·¿¤Ë¥¢¥ó¥Þ¡¼¥·¥ã¥ë¤·¤¿¸å¤ÎÃͤò°ú¿ô¤Ë¼è¤ë¡¢
- * ConnectorDataListenerT ¤¬¤¢¤ë¡£°Ê²¼¤ÎÎã¤Ï¡¢ConnectorDataListenerT
- * ¤ÎÄêµÁÎã¤Ç¤¢¤ë¡£
+ * ¥Ç¡¼¥¿¥Ý¡¼¥È¤Ë¤Ï¡¢Àܳ»þ¤Ë¥Ç¡¼¥¿¤ÎÁ÷¼õ¿®ÊýË¡¤Ë¤Ä¤¤¤Æ¥Ç¡¼¥¿¥Õ¥í¡¼·¿¡¢
+ * ¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥ó·¿Åù¤òÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ * ConnectorDaataListener/ConnectorListener ¤Ï¤È¤â¤Ë¡¢ÍÍ¡¹¤Ê¥¤¥Ù¥ó¥È
+ * ¤ËÂФ¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯¤òÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¤¬¡¢¤³¤ì¤é¥Ç¡¼¥¿¥Õ¥í¡¼·¿
+ * ¤ª¤è¤Ó¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥ó·¿¤ÎÀßÄê¤Ë±þ¤¸¤Æ¡¢ÍøÍѲÄǽ¤Ê¤â¤ÎÍøÍÑÉÔ²Äǽ
+ * ¤Ê¤â¤Î¤ä¡¢¸Æ¤Ó½Ð¤µ¤ì¤ë¥¿¥¤¥ß¥ó¥°¤¬°Û¤Ê¤ë¡£
+ * °Ê²¼¤Ë¡¢¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤¬CORBA CDR·¿¤Î¾ì¹ç¤Î¥³¡¼¥ë¥Ð¥Ã¥¯°ìÍ÷¤ò¼¨¤¹¡£
*
- * <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 ·Ï¤Î¥¤¥Ù¥ó¥È¤ÏȯÀ¸¤·¤Ê¤¤
@@ -224,6 +112,8 @@
* - ON_RECEIVER_FULL
* - ON_RECEIVER_TIMEOUT
* - ON_RECEIVER_ERROR
+ * - ON_CONNECT
+ * - ON_DISCONNECT
* .
* - New·¿
* - ON_BUFFER_WRITE
@@ -236,6 +126,9 @@
* - ON_RECEIVER_FULL
* - ON_RECEIVER_TIMEOUT
* - ON_RECEIVER_ERROR
+ * - ON_SENDER_ERROR
+ * - ON_CONNECT
+ * - ON_DISCONNECT
* .
* - Periodic·¿
* - ON_BUFFER_WRITE
@@ -247,16 +140,24 @@
* - 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
@@ -263,15 +164,16 @@
* - 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_BUFFER_READ
+ * - ON_CONNECT
+ * - ON_DISCONNECT
*
* @else
* @class ConnectorDataListener class
@@ -278,131 +180,14 @@
* @brief ConnectorDataListener class
*
* This class is abstract base class for listener classes that
- * realize callbacks for various events in the data port's
+ * provides 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
*
@@ -471,8 +256,8 @@
*
* @endif
*/
- virtual ReturnCode operator()(ConnectorInfo& info,
- cdrMemoryStream& data) = 0;
+ virtual void operator()(const ConnectorInfo& info,
+ const cdrMemoryStream& data) = 0;
};
/*!
@@ -538,12 +323,12 @@
*
* @endif
*/
- virtual ReturnCode operator()(ConnectorInfo& info,
- cdrMemoryStream& cdrdata)
+ virtual void operator()(const ConnectorInfo& info,
+ const 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",
@@ -559,13 +344,7 @@
cdr.setByteSwapFlag(false);
}
data <<= cdr;
- ReturnCode ret = this->operator()(info, data);
- if (ret == DATA_CHANGED || ret == BOTH_CHANGED)
- {
- cdrdata.rewindPtrs();
- data >>= cdrdata;
- }
- return ret;
+ this->operator()(info, data);
}
/*!
@@ -585,8 +364,9 @@
*
* @endif
*/
- virtual ReturnCode operator()(ConnectorInfo& info,
- DataType& data) = 0;
+ virtual void operator()(const ConnectorInfo& info,
+ const DataType& data) = 0;
+
};
@@ -619,9 +399,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
@@ -644,62 +424,51 @@
* ¾ì¹ç¤Ê¤É¤Ë¥³¡¼¥ë¤µ¤ì¤ë¥Õ¥¡¥ó¥¯¥¿¤Î°ú¿ô¤Ë²¿¤â¤È¤é¤Ê¤é¤¤
* ConnecotorListener ¤¬¤¢¤ë¡£
*
- * ConnectorListener ¥¯¥é¥¹¤Ë¤è¤Ã¤Æ´ØÏ¢¤¹¤ëÆ°ºî¤ò¥Õ¥Ã¥¯¤·¤¿¤¤¾ì¹ç¡¢°Ê
- * ²¼¤ÎÎã¤Î¤è¤¦¤Ë¡¢¤³¤Î¥¯¥é¥¹¤ò·Ñ¾µ¤·¡¢¥³¥Í¥¯¥¿¤Î¾ðÊó¤ò°ú¿ô¤Ë¼è¤ë°Ê²¼
- * ¤Î¤è¤¦¤Ê¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤òÄêµÁ¤·¡¢¥Ç¡¼¥¿¥Ý¡¼¥È¤ÎŬÀڤʥ³¡¼
- * ¥ë¥Ð¥Ã¥¯ÀßÄê´Ø¿ô¤«¤é¥³¡¼¥ë¥Ð¥Ã¥¯¥ª¥Ö¥¸¥§¥¯¥È¤ò¥»¥Ã¥È¤¹¤ëɬÍפ¬¤¢¤ë¡£
+ * ¥Ç¡¼¥¿¥Ý¡¼¥È¤Ë¤Ï¡¢Àܳ»þ¤Ë¥Ç¡¼¥¿¤ÎÁ÷¼õ¿®ÊýË¡¤Ë¤Ä¤¤¤Æ¥Ç¡¼¥¿¥Õ¥í¡¼·¿¡¢
+ * ¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥ó·¿Åù¤òÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¡£
+ * ConnectorDaataListener/ConnectorListener ¤Ï¶¦¤Ë¤Ë¡¢ÍÍ¡¹¤Ê¥¤¥Ù¥ó¥È
+ * ¤ËÂФ¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯¤òÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ë¤¬¡¢¤³¤ì¤é¥Ç¡¼¥¿¥Õ¥í¡¼·¿
+ * ¤ª¤è¤Ó¥µ¥Ö¥¹¥¯¥ê¥×¥·¥ç¥ó·¿¤ÎÀßÄê¤Ë±þ¤¸¤Æ¡¢ÍøÍѤǤ¤ë¤â¤Î¡¢¤Ç¤¤Ê¤¤
+ * ¤â¤Î¡¢¤Þ¤¿¸Æ¤Ó½Ð¤µ¤ì¤ë¥¿¥¤¥ß¥ó¥°¤¬°Û¤Ê¤ë¡£°Ê²¼¤Ë¡¢¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹
+ * ¤¬CORBA CDR·¿¤Î¾ì¹ç¤Î¥³¡¼¥ë¥Ð¥Ã¥¯°ìÍ÷¤ò¼¨¤¹¡£
*
- * <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
@@ -707,6 +476,8 @@
* .
* .
* - Pull·¿
+ * - ON_BUFFER_READ
+ * - ON_SEND
* - ON_BUFFER_EMPTY
* - ON_BUFFER_READ_TIMEOUT
* - ON_SENDER_EMPTY
@@ -714,11 +485,17 @@
* - ON_SENDER_ERROR
* - ON_CONNECT
* - ON_DISCONNECT
- * .
+ *
* InPort:
* - Push·¿:
- * - ON_BUFFER_EMPTY
- * - ON_BUFFER_READ_TIMEOUT
+ * - 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_CONNECT
* - ON_DISCONNECT
* .
@@ -731,108 +508,14 @@
* @brief ConnectorListener class
*
* This class is abstract base class for listener classes that
- * realize callbacks for various events in the data port's
+ * provides 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
*
@@ -899,7 +582,7 @@
*
* @endif
*/
- virtual ReturnCode operator()(ConnectorInfo& info) = 0;
+ virtual void operator()(const ConnectorInfo& info) = 0;
};
@@ -919,12 +602,10 @@
* @endif
*/
class ConnectorDataListenerHolder
- : public ConnectorListenerStatus
{
typedef std::pair<ConnectorDataListener*, bool> Entry;
typedef coil::Guard<coil::Mutex> Guard;
public:
- USE_CONNLISTENER_STATUS;
/*!
* @if jp
* @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
@@ -1022,8 +703,8 @@
* @param cdrdata Data
* @endif
*/
- ReturnCode notify(ConnectorInfo& info,
- cdrMemoryStream& cdrdata);
+ void notify(const ConnectorInfo& info,
+ const cdrMemoryStream& cdrdata);
/*!
* @if jp
@@ -1031,7 +712,7 @@
* @brief ¥ê¥¹¥Ê¡¼¤ØÄÌÃΤ¹¤ë(¥Ç¡¼¥¿·¿»ØÄêÈÇ)
*
* ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¥ê¥¹¥Ê¤Î¥³¡¼¥ë¥Ð¥Ã¥¯¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹¡£
- * ConnectorDataListenerT ·¿¤Î¥³¡¼¥ë¥Ð¥Ã¥¯¤Î¤ß¥³¡¼¥ë¤µ¤ì¤ë¡£
+ * COnnectorDataListenerT ·¿¤Î¥³¡¼¥ë¥Ð¥Ã¥¯¤Î¤ß¥³¡¼¥ë¤µ¤ì¤ë¡£
*
* @param info ConnectorInfo
* @param typeddata ¥Ç¡¼¥¿¡Ê¥Ç¡¼¥¿·¿»ØÄꤢ¤ê¡Ë
@@ -1047,10 +728,9 @@
* @endif
*/
template <class DataType>
- ReturnCode notify(ConnectorInfo& info, DataType& typeddata)
+ void notify(const ConnectorInfo& info, const 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);
@@ -1058,16 +738,9 @@
dynamic_cast<ConnectorDataListenerT<DataType>*>(m_listeners[i].first);
if (listener != 0)
{
- ret = ret | listener->operator()(info, typeddata);
+ listener->operator()(info, typeddata);
}
- else
- {
- cdrMemoryStream cdr;
- typeddata >>= cdr;
- ret = ret | m_listeners[i].first->operator()(info, cdr);
- }
}
- return ret;
}
private:
@@ -1092,12 +765,10 @@
* @endif
*/
class ConnectorListenerHolder
- : public ConnectorListenerStatus
{
typedef std::pair<ConnectorListener*, bool> Entry;
typedef coil::Guard<coil::Mutex> Guard;
public:
- USE_CONNLISTENER_STATUS;
/*!
* @if jp
* @brief ¥³¥ó¥¹¥È¥é¥¯¥¿
@@ -1194,7 +865,7 @@
* @param info ConnectorInfo
* @endif
*/
- ReturnCode notify(ConnectorInfo& info);
+ void notify(const ConnectorInfo& info);
private:
std::vector<Entry> m_listeners;
More information about the openrtm-commit
mailing list