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 "../../indicator_component.hpp"
13#include "../../result.hpp"
14
15#include <cstdint>
16#include <optional>
17#include <utility>
18#include <vector>
19
20namespace rerun::blueprint::archetypes {
21 /// **Archetype**: Aims to achieve a target distance between two nodes that are connected by an edge.
22 ///
23 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
24 ///
25 struct ForceLink {
26 /// Whether the link force is enabled.
27 ///
28 /// The link force aims to achieve a target distance between two nodes that are connected by one ore more edges.
29 std::optional<ComponentBatch> enabled;
30
31 /// The target distance between two nodes.
32 std::optional<ComponentBatch> distance;
33
34 /// Specifies how often this force should be applied per iteration.
35 ///
36 /// Increasing this parameter can lead to better results at the cost of longer computation time.
37 std::optional<ComponentBatch> iterations;
38
39 public:
40 static constexpr const char IndicatorComponentName[] =
41 "rerun.blueprint.components.ForceLinkIndicator";
42
43 /// Indicator component, used to identify the archetype when converting to a list of components.
45 /// The name of the archetype as used in `ComponentDescriptor`s.
46 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.ForceLink";
47
48 /// `ComponentDescriptor` for the `enabled` field.
49 static constexpr auto Descriptor_enabled = ComponentDescriptor(
50 ArchetypeName, "enabled",
52 );
53 /// `ComponentDescriptor` for the `distance` field.
55 ArchetypeName, "distance",
57 );
58 /// `ComponentDescriptor` for the `iterations` field.
60 ArchetypeName, "iterations",
62 );
63
64 public:
65 ForceLink() = default;
66 ForceLink(ForceLink&& other) = default;
67 ForceLink(const ForceLink& other) = default;
68 ForceLink& operator=(const ForceLink& other) = default;
69 ForceLink& operator=(ForceLink&& other) = default;
70
71 /// Update only some specific fields of a `ForceLink`.
73 return ForceLink();
74 }
75
76 /// Clear all the fields of a `ForceLink`.
78
79 /// Whether the link force is enabled.
80 ///
81 /// The link force aims to achieve a target distance between two nodes that are connected by one ore more edges.
83 enabled = ComponentBatch::from_loggable(_enabled, Descriptor_enabled).value_or_throw();
84 return std::move(*this);
85 }
86
87 /// The target distance between two nodes.
89 distance =
90 ComponentBatch::from_loggable(_distance, Descriptor_distance).value_or_throw();
91 return std::move(*this);
92 }
93
94 /// Specifies how often this force should be applied per iteration.
95 ///
96 /// Increasing this parameter can lead to better results at the cost of longer computation time.
98 ) && {
100 ComponentBatch::from_loggable(_iterations, Descriptor_iterations).value_or_throw();
101 return std::move(*this);
102 }
103
104 /// Partitions the component data into multiple sub-batches.
105 ///
106 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
107 /// instead, via `ComponentBatch::partitioned`.
108 ///
109 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
110 ///
111 /// The specified `lengths` must sum to the total length of the component batch.
113
114 /// Partitions the component data into unit-length sub-batches.
115 ///
116 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
117 /// where `n` is automatically guessed.
119 };
120
121} // namespace rerun::blueprint::archetypes
122
123namespace rerun {
124 /// \private
125 template <typename T>
126 struct AsComponents;
127
128 /// \private
129 template <>
130 struct AsComponents<blueprint::archetypes::ForceLink> {
131 /// Serialize all set component batches.
132 static Result<Collection<ComponentBatch>> as_batches(
133 const blueprint::archetypes::ForceLink& archetype
134 );
135 };
136} // 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=rerun::Loggable< T >::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:14
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:18
Component: The target distance between two nodes.
Definition force_distance.hpp:20
Component: Specifies how often this force should be applied per iteration.
Definition force_iterations.hpp:20
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32