OpenRTM-aist  1.2.2
Timestamp.h
[詳解]
1 // -*- C++ -*-
18 #ifndef RTM_TIMESTAMP_H
19 #define RTM_TIMESTAMP_H
20 
21 #include <rtm/ConnectorListener.h>
22 
23 namespace RTC
24 {
25  template <class DataType>
26  class Timestamp
27  : public ConnectorDataListenerT<DataType>
28  {
29  USE_CONNLISTENER_STATUS;
30  public:
31  Timestamp(const char* ts_type) : m_tstype(ts_type) {}
32  virtual ~Timestamp() {}
33  virtual ReturnCode operator()(ConnectorInfo& info, DataType& data)
34  {
35  if (info.properties["timestamp_policy"] != m_tstype)
36  {
37  return NO_CHANGE;
38  }
40  data.tm.sec = tm.sec();
41  data.tm.nsec = tm.usec() * 1000;
42  return DATA_CHANGED;
43  }
44  std::string m_tstype;
45  };
46 }; // End of namesepace RTM
47 
48 #endif // RTM_TIMESTAMP_H
RTC::ConnectorListenerStatus::NO_CHANGE
@ NO_CHANGE
Definition: ConnectorListener.h:66
coil::gettimeofday
int gettimeofday(struct timeval *tv, struct timezone *tz)
時刻とタイムゾーンを取得する
Definition: Time.h:137
RTC::Timestamp::~Timestamp
virtual ~Timestamp()
Definition: Timestamp.h:32
coil::TimeValue
TimeValue クラス
Definition: TimeValue.h:40
RTC::Timestamp::operator()
virtual ReturnCode operator()(ConnectorInfo &info, DataType &data)
仮想コールバックメソッド
Definition: Timestamp.h:33
RTC::Timestamp::m_tstype
std::string m_tstype
Definition: Timestamp.h:44
RTC::ConnectorListenerStatus::DATA_CHANGED
@ DATA_CHANGED
Definition: ConnectorListener.h:68
RTC::ConnectorInfo
ConnectorInfo クラス
Definition: ConnectorBase.h:43
coil::TimeValue::sec
long int sec() const
秒単位の値を取得する
Definition: TimeValue.h:110
ConnectorListener.h
connector listener class
RTC::ConnectorDataListenerT
ConnectorDataListenerT クラス
Definition: ConnectorListener.h:505
RTC
RTコンポーネント
RTC::Timestamp
Definition: Timestamp.h:26
RTC::Timestamp::Timestamp
Timestamp(const char *ts_type)
Definition: Timestamp.h:31
RTC::ConnectorInfo::properties
coil::Properties properties
プロパティ
Definition: ConnectorBase.h:126
coil::TimeValue::usec
long int usec() const
マイクロ秒単位の値を取得する
Definition: TimeValue.h:131