USRP Hardware Driver and USRP Manual  Version: 4.4.0.HEAD-0-g5fac246b
UHD and USRP Manual
graph_edge.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2019 Ettus Research, a National Instruments Brand
3 //
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 //
6 
7 #pragma once
8 
9 #include <uhd/config.hpp>
10 #include <string>
11 #include <tuple>
12 
13 namespace uhd { namespace rfnoc {
14 
23 {
24  enum edge_t {
28  TX_STREAM
29  };
30 
31  graph_edge_t() = default;
32 
33  graph_edge_t(const size_t src_port_,
34  const size_t dst_port_,
35  const edge_t edge_,
36  const bool fwd_edge)
37  : src_port(src_port_)
38  , dst_port(dst_port_)
39  , edge(edge_)
40  , is_forward_edge(fwd_edge)
41  {
42  }
43 
45  std::string src_blockid;
47  size_t src_port = 0;
49  std::string dst_blockid;
51  size_t dst_port = 0;
53  edge_t edge = DYNAMIC;
55  //are not used for sorting the graph as a DAG.
56  bool is_forward_edge = true;
57 
58  bool operator==(const graph_edge_t& rhs) const
59  {
60  return std::tie(src_blockid,
61  src_port,
62  dst_blockid,
63  dst_port,
64  edge,
65  is_forward_edge)
66  == std::tie(rhs.src_blockid,
67  rhs.src_port,
68  rhs.dst_blockid,
69  rhs.dst_port,
70  rhs.edge,
71  rhs.is_forward_edge);
72  }
73 
75  std::string to_string() const
76  {
77  return src_blockid + ":" + std::to_string(src_port)
78  + (edge == STATIC ? "==>" : "-->") + dst_blockid + ":"
79  + std::to_string(dst_port);
80  }
81 };
82 
83 
84 }} /* namespace uhd::rfnoc */
uhd::rfnoc::graph_edge_t::DYNAMIC
@ DYNAMIC
A user (dynamic) connection between two blocks in the FPGA.
Definition: graph_edge.hpp:26
uhd::rfnoc::graph_edge_t::src_port
size_t src_port
The port number of the source block for this edge.
Definition: graph_edge.hpp:47
config.hpp
uhd::rfnoc::graph_edge_t::operator==
bool operator==(const graph_edge_t &rhs) const
Definition: graph_edge.hpp:58
uhd::rfnoc::graph_edge_t::is_forward_edge
bool is_forward_edge
When false, the framework will assume this is a back-edge. Back-edges.
Definition: graph_edge.hpp:56
uhd::rfnoc::graph_edge_t::src_blockid
std::string src_blockid
The ID of the source block for this edge.
Definition: graph_edge.hpp:45
UHD_API
#define UHD_API
Definition: config.h:87
uhd::rfnoc::graph_edge_t::RX_STREAM
@ RX_STREAM
A connection from an FPGA block to a software RX streamer.
Definition: graph_edge.hpp:27
uhd::rfnoc::graph_edge_t::dst_port
size_t dst_port
The port number of the destination block for this edge.
Definition: graph_edge.hpp:51
uhd::rfnoc::graph_edge_t
Definition: graph_edge.hpp:22
uhd
Definition: build_info.hpp:12
uhd::rfnoc::graph_edge_t::STATIC
@ STATIC
A static connection between two blocks in the FPGA.
Definition: graph_edge.hpp:25
uhd::rfnoc::graph_edge_t::graph_edge_t
graph_edge_t(const size_t src_port_, const size_t dst_port_, const edge_t edge_, const bool fwd_edge)
Definition: graph_edge.hpp:33
uhd::rfnoc::graph_edge_t::edge_t
edge_t
Definition: graph_edge.hpp:24
uhd::rfnoc::graph_edge_t::edge
edge_t edge
The type of edge.
Definition: graph_edge.hpp:53
uhd::rfnoc::graph_edge_t::dst_blockid
std::string dst_blockid
The ID of the destination block for this edge.
Definition: graph_edge.hpp:49
uhd::rfnoc::graph_edge_t::to_string
std::string to_string() const
Return a string representation of the connection.
Definition: graph_edge.hpp:75