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