Rerun C++ SDK
Loading...
Searching...
No Matches
force_center.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_center.fbs".
3
4#pragma once
5
6#include "../../blueprint/components/enabled.hpp"
7#include "../../blueprint/components/force_strength.hpp"
8#include "../../collection.hpp"
9#include "../../component_batch.hpp"
10#include "../../component_column.hpp"
11#include "../../result.hpp"
12
13#include <cstdint>
14#include <optional>
15#include <utility>
16#include <vector>
17
18namespace rerun::blueprint::archetypes {
19 /// **Archetype**: Tries to move the center of mass of the graph to the origin.
20 ///
21 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
22 ///
23 struct ForceCenter {
24 /// Whether the center force is enabled.
25 ///
26 /// The center force tries to move the center of mass of the graph towards the origin.
27 std::optional<ComponentBatch> enabled;
28
29 /// The strength of the force.
30 std::optional<ComponentBatch> strength;
31
32 public:
33 /// The name of the archetype as used in `ComponentDescriptor`s.
34 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.ForceCenter";
35
36 /// `ComponentDescriptor` for the `enabled` field.
37 static constexpr auto Descriptor_enabled = ComponentDescriptor(
38 ArchetypeName, "ForceCenter:enabled",
40 );
41 /// `ComponentDescriptor` for the `strength` field.
43 ArchetypeName, "ForceCenter:strength",
45 );
46
47 public:
48 ForceCenter() = default;
49 ForceCenter(ForceCenter&& other) = default;
50 ForceCenter(const ForceCenter& other) = default;
51 ForceCenter& operator=(const ForceCenter& other) = default;
52 ForceCenter& operator=(ForceCenter&& other) = default;
53
54 /// Update only some specific fields of a `ForceCenter`.
56 return ForceCenter();
57 }
58
59 /// Clear all the fields of a `ForceCenter`.
61
62 /// Whether the center force is enabled.
63 ///
64 /// The center force tries to move the center of mass of the graph towards the origin.
66 enabled = ComponentBatch::from_loggable(_enabled, Descriptor_enabled).value_or_throw();
67 return std::move(*this);
68 }
69
70 /// The strength of the force.
72 strength =
73 ComponentBatch::from_loggable(_strength, Descriptor_strength).value_or_throw();
74 return std::move(*this);
75 }
76
77 /// Partitions the component data into multiple sub-batches.
78 ///
79 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
80 /// instead, via `ComponentBatch::partitioned`.
81 ///
82 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
83 ///
84 /// The specified `lengths` must sum to the total length of the component batch.
86
87 /// Partitions the component data into unit-length sub-batches.
88 ///
89 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
90 /// where `n` is automatically guessed.
92 };
93
94} // namespace rerun::blueprint::archetypes
95
96namespace rerun {
97 /// \private
98 template <typename T>
99 struct AsComponents;
100
101 /// \private
102 template <>
103 struct AsComponents<blueprint::archetypes::ForceCenter> {
104 /// Serialize all set component batches.
105 static Result<Collection<ComponentBatch>> as_batches(
107 );
108 };
109} // 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
Archetype: Tries to move the center of mass of the graph to the origin.
Definition force_center.hpp:23
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition force_center.hpp:34
ForceCenter with_strength(const rerun::blueprint::components::ForceStrength &_strength) &&
The strength of the force.
Definition force_center.hpp:71
static constexpr auto Descriptor_enabled
ComponentDescriptor for the enabled field.
Definition force_center.hpp:37
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
static ForceCenter clear_fields()
Clear all the fields of a ForceCenter.
static constexpr auto Descriptor_strength
ComponentDescriptor for the strength field.
Definition force_center.hpp:42
ForceCenter with_enabled(const rerun::blueprint::components::Enabled &_enabled) &&
Whether the center force is enabled.
Definition force_center.hpp:65
static ForceCenter update_fields()
Update only some specific fields of a ForceCenter.
Definition force_center.hpp:55
std::optional< ComponentBatch > enabled
Whether the center force is enabled.
Definition force_center.hpp:27
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
std::optional< ComponentBatch > strength
The strength of the force.
Definition force_center.hpp:30
Component: Whether a procedure is enabled.
Definition enabled.hpp:17
Component: The strength of a given force.
Definition force_strength.hpp:19