rclcpp
master
C++ ROS Client Library API
include
rclcpp
detail
resolve_enable_topic_statistics.hpp
Go to the documentation of this file.
1
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#ifndef RCLCPP__DETAIL__RESOLVE_ENABLE_TOPIC_STATISTICS_HPP_
16
#define RCLCPP__DETAIL__RESOLVE_ENABLE_TOPIC_STATISTICS_HPP_
17
18
#include <stdexcept>
19
20
#include "
rclcpp/topic_statistics_state.hpp
"
21
22
namespace
rclcpp
23
{
24
namespace
detail
25
{
26
28
template
<
typename
OptionsT,
typename
NodeBaseT>
29
bool
30
resolve_enable_topic_statistics
(
const
OptionsT & options,
const
NodeBaseT & node_base)
31
{
32
bool
topic_stats_enabled;
33
switch
(options.topic_stats_options.state) {
34
case
TopicStatisticsState::Enable
:
35
topic_stats_enabled =
true
;
36
break
;
37
case
TopicStatisticsState::Disable
:
38
topic_stats_enabled =
false
;
39
break
;
40
case
TopicStatisticsState::NodeDefault
:
41
topic_stats_enabled = node_base.get_enable_topic_statistics_default();
42
break
;
43
default
:
44
throw
std::runtime_error
(
"Unrecognized EnableTopicStatistics value"
);
45
}
46
47
return
topic_stats_enabled;
48
}
49
50
}
// namespace detail
51
}
// namespace rclcpp
52
53
#endif // RCLCPP__DETAIL__RESOLVE_ENABLE_TOPIC_STATISTICS_HPP_
topic_statistics_state.hpp
rclcpp
This header provides the get_node_base_interface() template function.
Definition:
allocator_common.hpp:24
rclcpp::TopicStatisticsState::NodeDefault
@ NodeDefault
Take topic statistics state from the node.
std::runtime_error
rclcpp::detail::resolve_enable_topic_statistics
bool resolve_enable_topic_statistics(const OptionsT &options, const NodeBaseT &node_base)
Return whether or not topic statistics is enabled, resolving "NodeDefault" if needed.
Definition:
resolve_enable_topic_statistics.hpp:30
rclcpp::TopicStatisticsState::Disable
@ Disable
Explicitly disable topic statistics at subscription level.
rclcpp::TopicStatisticsState::Enable
@ Enable
Explicitly enable topic statistics at subscription level.
Generated by
1.8.17