Rerun C++ SDK
Loading...
Searching...
No Matches
force_link.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/blueprint/archetypes/force_link.fbs".
3
4#pragma once
5
6#include "../../blueprint/components/enabled.hpp"
7#include "../../blueprint/components/force_distance.hpp"
8#include "../../blueprint/components/force_iterations.hpp"
9#include "../../collection.hpp"
10#include "../../component_batch.hpp"
11#include "../../component_column.hpp"
12#include "../../result.hpp"
13
14#include <cstdint>
15#include <optional>
16#include <utility>
17#include <vector>
18
19namespace rerun::blueprint::archetypes {
20 /// **Archetype**: Aims to achieve a target distance between two nodes that are connected by an edge.
21 ///
22 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
23 ///
24 struct ForceLink {
25 /// Whether the link force is enabled.
26 ///
27 /// The link force aims to achieve a target distance between two nodes that are connected by one ore more edges.
28 std::optional<ComponentBatch> enabled;
29
30 /// The target distance between two nodes.
31 std::optional<ComponentBatch> distance;
32
33 /// Specifies how often this force should be applied per iteration.
34 ///
35 /// Increasing this parameter can lead to better results at the cost of longer computation time.
36 std::optional<ComponentBatch> iterations;
37
38 public:
39 /// The name of the archetype as used in `ComponentDescriptor`s.
40 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.ForceLink";
41
42 /// `ComponentDescriptor` for the `enabled` field.
43 static constexpr auto Descriptor_enabled = ComponentDescriptor(
44 ArchetypeName, "ForceLink:enabled",
46 );
47 /// `ComponentDescriptor` for the `distance` field.
49 ArchetypeName, "ForceLink:distance",
51 );
52 /// `ComponentDescriptor` for the `iterations` field.
54 ArchetypeName, "ForceLink:iterations",
56 );
57
58 public:
59 ForceLink() = default;
60 ForceLink(ForceLink&& other) = default;
61 ForceLink(const ForceLink& other) = default;
62 ForceLink& operator=(const ForceLink& other) = default;
63 ForceLink& operator=(ForceLink&& other) = default;
64
65 /// Update only some specific fields of a `ForceLink`.
67 return ForceLink();
68 }
69
70 /// Clear all the fields of a `ForceLink`.
72
73 /// Whether the link force is enabled.
74 ///
75 /// The link force aims to achieve a target distance between two nodes that are connected by one ore more edges.
77 enabled = ComponentBatch::from_loggable(_enabled, Descriptor_enabled).value_or_throw();
78 return std::move(*this);
79 }
80
81 /// The target distance between two nodes.
83 distance =
84 ComponentBatch::from_loggable(_distance, Descriptor_distance).value_or_throw();
85 return std::move(*this);
86 }
87
88 /// Specifies how often this force should be applied per iteration.
89 ///
90 /// Increasing this parameter can lead to better results at the cost of longer computation time.
92 ) && {
94 ComponentBatch::from_loggable(_iterations, Descriptor_iterations).value_or_throw();
95 return std::move(*this);
96 }
97
98 /// Partitions the component data into multiple sub-batches.
99 ///
100 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
101 /// instead, via `ComponentBatch::partitioned`.
102 ///
103 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
104 ///
105 /// The specified `lengths` must sum to the total length of the component batch.
107
108 /// Partitions the component data into unit-length sub-batches.
109 ///
110 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
111 /// where `n` is automatically guessed.
113 };
114
115} // namespace rerun::blueprint::archetypes
116
117namespace rerun {
118 /// \private
119 template <typename T>
120 struct AsComponents;
121
122 /// \private
123 template <>
124 struct AsComponents<blueprint::archetypes::ForceLink> {
125 /// Serialize all set component batches.
126 static Result<Collection<ComponentBatch>> as_batches(
127 const blueprint::archetypes::ForceLink& archetype
128 );
129 };
130} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
A class for representing either a usable value, or an error.
Definition result.hpp:14
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:16
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Component: Whether a procedure is enabled.
Definition enabled.hpp:17
Component: The target distance between two nodes.
Definition force_distance.hpp:19
Component: Specifies how often this force should be applied per iteration.
Definition force_iterations.hpp:19