rclcpp  master
C++ ROS Client Library API
network_flow_endpoint.hpp
Go to the documentation of this file.
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 
25 
26 namespace rclcpp
27 {
28 
30 class NetworkFlowEndpoint;
31 
34 bool operator==(const NetworkFlowEndpoint & left, const NetworkFlowEndpoint & right);
35 
38 bool operator!=(const NetworkFlowEndpoint & left, const NetworkFlowEndpoint & right);
39 
42 std::ostream & operator<<(std::ostream & os, const NetworkFlowEndpoint & network_flow_endpoint);
43 
49 {
50 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 
69  const std::string & transport_protocol() const;
70 
73  const std::string & internet_protocol() const;
74 
77  uint16_t transport_port() const;
78 
81  uint32_t flow_label() const;
82 
85  uint8_t dscp() const;
86 
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 
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::NetworkFlowEndpoint::dscp
uint8_t dscp() const
Get DSCP.
std::string
rclcpp::operator<<
std::ostream & operator<<(std::ostream &os, const FutureReturnCode &future_return_code)
Stream operator for FutureReturnCode.
rclcpp::NetworkFlowEndpoint::transport_protocol
const std::string & transport_protocol() const
Get transport protocol.
rclcpp::NetworkFlowEndpoint::NetworkFlowEndpoint
NetworkFlowEndpoint(const rcl_network_flow_endpoint_t &network_flow_endpoint)
Construct from rcl_network_flow_endpoint_t.
Definition: network_flow_endpoint.hpp:53
rclcpp
This header provides the get_node_base_interface() template function.
Definition: allocator_common.hpp:24
rclcpp::NetworkFlowEndpoint::internet_protocol
const std::string & internet_protocol() const
Get internet protocol.
RCLCPP_PUBLIC
#define RCLCPP_PUBLIC
Definition: visibility_control.hpp:50
std::ostream
rclcpp::NetworkFlowEndpoint::internet_address
const std::string & internet_address() const
Get internet address.
rclcpp::NetworkFlowEndpoint::transport_port
uint16_t transport_port() const
Get transport port.
rclcpp::operator==
bool operator==(const NetworkFlowEndpoint &left, const NetworkFlowEndpoint &right)
Check if two NetworkFlowEndpoint instances are equal.
visibility_control.hpp
rclcpp::NetworkFlowEndpoint
Definition: network_flow_endpoint.hpp:48
rclcpp::operator!=
bool operator!=(const NetworkFlowEndpoint &left, const NetworkFlowEndpoint &right)
Check if two NetworkFlowEndpoint instances are not equal.
rclcpp::NetworkFlowEndpoint::flow_label
uint32_t flow_label() const
Get flow label.