Rerun C++ SDK
Loading...
Searching...
No Matches
graph_edges.hpp
1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/store/re_types/definitions/rerun/archetypes/graph_edges.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../component_batch.hpp"
9#include "../components/graph_edge.hpp"
10#include "../components/graph_type.hpp"
11#include "../indicator_component.hpp"
12#include "../result.hpp"
13
14#include <cstdint>
15#include <optional>
16#include <utility>
17#include <vector>
18
19namespace rerun::archetypes {
20 /// **Archetype**: A list of edges in a graph.
21 ///
22 /// By default, edges are undirected.
23 ///
24 /// ## Example
25 ///
26 /// ### Simple directed graph
27 /// ![image](https://static.rerun.io/graph_directed/ca29a37b65e1e0b6482251dce401982a0bc568fa/full.png)
28 ///
29 /// ```cpp
30 /// #include <rerun.hpp>
31 ///
32 /// int main() {
33 /// const auto rec = rerun::RecordingStream("rerun_example_graph_directed");
34 /// rec.spawn().exit_on_failure();
35 ///
36 /// rec.log(
37 /// "simple",
38 /// rerun::GraphNodes({"a", "b", "c"})
39 /// .with_positions({{0.0, 100.0}, {-100.0, 0.0}, {100.0, 0.0}})
40 /// .with_labels({"A", "B", "C"}),
41 /// rerun::GraphEdges({{"a", "b"}, {"b", "c"}, {"c", "a"}})
42 /// // Graphs are undirected by default.
43 /// .with_graph_type(rerun::components::GraphType::Directed)
44 /// );
45 /// }
46 /// ```
47 struct GraphEdges {
48 /// A list of node tuples.
50
51 /// Specifies if the graph is directed or undirected.
52 ///
53 /// If no `components::GraphType` is provided, the graph is assumed to be undirected.
54 std::optional<rerun::components::GraphType> graph_type;
55
56 public:
57 static constexpr const char IndicatorComponentName[] =
58 "rerun.components.GraphEdgesIndicator";
59
60 /// Indicator component, used to identify the archetype when converting to a list of components.
62
63 public:
64 GraphEdges() = default;
65 GraphEdges(GraphEdges&& other) = default;
66
68 : edges(std::move(_edges)) {}
69
70 /// Specifies if the graph is directed or undirected.
71 ///
72 /// If no `components::GraphType` is provided, the graph is assumed to be undirected.
74 graph_type = std::move(_graph_type);
75 // See: https://github.com/rerun-io/rerun/issues/4027
76 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
77 }
78 };
79
80} // namespace rerun::archetypes
81
82namespace rerun {
83 /// \private
84 template <typename T>
85 struct AsComponents;
86
87 /// \private
88 template <>
89 struct AsComponents<archetypes::GraphEdges> {
90 /// Serialize all set component batches.
91 static Result<std::vector<ComponentBatch>> serialize(const archetypes::GraphEdges& archetype
92 );
93 };
94} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:77
GraphType
Component: Specifies if a graph has directed or undirected edges.
Definition graph_type.hpp:25
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Archetype: A list of edges in a graph.
Definition graph_edges.hpp:47
Collection< rerun::components::GraphEdge > edges
A list of node tuples.
Definition graph_edges.hpp:49
GraphEdges with_graph_type(rerun::components::GraphType _graph_type) &&
Specifies if the graph is directed or undirected.
Definition graph_edges.hpp:73
std::optional< rerun::components::GraphType > graph_type
Specifies if the graph is directed or undirected.
Definition graph_edges.hpp:54
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32