ROS 2 rclcpp + rcl - jazzy  jazzy
ROS 2 C++ Client Library with ROS Client Library
network_flow_endpoint.hpp
1 // Copyright 2020 Ericsson AB
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__NETWORK_FLOW_ENDPOINT_HPP_
16 #define RCLCPP__NETWORK_FLOW_ENDPOINT_HPP_
17 
18 #include <cstdint>
19 #include <string>
20 #include <iostream>
21 
22 #include "rcl/network_flow_endpoints.h"
23 
24 #include "rclcpp/visibility_control.hpp"
25 
26 namespace rclcpp
27 {
28 
30 class NetworkFlowEndpoint;
31 
33 RCLCPP_PUBLIC
34 bool operator==(const NetworkFlowEndpoint & left, const NetworkFlowEndpoint & right);
35 
37 RCLCPP_PUBLIC
38 bool operator!=(const NetworkFlowEndpoint & left, const NetworkFlowEndpoint & right);
39 
41 RCLCPP_PUBLIC
42 std::ostream & operator<<(std::ostream & os, const NetworkFlowEndpoint & network_flow_endpoint);
43 
49 {
50 public:
52  RCLCPP_PUBLIC
53  explicit NetworkFlowEndpoint(const rcl_network_flow_endpoint_t & network_flow_endpoint)
54  : transport_protocol_(
55  rcl_network_flow_endpoint_get_transport_protocol_string(network_flow_endpoint.
57  internet_protocol_(
58  rcl_network_flow_endpoint_get_internet_protocol_string(
59  network_flow_endpoint.internet_protocol)),
60  transport_port_(network_flow_endpoint.transport_port),
61  flow_label_(network_flow_endpoint.flow_label),
62  dscp_(network_flow_endpoint.dscp),
63  internet_address_(network_flow_endpoint.internet_address)
64  {
65  }
66 
68  RCLCPP_PUBLIC
69  const std::string & transport_protocol() const;
70 
72  RCLCPP_PUBLIC
73  const std::string & internet_protocol() const;
74 
76  RCLCPP_PUBLIC
77  uint16_t transport_port() const;
78 
80  RCLCPP_PUBLIC
81  uint32_t flow_label() const;
82 
84  RCLCPP_PUBLIC
85  uint8_t dscp() const;
86 
88  RCLCPP_PUBLIC
89  const std::string & internet_address() const;
90 
92  friend bool rclcpp::operator==(
93  const NetworkFlowEndpoint & left,
94  const NetworkFlowEndpoint & right);
95  friend bool rclcpp::operator!=(
96  const NetworkFlowEndpoint & left,
97  const NetworkFlowEndpoint & right);
98 
100  friend std::ostream & rclcpp::operator<<(
101  std::ostream & os,
102  const NetworkFlowEndpoint & network_flow_endpoint);
103 
104 private:
105  std::string transport_protocol_;
106  std::string internet_protocol_;
107  uint16_t transport_port_;
108  uint32_t flow_label_;
109  uint8_t dscp_;
110  std::string internet_address_;
111 };
112 
113 } // namespace rclcpp
114 
115 #endif // RCLCPP__NETWORK_FLOW_ENDPOINT_HPP_
RCLCPP_PUBLIC uint32_t flow_label() const
Get flow label.
RCLCPP_PUBLIC const std::string & internet_protocol() const
Get internet protocol.
RCLCPP_PUBLIC uint16_t transport_port() const
Get transport port.
RCLCPP_PUBLIC const std::string & transport_protocol() const
Get transport protocol.
RCLCPP_PUBLIC const std::string & internet_address() const
Get internet address.
RCLCPP_PUBLIC NetworkFlowEndpoint(const rcl_network_flow_endpoint_t &network_flow_endpoint)
Construct from rcl_network_flow_endpoint_t.
RCLCPP_PUBLIC uint8_t dscp() const
Get DSCP.
Versions of rosidl_typesupport_cpp::get_message_type_support_handle that handle adapted types.
RCLCPP_PUBLIC bool operator==(const NetworkFlowEndpoint &left, const NetworkFlowEndpoint &right)
Check if two NetworkFlowEndpoint instances are equal.
RCLCPP_PUBLIC std::ostream & operator<<(std::ostream &os, const FutureReturnCode &future_return_code)
Stream operator for FutureReturnCode.
RCLCPP_PUBLIC bool operator!=(const NetworkFlowEndpoint &left, const NetworkFlowEndpoint &right)
Check if two NetworkFlowEndpoint instances are not equal.