Rerun C++ SDK
Loading...
Searching...
No Matches
graph_nodes.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_nodes.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../component_batch.hpp"
9#include "../components/color.hpp"
10#include "../components/graph_node.hpp"
11#include "../components/position2d.hpp"
12#include "../components/radius.hpp"
13#include "../components/show_labels.hpp"
14#include "../components/text.hpp"
15#include "../indicator_component.hpp"
16#include "../result.hpp"
17
18#include <cstdint>
19#include <optional>
20#include <utility>
21#include <vector>
22
23namespace rerun::archetypes {
24 /// **Archetype**: A list of nodes in a graph with optional labels, colors, etc.
25 ///
26 /// ## Example
27 ///
28 /// ### Simple directed graph
29 /// ![image](https://static.rerun.io/graph_directed/ca29a37b65e1e0b6482251dce401982a0bc568fa/full.png)
30 ///
31 /// ```cpp
32 /// #include <rerun.hpp>
33 ///
34 /// int main() {
35 /// const auto rec = rerun::RecordingStream("rerun_example_graph_directed");
36 /// rec.spawn().exit_on_failure();
37 ///
38 /// rec.log(
39 /// "simple",
40 /// rerun::GraphNodes({"a", "b", "c"})
41 /// .with_positions({{0.0, 100.0}, {-100.0, 0.0}, {100.0, 0.0}})
42 /// .with_labels({"A", "B", "C"}),
43 /// rerun::GraphEdges({{"a", "b"}, {"b", "c"}, {"c", "a"}})
44 /// // Graphs are undirected by default.
45 /// .with_graph_type(rerun::components::GraphType::Directed)
46 /// );
47 /// }
48 /// ```
49 struct GraphNodes {
50 /// A list of node IDs.
52
53 /// Optional center positions of the nodes.
54 std::optional<Collection<rerun::components::Position2D>> positions;
55
56 /// Optional colors for the boxes.
57 std::optional<Collection<rerun::components::Color>> colors;
58
59 /// Optional text labels for the node.
60 std::optional<Collection<rerun::components::Text>> labels;
61
62 /// Optional choice of whether the text labels should be shown by default.
63 std::optional<rerun::components::ShowLabels> show_labels;
64
65 /// Optional radii for nodes.
66 std::optional<Collection<rerun::components::Radius>> radii;
67
68 public:
69 static constexpr const char IndicatorComponentName[] =
70 "rerun.components.GraphNodesIndicator";
71
72 /// Indicator component, used to identify the archetype when converting to a list of components.
74
75 public:
76 GraphNodes() = default;
77 GraphNodes(GraphNodes&& other) = default;
78
80 : node_ids(std::move(_node_ids)) {}
81
82 /// Optional center positions of the nodes.
84 positions = std::move(_positions);
85 // See: https://github.com/rerun-io/rerun/issues/4027
86 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
87 }
88
89 /// Optional colors for the boxes.
91 colors = std::move(_colors);
92 // See: https://github.com/rerun-io/rerun/issues/4027
93 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
94 }
95
96 /// Optional text labels for the node.
98 labels = std::move(_labels);
99 // See: https://github.com/rerun-io/rerun/issues/4027
100 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
101 }
102
103 /// Optional choice of whether the text labels should be shown by default.
105 show_labels = std::move(_show_labels);
106 // See: https://github.com/rerun-io/rerun/issues/4027
107 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
108 }
109
110 /// Optional radii for nodes.
112 radii = std::move(_radii);
113 // See: https://github.com/rerun-io/rerun/issues/4027
114 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
115 }
116 };
117
118} // namespace rerun::archetypes
119
120namespace rerun {
121 /// \private
122 template <typename T>
123 struct AsComponents;
124
125 /// \private
126 template <>
127 struct AsComponents<archetypes::GraphNodes> {
128 /// Serialize all set component batches.
129 static Result<std::vector<ComponentBatch>> serialize(const archetypes::GraphNodes& archetype
130 );
131 };
132} // 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
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 nodes in a graph with optional labels, colors, etc.
Definition graph_nodes.hpp:49
GraphNodes with_colors(Collection< rerun::components::Color > _colors) &&
Optional colors for the boxes.
Definition graph_nodes.hpp:90
std::optional< Collection< rerun::components::Text > > labels
Optional text labels for the node.
Definition graph_nodes.hpp:60
GraphNodes with_radii(Collection< rerun::components::Radius > _radii) &&
Optional radii for nodes.
Definition graph_nodes.hpp:111
Collection< rerun::components::GraphNode > node_ids
A list of node IDs.
Definition graph_nodes.hpp:51
std::optional< Collection< rerun::components::Color > > colors
Optional colors for the boxes.
Definition graph_nodes.hpp:57
GraphNodes with_positions(Collection< rerun::components::Position2D > _positions) &&
Optional center positions of the nodes.
Definition graph_nodes.hpp:83
std::optional< Collection< rerun::components::Radius > > radii
Optional radii for nodes.
Definition graph_nodes.hpp:66
std::optional< rerun::components::ShowLabels > show_labels
Optional choice of whether the text labels should be shown by default.
Definition graph_nodes.hpp:63
GraphNodes with_show_labels(rerun::components::ShowLabels _show_labels) &&
Optional choice of whether the text labels should be shown by default.
Definition graph_nodes.hpp:104
GraphNodes with_labels(Collection< rerun::components::Text > _labels) &&
Optional text labels for the node.
Definition graph_nodes.hpp:97
std::optional< Collection< rerun::components::Position2D > > positions
Optional center positions of the nodes.
Definition graph_nodes.hpp:54
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32
Component: Whether the entity's components::Text label is shown.
Definition show_labels.hpp:19