include
cras_topic_tools
count_messages.h
Go to the documentation of this file.
1
#pragma once
2
3
// SPDX-License-Identifier: BSD-3-Clause
4
// SPDX-FileCopyrightText: Czech Technical University in Prague
5
12
#include <mutex>
13
14
#include <
ros/message_event.h
>
15
#include <
ros/subscriber.h
>
16
#include <topic_tools/shape_shifter.h>
17
18
#include <
cras_cpp_common/nodelet_utils.hpp
>
19
20
namespace
cras
21
{
22
38
class
CountMessagesNodelet
:
public
::cras::Nodelet
39
{
40
void
onInit
()
override
;
41
45
virtual
void
resetCb
(const ::ros::MessageEvent<::topic_tools::ShapeShifter const>&);
46
51
virtual
void
cb
(const ::ros::MessageEvent<::topic_tools::ShapeShifter const>& event);
52
54
::ros::Subscriber
sub
;
55
57
::ros::Subscriber
resetSub
;
58
60
size_t
bytes
{0};
61
63
size_t
count
{0};
64
66
::std::mutex
mutex
;
67
};
68
69
}
cras::CountMessagesNodelet::sub
::ros::Subscriber sub
The message subscriber.
Definition:
count_messages.h:54
cras
cras::CountMessagesNodelet::resetCb
virtual void resetCb(const ::ros::MessageEvent<::topic_tools::ShapeShifter const > &)
Called when the counter should be reset. The incoming message can be of any type and should not be ex...
Definition:
count_messages.cpp:60
cras::CountMessagesNodelet::mutex
::std::mutex mutex
Mutex protecting count and bytes.
Definition:
count_messages.h:66
cras::CountMessagesNodelet
Nodelet for counting messages and their size.
Definition:
count_messages.h:38
cras::CountMessagesNodelet::bytes
size_t bytes
Byte size of the received messages.
Definition:
count_messages.h:60
subscriber.h
cras::CountMessagesNodelet::onInit
void onInit() override
Definition:
count_messages.cpp:35
cras::CountMessagesNodelet::cb
virtual void cb(const ::ros::MessageEvent<::topic_tools::ShapeShifter const > &event)
Callback for counting the messages.
Definition:
count_messages.cpp:26
cras::CountMessagesNodelet::resetSub
::ros::Subscriber resetSub
The reset message subscriber.
Definition:
count_messages.h:57
cras::CountMessagesNodelet::count
size_t count
Number of received messages.
Definition:
count_messages.h:63
cras::Nodelet
ros::Subscriber
message_event.h
nodelet_utils.hpp
cras_topic_tools
Author(s): Martin Pecka
autogenerated on Sun Jan 5 2025 03:50:49