Rerun C++ SDK
Loading...
Searching...
No Matches
previews_config.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/previews_config.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/play_state.hpp"
8#include "../../blueprint/components/playback_speed.hpp"
9#include "../../blueprint/components/timeline_fraction.hpp"
10#include "../../blueprint/components/timeline_name.hpp"
11#include "../../collection.hpp"
12#include "../../component_batch.hpp"
13#include "../../component_column.hpp"
14#include "../../result.hpp"
15
16#include <cstdint>
17#include <optional>
18#include <utility>
19#include <vector>
20
21namespace rerun::blueprint::archetypes {
22 /// **Archetype**: Shared configuration for every preview cell in a table blueprint.
23 ///
24 /// This archetype is stored at the entity `/table` alongside `archetypes::TableBlueprint`.
25 ///
26 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
27 ///
29 /// The timeline used by every preview cell.
30 ///
31 /// If left empty a timeline is automatically picked, preferring custom over built-in.
32 std::optional<ComponentBatch> timeline;
33
34 /// Whether every preview cell plays.
35 ///
36 /// A single preview can still be played or paused on its own.
37 /// Defaults to paused, and following plays like playing.
38 std::optional<ComponentBatch> play_state;
39
40 /// Playback speed of every preview cell.
41 ///
42 /// Defaults to 1.0.
43 std::optional<ComponentBatch> playback_speed;
44
45 /// Where every preview cell starts, as a fraction of the recording's time range.
46 ///
47 /// 0.0 is the start and 1.0 the end.
48 /// Defaults to 0.5.
49 std::optional<ComponentBatch> start_point;
50
51 public:
52 /// The name of the archetype as used in `ComponentDescriptor`s.
53 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.PreviewsConfig";
54
55 /// `ComponentDescriptor` for the `timeline` field.
57 ArchetypeName, "PreviewsConfig:timeline",
59 );
60 /// `ComponentDescriptor` for the `play_state` field.
62 ArchetypeName, "PreviewsConfig:play_state",
64 );
65 /// `ComponentDescriptor` for the `playback_speed` field.
67 ArchetypeName, "PreviewsConfig:playback_speed",
69 );
70 /// `ComponentDescriptor` for the `start_point` field.
72 ArchetypeName, "PreviewsConfig:start_point",
74 );
75
76 public:
77 PreviewsConfig() = default;
78 PreviewsConfig(PreviewsConfig&& other) = default;
79 PreviewsConfig(const PreviewsConfig& other) = default;
80 PreviewsConfig& operator=(const PreviewsConfig& other) = default;
81 PreviewsConfig& operator=(PreviewsConfig&& other) = default;
82
83 /// Update only some specific fields of a `PreviewsConfig`.
85 return PreviewsConfig();
86 }
87
88 /// Clear all the fields of a `PreviewsConfig`.
90
91 /// The timeline used by every preview cell.
92 ///
93 /// If left empty a timeline is automatically picked, preferring custom over built-in.
95 ) && {
96 timeline =
97 ComponentBatch::from_loggable(_timeline, Descriptor_timeline).value_or_throw();
98 return std::move(*this);
99 }
100
101 /// Whether every preview cell plays.
102 ///
103 /// A single preview can still be played or paused on its own.
104 /// Defaults to paused, and following plays like playing.
105 PreviewsConfig with_play_state(const rerun::blueprint::components::PlayState& _play_state
106 ) && {
107 play_state =
108 ComponentBatch::from_loggable(_play_state, Descriptor_play_state).value_or_throw();
109 return std::move(*this);
110 }
111
112 /// Playback speed of every preview cell.
113 ///
114 /// Defaults to 1.0.
117 ) && {
120 .value_or_throw();
121 return std::move(*this);
122 }
123
124 /// Where every preview cell starts, as a fraction of the recording's time range.
125 ///
126 /// 0.0 is the start and 1.0 the end.
127 /// Defaults to 0.5.
130 ) && {
132 .value_or_throw();
133 return std::move(*this);
134 }
135
136 /// Partitions the component data into multiple sub-batches.
137 ///
138 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
139 /// instead, via `ComponentBatch::partitioned`.
140 ///
141 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
142 ///
143 /// The specified `lengths` must sum to the total length of the component batch.
145 return detail::partition_batches(
147 lengths_
148 )
149 .value_or_throw();
150 }
151
152 /// Partitions the component data into unit-length sub-batches.
153 ///
154 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
155 /// where `n` is automatically guessed.
157 return detail::partition_batches_of_unit_length(
159 )
160 .value_or_throw();
161 }
162 };
163
164} // namespace rerun::blueprint::archetypes
165
166namespace rerun {
167 /// \private
168 template <typename T>
169 struct AsComponents;
170
171 /// \private
172 template <>
173 struct AsComponents<blueprint::archetypes::PreviewsConfig> {
174 /// Serialize all set component batches.
175 static Result<Collection<ComponentBatch>> as_batches(
177 ) {
178 return detail::collect_batches(
179 {&archetype.timeline,
180 &archetype.play_state,
181 &archetype.playback_speed,
182 &archetype.start_point}
183 );
184 }
185 };
186} // 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: Shared configuration for every preview cell in a table blueprint.
Definition previews_config.hpp:28
static PreviewsConfig update_fields()
Update only some specific fields of a PreviewsConfig.
Definition previews_config.hpp:84
static constexpr auto Descriptor_start_point
ComponentDescriptor for the start_point field.
Definition previews_config.hpp:71
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition previews_config.hpp:156
std::optional< ComponentBatch > start_point
Where every preview cell starts, as a fraction of the recording's time range.
Definition previews_config.hpp:49
PreviewsConfig with_start_point(const rerun::blueprint::components::TimelineFraction &_start_point) &&
Where every preview cell starts, as a fraction of the recording's time range.
Definition previews_config.hpp:128
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition previews_config.hpp:144
static constexpr auto Descriptor_timeline
ComponentDescriptor for the timeline field.
Definition previews_config.hpp:56
static PreviewsConfig clear_fields()
Clear all the fields of a PreviewsConfig.
static constexpr auto Descriptor_play_state
ComponentDescriptor for the play_state field.
Definition previews_config.hpp:61
PreviewsConfig with_playback_speed(const rerun::blueprint::components::PlaybackSpeed &_playback_speed) &&
Playback speed of every preview cell.
Definition previews_config.hpp:115
static constexpr auto Descriptor_playback_speed
ComponentDescriptor for the playback_speed field.
Definition previews_config.hpp:66
std::optional< ComponentBatch > play_state
Whether every preview cell plays.
Definition previews_config.hpp:38
std::optional< ComponentBatch > timeline
The timeline used by every preview cell.
Definition previews_config.hpp:32
PreviewsConfig with_play_state(const rerun::blueprint::components::PlayState &_play_state) &&
Whether every preview cell plays.
Definition previews_config.hpp:105
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition previews_config.hpp:53
PreviewsConfig with_timeline(const rerun::blueprint::components::TimelineName &_timeline) &&
The timeline used by every preview cell.
Definition previews_config.hpp:94
std::optional< ComponentBatch > playback_speed
Playback speed of every preview cell.
Definition previews_config.hpp:43
Component: A playback speed which determines how fast time progresses.
Definition playback_speed.hpp:17
Component: A position on a timeline, as a fraction of its time range.
Definition timeline_fraction.hpp:19
Component: A timeline identified by its name.
Definition timeline_name.hpp:22