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 "../../blueprint/components/play_state.hpp"
7#include "../../blueprint/components/playback_speed.hpp"
8#include "../../blueprint/components/timeline_fraction.hpp"
9#include "../../blueprint/components/timeline_name.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**: Shared configuration for every preview cell in a table blueprint.
22 ///
23 /// This archetype is stored at the entity `/table` alongside `archetypes::TableBlueprint`.
24 ///
25 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
26 ///
28 /// The timeline used by every preview cell.
29 ///
30 /// If left empty a timeline is automatically picked, preferring custom over built-in.
31 std::optional<ComponentBatch> timeline;
32
33 /// Whether every preview cell plays.
34 ///
35 /// A single preview can still be played or paused on its own.
36 /// Defaults to paused, and following plays like playing.
37 std::optional<ComponentBatch> play_state;
38
39 /// Playback speed of every preview cell.
40 ///
41 /// Defaults to 1.0.
42 std::optional<ComponentBatch> playback_speed;
43
44 /// Where every preview cell starts, as a fraction of the recording's time range.
45 ///
46 /// 0.0 is the start and 1.0 the end.
47 /// Defaults to 0.5.
48 std::optional<ComponentBatch> start_point;
49
50 public:
51 /// The name of the archetype as used in `ComponentDescriptor`s.
52 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.PreviewsConfig";
53
54 /// `ComponentDescriptor` for the `timeline` field.
56 ArchetypeName, "PreviewsConfig:timeline",
58 );
59 /// `ComponentDescriptor` for the `play_state` field.
61 ArchetypeName, "PreviewsConfig:play_state",
63 );
64 /// `ComponentDescriptor` for the `playback_speed` field.
66 ArchetypeName, "PreviewsConfig:playback_speed",
68 );
69 /// `ComponentDescriptor` for the `start_point` field.
71 ArchetypeName, "PreviewsConfig:start_point",
73 );
74
75 public:
76 PreviewsConfig() = default;
77 PreviewsConfig(PreviewsConfig&& other) = default;
78 PreviewsConfig(const PreviewsConfig& other) = default;
79 PreviewsConfig& operator=(const PreviewsConfig& other) = default;
80 PreviewsConfig& operator=(PreviewsConfig&& other) = default;
81
82 /// Update only some specific fields of a `PreviewsConfig`.
84 return PreviewsConfig();
85 }
86
87 /// Clear all the fields of a `PreviewsConfig`.
89
90 /// The timeline used by every preview cell.
91 ///
92 /// If left empty a timeline is automatically picked, preferring custom over built-in.
94 ) && {
95 timeline =
96 ComponentBatch::from_loggable(_timeline, Descriptor_timeline).value_or_throw();
97 return std::move(*this);
98 }
99
100 /// Whether every preview cell plays.
101 ///
102 /// A single preview can still be played or paused on its own.
103 /// Defaults to paused, and following plays like playing.
104 PreviewsConfig with_play_state(const rerun::blueprint::components::PlayState& _play_state
105 ) && {
106 play_state =
107 ComponentBatch::from_loggable(_play_state, Descriptor_play_state).value_or_throw();
108 return std::move(*this);
109 }
110
111 /// Playback speed of every preview cell.
112 ///
113 /// Defaults to 1.0.
116 ) && {
119 .value_or_throw();
120 return std::move(*this);
121 }
122
123 /// Where every preview cell starts, as a fraction of the recording's time range.
124 ///
125 /// 0.0 is the start and 1.0 the end.
126 /// Defaults to 0.5.
129 ) && {
131 .value_or_throw();
132 return std::move(*this);
133 }
134
135 /// Partitions the component data into multiple sub-batches.
136 ///
137 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
138 /// instead, via `ComponentBatch::partitioned`.
139 ///
140 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
141 ///
142 /// The specified `lengths` must sum to the total length of the component batch.
144
145 /// Partitions the component data into unit-length sub-batches.
146 ///
147 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
148 /// where `n` is automatically guessed.
150 };
151
152} // namespace rerun::blueprint::archetypes
153
154namespace rerun {
155 /// \private
156 template <typename T>
157 struct AsComponents;
158
159 /// \private
160 template <>
161 struct AsComponents<blueprint::archetypes::PreviewsConfig> {
162 /// Serialize all set component batches.
163 static Result<Collection<ComponentBatch>> as_batches(
165 );
166 };
167} // 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:27
static PreviewsConfig update_fields()
Update only some specific fields of a PreviewsConfig.
Definition previews_config.hpp:83
static constexpr auto Descriptor_start_point
ComponentDescriptor for the start_point field.
Definition previews_config.hpp:70
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
std::optional< ComponentBatch > start_point
Where every preview cell starts, as a fraction of the recording's time range.
Definition previews_config.hpp:48
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:127
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
static constexpr auto Descriptor_timeline
ComponentDescriptor for the timeline field.
Definition previews_config.hpp:55
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:60
PreviewsConfig with_playback_speed(const rerun::blueprint::components::PlaybackSpeed &_playback_speed) &&
Playback speed of every preview cell.
Definition previews_config.hpp:114
static constexpr auto Descriptor_playback_speed
ComponentDescriptor for the playback_speed field.
Definition previews_config.hpp:65
std::optional< ComponentBatch > play_state
Whether every preview cell plays.
Definition previews_config.hpp:37
std::optional< ComponentBatch > timeline
The timeline used by every preview cell.
Definition previews_config.hpp:31
PreviewsConfig with_play_state(const rerun::blueprint::components::PlayState &_play_state) &&
Whether every preview cell plays.
Definition previews_config.hpp:104
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition previews_config.hpp:52
PreviewsConfig with_timeline(const rerun::blueprint::components::TimelineName &_timeline) &&
The timeline used by every preview cell.
Definition previews_config.hpp:93
std::optional< ComponentBatch > playback_speed
Playback speed of every preview cell.
Definition previews_config.hpp:42
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