Rerun C++ SDK
Loading...
Searching...
No Matches
force_collision_radius.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/build/re_type_definitions/rerun/blueprint/archetypes/force_collision_radius.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/enabled.hpp"
8#include "../../blueprint/components/force_iterations.hpp"
9#include "../../blueprint/components/force_strength.hpp"
10#include "../../collection.hpp"
11#include "../../component_batch.hpp"
12#include "../../component_column.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**: Resolves collisions between the bounding circles, according to the radius of the nodes.
22 ///
23 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
24 ///
26 /// Whether the collision force is enabled.
27 ///
28 /// The collision force resolves collisions between nodes based on the bounding circle defined by their radius.
29 std::optional<ComponentBatch> enabled;
30
31 /// The strength of the force.
32 std::optional<ComponentBatch> strength;
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 /// The name of the archetype as used in `ComponentDescriptor`s.
41 static constexpr const char ArchetypeName[] =
42 "rerun.blueprint.archetypes.ForceCollisionRadius";
43
44 /// `ComponentDescriptor` for the `enabled` field.
45 static constexpr auto Descriptor_enabled = ComponentDescriptor(
46 ArchetypeName, "ForceCollisionRadius:enabled",
48 );
49 /// `ComponentDescriptor` for the `strength` field.
51 ArchetypeName, "ForceCollisionRadius:strength",
53 );
54 /// `ComponentDescriptor` for the `iterations` field.
56 ArchetypeName, "ForceCollisionRadius:iterations",
58 );
59
60 public:
61 ForceCollisionRadius() = default;
63 ForceCollisionRadius(const ForceCollisionRadius& other) = default;
64 ForceCollisionRadius& operator=(const ForceCollisionRadius& other) = default;
65 ForceCollisionRadius& operator=(ForceCollisionRadius&& other) = default;
66
67 /// Update only some specific fields of a `ForceCollisionRadius`.
69 return ForceCollisionRadius();
70 }
71
72 /// Clear all the fields of a `ForceCollisionRadius`.
74
75 /// Whether the collision force is enabled.
76 ///
77 /// The collision force resolves collisions between nodes based on the bounding circle defined by their radius.
79 ) && {
80 enabled = ComponentBatch::from_loggable(_enabled, Descriptor_enabled).value_or_throw();
81 return std::move(*this);
82 }
83
84 /// The strength of the force.
87 ) && {
88 strength =
89 ComponentBatch::from_loggable(_strength, Descriptor_strength).value_or_throw();
90 return std::move(*this);
91 }
92
93 /// Specifies how often this force should be applied per iteration.
94 ///
95 /// 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 return detail::partition_batches({&enabled, &strength, &iterations}, lengths_)
114 .value_or_throw();
115 }
116
117 /// Partitions the component data into unit-length sub-batches.
118 ///
119 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
120 /// where `n` is automatically guessed.
122 return detail::partition_batches_of_unit_length({&enabled, &strength, &iterations})
123 .value_or_throw();
124 }
125 };
126
127} // namespace rerun::blueprint::archetypes
128
129namespace rerun {
130 /// \private
131 template <typename T>
132 struct AsComponents;
133
134 /// \private
135 template <>
136 struct AsComponents<blueprint::archetypes::ForceCollisionRadius> {
137 /// Serialize all set component batches.
138 static Result<Collection<ComponentBatch>> as_batches(
140 ) {
141 return detail::collect_batches(
142 {&archetype.enabled, &archetype.strength, &archetype.iterations}
143 );
144 }
145 };
146} // 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:26
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
Archetype: Resolves collisions between the bounding circles, according to the radius of the nodes.
Definition force_collision_radius.hpp:25
ForceCollisionRadius with_enabled(const rerun::blueprint::components::Enabled &_enabled) &&
Whether the collision force is enabled.
Definition force_collision_radius.hpp:78
static ForceCollisionRadius clear_fields()
Clear all the fields of a ForceCollisionRadius.
static constexpr auto Descriptor_enabled
ComponentDescriptor for the enabled field.
Definition force_collision_radius.hpp:45
static ForceCollisionRadius update_fields()
Update only some specific fields of a ForceCollisionRadius.
Definition force_collision_radius.hpp:68
std::optional< ComponentBatch > enabled
Whether the collision force is enabled.
Definition force_collision_radius.hpp:29
static constexpr auto Descriptor_iterations
ComponentDescriptor for the iterations field.
Definition force_collision_radius.hpp:55
ForceCollisionRadius with_strength(const rerun::blueprint::components::ForceStrength &_strength) &&
The strength of the force.
Definition force_collision_radius.hpp:85
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition force_collision_radius.hpp:112
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition force_collision_radius.hpp:41
std::optional< ComponentBatch > iterations
Specifies how often this force should be applied per iteration.
Definition force_collision_radius.hpp:37
ForceCollisionRadius with_iterations(const rerun::blueprint::components::ForceIterations &_iterations) &&
Specifies how often this force should be applied per iteration.
Definition force_collision_radius.hpp:96
std::optional< ComponentBatch > strength
The strength of the force.
Definition force_collision_radius.hpp:32
static constexpr auto Descriptor_strength
ComponentDescriptor for the strength field.
Definition force_collision_radius.hpp:50
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition force_collision_radius.hpp:121
Component: Whether a procedure is enabled.
Definition enabled.hpp:17
Component: Specifies how often this force should be applied per iteration.
Definition force_iterations.hpp:19
Component: The strength of a given force.
Definition force_strength.hpp:19