ROS 2 rclcpp + rcl - rolling  rolling-20536064
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 <string>
19 #include <iosfwd>
20 
21 #include "rcl/network_flow_endpoints.h"
22 
23 #include "rclcpp/visibility_control.hpp"
24 
25 namespace rclcpp
26 {
27 
29 class NetworkFlowEndpoint;
30 
32 RCLCPP_PUBLIC
33 bool operator==(const NetworkFlowEndpoint & left, const NetworkFlowEndpoint & right);
34 
36 RCLCPP_PUBLIC
37 bool operator!=(const NetworkFlowEndpoint & left, const NetworkFlowEndpoint & right);
38 
40 RCLCPP_PUBLIC
41 std::ostream & operator<<(std::ostream & os, const NetworkFlowEndpoint & network_flow_endpoint);
42 
48 {
49 public:
51  RCLCPP_PUBLIC
52  explicit NetworkFlowEndpoint(const rcl_network_flow_endpoint_t & network_flow_endpoint)
53  : transport_protocol_(
54  rcl_network_flow_endpoint_get_transport_protocol_string(network_flow_endpoint.
56  internet_protocol_(
57  rcl_network_flow_endpoint_get_internet_protocol_string(
58  network_flow_endpoint.internet_protocol)),
59  transport_port_(network_flow_endpoint.transport_port),
60  flow_label_(network_flow_endpoint.flow_label),
61  dscp_(network_flow_endpoint.dscp),
62  internet_address_(network_flow_endpoint.internet_address)
63  {
64  }
65 
67  RCLCPP_PUBLIC
68  const std::string & transport_protocol() const;
69 
71  RCLCPP_PUBLIC
72  const std::string & internet_protocol() const;
73 
75  RCLCPP_PUBLIC
76  uint16_t transport_port() const;
77 
79  RCLCPP_PUBLIC
80  uint32_t flow_label() const;
81 
83  RCLCPP_PUBLIC
84  uint8_t dscp() const;
85 
87  RCLCPP_PUBLIC
88  const std::string & internet_address() const;
89 
91  friend bool rclcpp::operator==(
92  const NetworkFlowEndpoint & left,
93  const NetworkFlowEndpoint & right);
94  friend bool rclcpp::operator!=(
95  const NetworkFlowEndpoint & left,
96  const NetworkFlowEndpoint & right);
97 
99  friend std::ostream & rclcpp::operator<<(
100  std::ostream & os,
101  const NetworkFlowEndpoint & network_flow_endpoint);
102 
103 private:
104  std::string transport_protocol_;
105  std::string internet_protocol_;
106  uint16_t transport_port_;
107  uint32_t flow_label_;
108  uint8_t dscp_;
109  std::string internet_address_;
110 };
111 
112 } // namespace rclcpp
113 
114 #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.