GNode library (C++)
Loading...
Searching...
No Matches
link.hpp
Go to the documentation of this file.
1/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General
2 * Public License. The full license is in the file LICENSE, distributed with
3 * this software. */
4
20#pragma once
21#include <string>
22#include <vector>
23
24namespace gnode
25{
26
27class Node; // forward
28
38struct Link
39{
40 std::string from;
42 std::string to;
43 int port_to;
44
52 Link(std::string from, int port_from, std::string to, int port_to)
54 {
55 }
56
62 bool operator==(const Link &other_link) const;
63
69 void print() const;
70};
71
84{
85 std::string from;
86 std::string to;
88 int port_to;
89 std::string port_label_from;
90 std::string port_label_to;
91 std::string data_type_from;
92 std::string data_type_to;
93
105 LinkView(const Link &link, const Node &node_from, const Node &node_to);
106
110 void print(int indent = 0) const;
111
115 std::string to_string(int indent = 0) const;
116};
117
118} // namespace gnode
Abstract Node class that represents a basic building block in a graph-based system.
Definition node.hpp:34
Definition data.hpp:23
Provides a resolved and enriched view of a graph link.
Definition link.hpp:84
std::string data_type_from
Data type of the source port.
Definition link.hpp:91
std::string data_type_to
Data type of the destination port.
Definition link.hpp:92
std::string to_string(int indent=0) const
Export to a string the details of the Link.
int port_from
Port number on the source node.
Definition link.hpp:87
std::string to
Identifier of the destination node.
Definition link.hpp:86
int port_to
Port number on the destination node.
Definition link.hpp:88
void print(int indent=0) const
Print the details of the Link.
std::string port_label_from
Label of the source port.
Definition link.hpp:89
LinkView(const Link &link, const Node &node_from, const Node &node_to)
Constructs a LinkView from a raw link and its associated nodes.
std::string from
Identifier of the source node.
Definition link.hpp:85
std::string port_label_to
Label of the destination port.
Definition link.hpp:90