Loading...
Searching...
No Matches
graph_edge.hpp
Go to the documentation of this file.
//
// Copyright 2019 Ettus Research, a National Instruments Brand
//
// SPDX-License-Identifier: GPL-3.0-or-later
//
#pragma once
#include <uhd/config.hpp>
#include <string>
#include <tuple>
namespace uhd { namespace rfnoc {
struct UHD_API graph_edge_t
{
enum edge_t {
STATIC,
DYNAMIC,
RX_STREAM,
TX_STREAM
};
graph_edge_t() = default;
graph_edge_t(const size_t src_port_,
const size_t dst_port_,
const edge_t edge_,
const bool fwd_edge)
: src_port(src_port_), dst_port(dst_port_), edge(edge_), is_forward_edge(fwd_edge)
{
}
std::string src_blockid;
size_t src_port = 0;
std::string dst_blockid;
size_t dst_port = 0;
edge_t edge = DYNAMIC;
// are not used for sorting the graph as a DAG.
bool is_forward_edge = true;
// properties.
bool operator==(const graph_edge_t& rhs) const
{
return is_equal(rhs, true);
}
bool is_equal(const graph_edge_t& rhs, const bool match_properties = false) const
{
return (std::tie(src_blockid, src_port, dst_blockid, dst_port)
== std::tie(
rhs.src_blockid, rhs.src_port, rhs.dst_blockid, rhs.dst_port))
&& (match_properties ? (std::tie(edge, is_forward_edge)
== std::tie(rhs.edge, rhs.is_forward_edge))
: true);
}
std::string to_string() const
{
return src_blockid + ":" + std::to_string(src_port)
+ (edge == STATIC ? "==>" : "-->") + dst_blockid + ":"
+ std::to_string(dst_port);
}
};
}} /* namespace uhd::rfnoc */
UHD_API
#define UHD_API
Definition config.h:87
config.hpp
uhd::rfnoc
Definition actions.hpp:24
uhd
Definition build_info.hpp:12
uhd::rfnoc::graph_edge_t::to_string
std::string to_string() const
Return a string representation of the connection.
Definition graph_edge.hpp:82
uhd::rfnoc::graph_edge_t::is_equal
bool is_equal(const graph_edge_t &rhs, const bool match_properties=false) const
Definition graph_edge.hpp:71
uhd::rfnoc::graph_edge_t::dst_blockid
std::string dst_blockid
The ID of the destination block for this edge.
Definition graph_edge.hpp:46
uhd::rfnoc::graph_edge_t::edge_t
edge_t
Definition graph_edge.hpp:24
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::STATIC
@ STATIC
A static connection between two blocks in the FPGA.
Definition graph_edge.hpp:25
uhd::rfnoc::graph_edge_t::TX_STREAM
@ TX_STREAM
A connection from a software TX streamer and an FPGA block.
Definition graph_edge.hpp:28
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::is_forward_edge
bool is_forward_edge
When false, the framework will assume this is a back-edge. Back-edges.
Definition graph_edge.hpp:53
uhd::rfnoc::graph_edge_t::src_blockid
std::string src_blockid
The ID of the source block for this edge.
Definition graph_edge.hpp:42
uhd::rfnoc::graph_edge_t::edge
edge_t edge
The type of edge.
Definition graph_edge.hpp:50
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::dst_port
size_t dst_port
The port number of the destination block for this edge.
Definition graph_edge.hpp:48
uhd::rfnoc::graph_edge_t::operator==
bool operator==(const graph_edge_t &rhs) const
Equality operator: Compare two edges if they match, including edge.
Definition graph_edge.hpp:57
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:44
uhd::rfnoc::graph_edge_t::graph_edge_t
graph_edge_t()=default