Rerun C++ SDK
Loading...
Searching...
No Matches
time_panel_blueprint.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/panel_blueprint.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/absolute_time_range.hpp"
8#include "../../blueprint/components/fps.hpp"
9#include "../../blueprint/components/loop_mode.hpp"
10#include "../../blueprint/components/panel_state.hpp"
11#include "../../blueprint/components/play_state.hpp"
12#include "../../blueprint/components/playback_speed.hpp"
13#include "../../blueprint/components/timeline_name.hpp"
14#include "../../collection.hpp"
15#include "../../component_batch.hpp"
16#include "../../component_column.hpp"
17#include "../../result.hpp"
18
19#include <cstdint>
20#include <optional>
21#include <utility>
22#include <vector>
23
24namespace rerun::blueprint::archetypes {
25 /// **Archetype**: Time panel specific state.
26 ///
27 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
28 ///
30 /// Current state of the panel.
31 std::optional<ComponentBatch> state;
32
33 /// What timeline the panel is on.
34 std::optional<ComponentBatch> timeline;
35
36 /// A time playback speed multiplier.
37 std::optional<ComponentBatch> playback_speed;
38
39 /// Frames per second. Only applicable for sequence timelines.
40 std::optional<ComponentBatch> fps;
41
42 /// If the time is currently paused, playing, or following.
43 ///
44 /// Defaults to either playing or following, depending on the data source.
45 std::optional<ComponentBatch> play_state;
46
47 /// How the time should loop. A selection loop only works if there is also a `time_selection` passed.
48 ///
49 /// Defaults to off.
50 std::optional<ComponentBatch> loop_mode;
51
52 /// Selects a range of time on the time panel.
53 std::optional<ComponentBatch> time_selection;
54
55 public:
56 /// The name of the archetype as used in `ComponentDescriptor`s.
57 static constexpr const char ArchetypeName[] =
58 "rerun.blueprint.archetypes.TimePanelBlueprint";
59
60 /// `ComponentDescriptor` for the `state` field.
61 static constexpr auto Descriptor_state = ComponentDescriptor(
62 ArchetypeName, "TimePanelBlueprint:state",
64 );
65 /// `ComponentDescriptor` for the `timeline` field.
67 ArchetypeName, "TimePanelBlueprint:timeline",
69 );
70 /// `ComponentDescriptor` for the `playback_speed` field.
72 ArchetypeName, "TimePanelBlueprint:playback_speed",
74 );
75 /// `ComponentDescriptor` for the `fps` field.
76 static constexpr auto Descriptor_fps = ComponentDescriptor(
77 ArchetypeName, "TimePanelBlueprint:fps",
79 );
80 /// `ComponentDescriptor` for the `play_state` field.
82 ArchetypeName, "TimePanelBlueprint:play_state",
84 );
85 /// `ComponentDescriptor` for the `loop_mode` field.
87 ArchetypeName, "TimePanelBlueprint:loop_mode",
89 );
90 /// `ComponentDescriptor` for the `time_selection` field.
92 ArchetypeName, "TimePanelBlueprint:time_selection",
94 );
95
96 public:
97 TimePanelBlueprint() = default;
98 TimePanelBlueprint(TimePanelBlueprint&& other) = default;
99 TimePanelBlueprint(const TimePanelBlueprint& other) = default;
100 TimePanelBlueprint& operator=(const TimePanelBlueprint& other) = default;
101 TimePanelBlueprint& operator=(TimePanelBlueprint&& other) = default;
102
103 /// Update only some specific fields of a `TimePanelBlueprint`.
105 return TimePanelBlueprint();
106 }
107
108 /// Clear all the fields of a `TimePanelBlueprint`.
110
111 /// Current state of the panel.
112 TimePanelBlueprint with_state(const rerun::blueprint::components::PanelState& _state) && {
113 state = ComponentBatch::from_loggable(_state, Descriptor_state).value_or_throw();
114 return std::move(*this);
115 }
116
117 /// What timeline the panel is on.
119 ) && {
120 timeline =
121 ComponentBatch::from_loggable(_timeline, Descriptor_timeline).value_or_throw();
122 return std::move(*this);
123 }
124
125 /// A time playback speed multiplier.
128 ) && {
131 .value_or_throw();
132 return std::move(*this);
133 }
134
135 /// Frames per second. Only applicable for sequence timelines.
137 fps = ComponentBatch::from_loggable(_fps, Descriptor_fps).value_or_throw();
138 return std::move(*this);
139 }
140
141 /// If the time is currently paused, playing, or following.
142 ///
143 /// Defaults to either playing or following, depending on the data source.
145 const rerun::blueprint::components::PlayState& _play_state
146 ) && {
147 play_state =
148 ComponentBatch::from_loggable(_play_state, Descriptor_play_state).value_or_throw();
149 return std::move(*this);
150 }
151
152 /// How the time should loop. A selection loop only works if there is also a `time_selection` passed.
153 ///
154 /// Defaults to off.
155 TimePanelBlueprint with_loop_mode(const rerun::blueprint::components::LoopMode& _loop_mode
156 ) && {
157 loop_mode =
158 ComponentBatch::from_loggable(_loop_mode, Descriptor_loop_mode).value_or_throw();
159 return std::move(*this);
160 }
161
162 /// Selects a range of time on the time panel.
165 ) && {
168 .value_or_throw();
169 return std::move(*this);
170 }
171
172 /// Partitions the component data into multiple sub-batches.
173 ///
174 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
175 /// instead, via `ComponentBatch::partitioned`.
176 ///
177 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
178 ///
179 /// The specified `lengths` must sum to the total length of the component batch.
181 return detail::partition_batches(
182 {&state,
183 &timeline,
185 &fps,
186 &play_state,
187 &loop_mode,
189 lengths_
190 )
191 .value_or_throw();
192 }
193
194 /// Partitions the component data into unit-length sub-batches.
195 ///
196 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
197 /// where `n` is automatically guessed.
199 return detail::partition_batches_of_unit_length({&state,
200 &timeline,
202 &fps,
203 &play_state,
204 &loop_mode,
206 .value_or_throw();
207 }
208 };
209
210} // namespace rerun::blueprint::archetypes
211
212namespace rerun {
213 /// \private
214 template <typename T>
215 struct AsComponents;
216
217 /// \private
218 template <>
219 struct AsComponents<blueprint::archetypes::TimePanelBlueprint> {
220 /// Serialize all set component batches.
221 static Result<Collection<ComponentBatch>> as_batches(
223 ) {
224 return detail::collect_batches(
225 {&archetype.state,
226 &archetype.timeline,
227 &archetype.playback_speed,
228 &archetype.fps,
229 &archetype.play_state,
230 &archetype.loop_mode,
231 &archetype.time_selection}
232 );
233 }
234 };
235} // 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: Time panel specific state.
Definition time_panel_blueprint.hpp:29
static constexpr auto Descriptor_timeline
ComponentDescriptor for the timeline field.
Definition time_panel_blueprint.hpp:66
std::optional< ComponentBatch > loop_mode
How the time should loop.
Definition time_panel_blueprint.hpp:50
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition time_panel_blueprint.hpp:180
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition time_panel_blueprint.hpp:198
std::optional< ComponentBatch > time_selection
Selects a range of time on the time panel.
Definition time_panel_blueprint.hpp:53
static constexpr auto Descriptor_state
ComponentDescriptor for the state field.
Definition time_panel_blueprint.hpp:61
std::optional< ComponentBatch > timeline
What timeline the panel is on.
Definition time_panel_blueprint.hpp:34
std::optional< ComponentBatch > playback_speed
A time playback speed multiplier.
Definition time_panel_blueprint.hpp:37
std::optional< ComponentBatch > state
Current state of the panel.
Definition time_panel_blueprint.hpp:31
static constexpr auto Descriptor_fps
ComponentDescriptor for the fps field.
Definition time_panel_blueprint.hpp:76
TimePanelBlueprint with_fps(const rerun::blueprint::components::Fps &_fps) &&
Frames per second. Only applicable for sequence timelines.
Definition time_panel_blueprint.hpp:136
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition time_panel_blueprint.hpp:57
static constexpr auto Descriptor_playback_speed
ComponentDescriptor for the playback_speed field.
Definition time_panel_blueprint.hpp:71
TimePanelBlueprint with_timeline(const rerun::blueprint::components::TimelineName &_timeline) &&
What timeline the panel is on.
Definition time_panel_blueprint.hpp:118
TimePanelBlueprint with_state(const rerun::blueprint::components::PanelState &_state) &&
Current state of the panel.
Definition time_panel_blueprint.hpp:112
TimePanelBlueprint with_play_state(const rerun::blueprint::components::PlayState &_play_state) &&
If the time is currently paused, playing, or following.
Definition time_panel_blueprint.hpp:144
static constexpr auto Descriptor_loop_mode
ComponentDescriptor for the loop_mode field.
Definition time_panel_blueprint.hpp:86
std::optional< ComponentBatch > fps
Frames per second. Only applicable for sequence timelines.
Definition time_panel_blueprint.hpp:40
TimePanelBlueprint with_time_selection(const rerun::blueprint::components::AbsoluteTimeRange &_time_selection) &&
Selects a range of time on the time panel.
Definition time_panel_blueprint.hpp:163
static TimePanelBlueprint clear_fields()
Clear all the fields of a TimePanelBlueprint.
TimePanelBlueprint with_loop_mode(const rerun::blueprint::components::LoopMode &_loop_mode) &&
How the time should loop.
Definition time_panel_blueprint.hpp:155
static constexpr auto Descriptor_time_selection
ComponentDescriptor for the time_selection field.
Definition time_panel_blueprint.hpp:91
TimePanelBlueprint with_playback_speed(const rerun::blueprint::components::PlaybackSpeed &_playback_speed) &&
A time playback speed multiplier.
Definition time_panel_blueprint.hpp:126
static constexpr auto Descriptor_play_state
ComponentDescriptor for the play_state field.
Definition time_panel_blueprint.hpp:81
static TimePanelBlueprint update_fields()
Update only some specific fields of a TimePanelBlueprint.
Definition time_panel_blueprint.hpp:104
std::optional< ComponentBatch > play_state
If the time is currently paused, playing, or following.
Definition time_panel_blueprint.hpp:45
Component: A reference to a range of time.
Definition absolute_time_range.hpp:17
Component: Frames per second for a sequence timeline.
Definition fps.hpp:17
Component: A playback speed which determines how fast time progresses.
Definition playback_speed.hpp:17
Component: A timeline identified by its name.
Definition timeline_name.hpp:22