[openrtm-commit:02275] r2879 - branches/FSM4RTC/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 1月 19日 (木) 17:37:36 JST
Author: n-ando
Date: 2017-01-19 17:37:36 +0900 (Thu, 19 Jan 2017)
New Revision: 2879
Added:
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/Timestamp.h
Modified:
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPort.h
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/Makefile.am
branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPort.h
Log:
[FSM4RTC,incomapt] Timestamp class template has been added. Timestamp listeners have been added to InPort and OutPort. refs #3871
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPort.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPort.h 2017-01-19 08:31:44 UTC (rev 2878)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/InPort.h 2017-01-19 08:37:36 UTC (rev 2879)
@@ -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/FSM4RTC/OpenRTM-aist/src/lib/rtm/Makefile.am
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/Makefile.am 2017-01-19 08:31:44 UTC (rev 2878)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/Makefile.am 2017-01-19 08:37:36 UTC (rev 2879)
@@ -160,6 +160,7 @@
SdoServiceConsumerBase.h \
StateMachine.h \
Typename.h \
+ Timestamp.h \
LocalServiceBase.h \
ListenerHolder.h \
config_rtc.h
Modified: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPort.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPort.h 2017-01-19 08:31:44 UTC (rev 2878)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/OutPort.h 2017-01-19 08:37:36 UTC (rev 2879)
@@ -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"));
+
}
/*!
Added: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/Timestamp.h
===================================================================
--- branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/Timestamp.h (rev 0)
+++ branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/Timestamp.h 2017-01-19 08:37:36 UTC (rev 2879)
@@ -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
Property changes on: branches/FSM4RTC/OpenRTM-aist/src/lib/rtm/Timestamp.h
___________________________________________________________________
Added: svn:executable
+ *
More information about the openrtm-commit
mailing list