Rerun C++ SDK
Loading...
Searching...
No Matches
viewport_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/viewport_blueprint.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/auto_layout.hpp"
8#include "../../blueprint/components/auto_views.hpp"
9#include "../../blueprint/components/root_container.hpp"
10#include "../../blueprint/components/view_maximized.hpp"
11#include "../../blueprint/components/viewer_recommendation_hash.hpp"
12#include "../../collection.hpp"
13#include "../../component_batch.hpp"
14#include "../../component_column.hpp"
15#include "../../result.hpp"
16
17#include <cstdint>
18#include <optional>
19#include <utility>
20#include <vector>
21
22namespace rerun::blueprint::archetypes {
23 /// **Archetype**: The top-level description of the viewport.
24 ///
25 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
26 ///
28 /// The layout of the views
29 std::optional<ComponentBatch> root_container;
30
31 /// Show one tab as maximized?
32 std::optional<ComponentBatch> maximized;
33
34 /// Whether the viewport layout is determined automatically.
35 ///
36 /// If `true`, the container layout will be reset whenever a new view is added or removed.
37 /// This defaults to `false` and is automatically set to `false` when there is user determined layout.
38 std::optional<ComponentBatch> auto_layout;
39
40 /// Whether or not views should be created automatically.
41 ///
42 /// If `true`, the viewer will only add views that it hasn't considered previously (as identified by `past_viewer_recommendations`)
43 /// and which aren't deemed redundant to existing views.
44 /// This defaults to `false` and is automatically set to `false` when the user adds views manually in the viewer.
45 std::optional<ComponentBatch> auto_views;
46
47 /// Hashes of all recommended views the viewer has already added and that should not be added again.
48 ///
49 /// This is an internal field and should not be set usually.
50 /// If you want the viewer from stopping to add views, you should set `auto_views` to `false`.
51 ///
52 /// The viewer uses this to determine whether it should keep adding views.
53 std::optional<ComponentBatch> past_viewer_recommendations;
54
55 public:
56 /// The name of the archetype as used in `ComponentDescriptor`s.
57 static constexpr const char ArchetypeName[] =
58 "rerun.blueprint.archetypes.ViewportBlueprint";
59
60 /// `ComponentDescriptor` for the `root_container` field.
62 ArchetypeName, "ViewportBlueprint:root_container",
64 );
65 /// `ComponentDescriptor` for the `maximized` field.
67 ArchetypeName, "ViewportBlueprint:maximized",
69 );
70 /// `ComponentDescriptor` for the `auto_layout` field.
72 ArchetypeName, "ViewportBlueprint:auto_layout",
74 );
75 /// `ComponentDescriptor` for the `auto_views` field.
77 ArchetypeName, "ViewportBlueprint:auto_views",
79 );
80 /// `ComponentDescriptor` for the `past_viewer_recommendations` field.
82 ArchetypeName, "ViewportBlueprint:past_viewer_recommendations",
84 );
85
86 public:
87 ViewportBlueprint() = default;
88 ViewportBlueprint(ViewportBlueprint&& other) = default;
89 ViewportBlueprint(const ViewportBlueprint& other) = default;
90 ViewportBlueprint& operator=(const ViewportBlueprint& other) = default;
91 ViewportBlueprint& operator=(ViewportBlueprint&& other) = default;
92
93 /// Update only some specific fields of a `ViewportBlueprint`.
95 return ViewportBlueprint();
96 }
97
98 /// Clear all the fields of a `ViewportBlueprint`.
100
101 /// The layout of the views
104 ) && {
107 .value_or_throw();
108 return std::move(*this);
109 }
110
111 /// Show one tab as maximized?
114 ) && {
115 maximized =
116 ComponentBatch::from_loggable(_maximized, Descriptor_maximized).value_or_throw();
117 return std::move(*this);
118 }
119
120 /// Whether the viewport layout is determined automatically.
121 ///
122 /// If `true`, the container layout will be reset whenever a new view is added or removed.
123 /// This defaults to `false` and is automatically set to `false` when there is user determined layout.
126 ) && {
128 .value_or_throw();
129 return std::move(*this);
130 }
131
132 /// Whether or not views should be created automatically.
133 ///
134 /// If `true`, the viewer will only add views that it hasn't considered previously (as identified by `past_viewer_recommendations`)
135 /// and which aren't deemed redundant to existing views.
136 /// This defaults to `false` and is automatically set to `false` when the user adds views manually in the viewer.
138 ) && {
139 auto_views =
140 ComponentBatch::from_loggable(_auto_views, Descriptor_auto_views).value_or_throw();
141 return std::move(*this);
142 }
143
144 /// Hashes of all recommended views the viewer has already added and that should not be added again.
145 ///
146 /// This is an internal field and should not be set usually.
147 /// If you want the viewer from stopping to add views, you should set `auto_views` to `false`.
148 ///
149 /// The viewer uses this to determine whether it should keep adding views.
152 _past_viewer_recommendations
153 ) && {
155 _past_viewer_recommendations,
157 )
158 .value_or_throw();
159 return std::move(*this);
160 }
161
162 /// Partitions the component data into multiple sub-batches.
163 ///
164 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
165 /// instead, via `ComponentBatch::partitioned`.
166 ///
167 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
168 ///
169 /// The specified `lengths` must sum to the total length of the component batch.
171 return detail::partition_batches(
173 &maximized,
175 &auto_views,
177 lengths_
178 )
179 .value_or_throw();
180 }
181
182 /// Partitions the component data into unit-length sub-batches.
183 ///
184 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
185 /// where `n` is automatically guessed.
187 return detail::partition_batches_of_unit_length({&root_container,
188 &maximized,
190 &auto_views,
192 .value_or_throw();
193 }
194 };
195
196} // namespace rerun::blueprint::archetypes
197
198namespace rerun {
199 /// \private
200 template <typename T>
201 struct AsComponents;
202
203 /// \private
204 template <>
205 struct AsComponents<blueprint::archetypes::ViewportBlueprint> {
206 /// Serialize all set component batches.
207 static Result<Collection<ComponentBatch>> as_batches(
209 ) {
210 return detail::collect_batches(
211 {&archetype.root_container,
212 &archetype.maximized,
213 &archetype.auto_layout,
214 &archetype.auto_views,
216 );
217 }
218 };
219} // 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: The top-level description of the viewport.
Definition viewport_blueprint.hpp:27
ViewportBlueprint with_past_viewer_recommendations(const Collection< rerun::blueprint::components::ViewerRecommendationHash > &_past_viewer_recommendations) &&
Hashes of all recommended views the viewer has already added and that should not be added again.
Definition viewport_blueprint.hpp:150
static constexpr auto Descriptor_root_container
ComponentDescriptor for the root_container field.
Definition viewport_blueprint.hpp:61
std::optional< ComponentBatch > auto_layout
Whether the viewport layout is determined automatically.
Definition viewport_blueprint.hpp:38
std::optional< ComponentBatch > past_viewer_recommendations
Hashes of all recommended views the viewer has already added and that should not be added again.
Definition viewport_blueprint.hpp:53
ViewportBlueprint with_auto_views(const rerun::blueprint::components::AutoViews &_auto_views) &&
Whether or not views should be created automatically.
Definition viewport_blueprint.hpp:137
std::optional< ComponentBatch > root_container
The layout of the views.
Definition viewport_blueprint.hpp:29
static constexpr auto Descriptor_past_viewer_recommendations
ComponentDescriptor for the past_viewer_recommendations field.
Definition viewport_blueprint.hpp:81
std::optional< ComponentBatch > auto_views
Whether or not views should be created automatically.
Definition viewport_blueprint.hpp:45
static ViewportBlueprint clear_fields()
Clear all the fields of a ViewportBlueprint.
static constexpr auto Descriptor_auto_views
ComponentDescriptor for the auto_views field.
Definition viewport_blueprint.hpp:76
ViewportBlueprint with_auto_layout(const rerun::blueprint::components::AutoLayout &_auto_layout) &&
Whether the viewport layout is determined automatically.
Definition viewport_blueprint.hpp:124
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition viewport_blueprint.hpp:186
std::optional< ComponentBatch > maximized
Show one tab as maximized?
Definition viewport_blueprint.hpp:32
static ViewportBlueprint update_fields()
Update only some specific fields of a ViewportBlueprint.
Definition viewport_blueprint.hpp:94
static constexpr auto Descriptor_auto_layout
ComponentDescriptor for the auto_layout field.
Definition viewport_blueprint.hpp:71
ViewportBlueprint with_maximized(const rerun::blueprint::components::ViewMaximized &_maximized) &&
Show one tab as maximized?
Definition viewport_blueprint.hpp:112
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition viewport_blueprint.hpp:57
ViewportBlueprint with_root_container(const rerun::blueprint::components::RootContainer &_root_container) &&
The layout of the views.
Definition viewport_blueprint.hpp:102
static constexpr auto Descriptor_maximized
ComponentDescriptor for the maximized field.
Definition viewport_blueprint.hpp:66
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition viewport_blueprint.hpp:170
Component: Whether the viewport layout is determined automatically.
Definition auto_layout.hpp:17
Component: Whether or not views should be created automatically.
Definition auto_views.hpp:17
Component: The container that sits at the root of a viewport.
Definition root_container.hpp:18
Component: Whether a view is maximized.
Definition view_maximized.hpp:18