Template Class ReceivedMessagePeriodCollector

Inheritance Relationships

Base Type

Class Documentation

template<typename T>
class ReceivedMessagePeriodCollector : public libstatistics_collector::topic_statistics_collector::TopicStatisticsCollector<T>

Class used to measure the received messsage, tparam T, period from a ROS2 subscriber. This class is thread safe and acquires a mutex when the member OnMessageReceived is executed.

Template Parameters:

T – the message type to receive from the subscriber / listener

Public Functions

inline ReceivedMessagePeriodCollector()

Construct a ReceivedMessagePeriodCollector object.

virtual ~ReceivedMessagePeriodCollector() = default
inline virtual void OnMessageReceived (const T &received_message, const rcl_time_point_value_t now_nanoseconds) override RCPPUTILS_TSA_REQUIRES(mutex_)

Handle a message received and measure its received period. This member is thread safe and acquires a lock to prevent race conditions when setting the time_last_message_received_ member.

Parameters:
  • received_message

  • now_nanoseconds – time the message was received in nanoseconds

inline virtual std::string GetMetricName() const override

Return message period metric name

Returns:

a string representing message period metric name

inline virtual std::string GetMetricUnit() const override

Return message period metric unit

Returns:

a string representing message period metric unit

Protected Functions

inline virtual bool SetupStart() override

Reset the time_last_message_received_ member.

Returns:

true

inline virtual bool SetupStop() override

Override in order to perform necessary teardown.

Returns:

true if teardown was successful, false otherwise.