Rerun C++ SDK
Loading...
Searching...
No Matches
container_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/container_blueprint.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/active_tab.hpp"
8#include "../../blueprint/components/column_share.hpp"
9#include "../../blueprint/components/container_kind.hpp"
10#include "../../blueprint/components/grid_columns.hpp"
11#include "../../blueprint/components/included_content.hpp"
12#include "../../blueprint/components/row_share.hpp"
13#include "../../collection.hpp"
14#include "../../component_batch.hpp"
15#include "../../component_column.hpp"
16#include "../../components/name.hpp"
17#include "../../components/visible.hpp"
18#include "../../result.hpp"
19
20#include <cstdint>
21#include <optional>
22#include <utility>
23#include <vector>
24
25namespace rerun::blueprint::archetypes {
26 /// **Archetype**: The description of a container.
27 ///
28 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
29 ///
31 /// The class of the view.
32 std::optional<ComponentBatch> container_kind;
33
34 /// The name of the container.
35 std::optional<ComponentBatch> display_name;
36
37 /// `ContainerId`s or `ViewId`s that are children of this container.
38 std::optional<ComponentBatch> contents;
39
40 /// The layout shares of each column in the container.
41 ///
42 /// For `components::ContainerKind::Horizontal` containers, the length of this list should always match the number of contents.
43 ///
44 /// Ignored for `components::ContainerKind::Vertical` containers.
45 std::optional<ComponentBatch> col_shares;
46
47 /// The layout shares of each row of the container.
48 ///
49 /// For `components::ContainerKind::Vertical` containers, the length of this list should always match the number of contents.
50 ///
51 /// Ignored for `components::ContainerKind::Horizontal` containers.
52 std::optional<ComponentBatch> row_shares;
53
54 /// Which tab is active.
55 ///
56 /// Only applies to `Tabs` containers.
57 std::optional<ComponentBatch> active_tab;
58
59 /// Whether this container is visible.
60 ///
61 /// Defaults to true if not specified.
62 std::optional<ComponentBatch> visible;
63
64 /// How many columns this grid should have.
65 ///
66 /// If unset, the grid layout will be auto.
67 ///
68 /// Ignored for `components::ContainerKind::Horizontal`/`components::ContainerKind::Vertical` containers.
69 std::optional<ComponentBatch> grid_columns;
70
71 public:
72 /// The name of the archetype as used in `ComponentDescriptor`s.
73 static constexpr const char ArchetypeName[] =
74 "rerun.blueprint.archetypes.ContainerBlueprint";
75
76 /// `ComponentDescriptor` for the `container_kind` field.
78 ArchetypeName, "ContainerBlueprint:container_kind",
80 );
81 /// `ComponentDescriptor` for the `display_name` field.
83 ArchetypeName, "ContainerBlueprint:display_name",
85 );
86 /// `ComponentDescriptor` for the `contents` field.
88 ArchetypeName, "ContainerBlueprint:contents",
90 );
91 /// `ComponentDescriptor` for the `col_shares` field.
93 ArchetypeName, "ContainerBlueprint:col_shares",
95 );
96 /// `ComponentDescriptor` for the `row_shares` field.
98 ArchetypeName, "ContainerBlueprint:row_shares",
100 );
101 /// `ComponentDescriptor` for the `active_tab` field.
103 ArchetypeName, "ContainerBlueprint:active_tab",
105 );
106 /// `ComponentDescriptor` for the `visible` field.
108 ArchetypeName, "ContainerBlueprint:visible",
110 );
111 /// `ComponentDescriptor` for the `grid_columns` field.
113 ArchetypeName, "ContainerBlueprint:grid_columns",
115 );
116
117 public:
118 ContainerBlueprint() = default;
119 ContainerBlueprint(ContainerBlueprint&& other) = default;
120 ContainerBlueprint(const ContainerBlueprint& other) = default;
121 ContainerBlueprint& operator=(const ContainerBlueprint& other) = default;
122 ContainerBlueprint& operator=(ContainerBlueprint&& other) = default;
123
124 explicit ContainerBlueprint(rerun::blueprint::components::ContainerKind _container_kind)
125 : container_kind(ComponentBatch::from_loggable(
126 std::move(_container_kind), Descriptor_container_kind
127 )
128 .value_or_throw()) {}
129
130 /// Update only some specific fields of a `ContainerBlueprint`.
132 return ContainerBlueprint();
133 }
134
135 /// Clear all the fields of a `ContainerBlueprint`.
137
138 /// The class of the view.
140 const rerun::blueprint::components::ContainerKind& _container_kind
141 ) && {
144 .value_or_throw();
145 return std::move(*this);
146 }
147
148 /// The name of the container.
151 .value_or_throw();
152 return std::move(*this);
153 }
154
155 /// `ContainerId`s or `ViewId`s that are children of this container.
158 ) && {
159 contents =
160 ComponentBatch::from_loggable(_contents, Descriptor_contents).value_or_throw();
161 return std::move(*this);
162 }
163
164 /// The layout shares of each column in the container.
165 ///
166 /// For `components::ContainerKind::Horizontal` containers, the length of this list should always match the number of contents.
167 ///
168 /// Ignored for `components::ContainerKind::Vertical` containers.
171 ) && {
172 col_shares =
173 ComponentBatch::from_loggable(_col_shares, Descriptor_col_shares).value_or_throw();
174 return std::move(*this);
175 }
176
177 /// The layout shares of each row of the container.
178 ///
179 /// For `components::ContainerKind::Vertical` containers, the length of this list should always match the number of contents.
180 ///
181 /// Ignored for `components::ContainerKind::Horizontal` containers.
184 ) && {
185 row_shares =
186 ComponentBatch::from_loggable(_row_shares, Descriptor_row_shares).value_or_throw();
187 return std::move(*this);
188 }
189
190 /// Which tab is active.
191 ///
192 /// Only applies to `Tabs` containers.
195 ) && {
196 active_tab =
197 ComponentBatch::from_loggable(_active_tab, Descriptor_active_tab).value_or_throw();
198 return std::move(*this);
199 }
200
201 /// Whether this container is visible.
202 ///
203 /// Defaults to true if not specified.
205 visible = ComponentBatch::from_loggable(_visible, Descriptor_visible).value_or_throw();
206 return std::move(*this);
207 }
208
209 /// How many columns this grid should have.
210 ///
211 /// If unset, the grid layout will be auto.
212 ///
213 /// Ignored for `components::ContainerKind::Horizontal`/`components::ContainerKind::Vertical` containers.
216 ) && {
218 .value_or_throw();
219 return std::move(*this);
220 }
221
222 /// Partitions the component data into multiple sub-batches.
223 ///
224 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
225 /// instead, via `ComponentBatch::partitioned`.
226 ///
227 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
228 ///
229 /// The specified `lengths` must sum to the total length of the component batch.
231 return detail::partition_batches(
234 &contents,
235 &col_shares,
236 &row_shares,
237 &active_tab,
238 &visible,
239 &grid_columns},
240 lengths_
241 )
242 .value_or_throw();
243 }
244
245 /// Partitions the component data into unit-length sub-batches.
246 ///
247 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
248 /// where `n` is automatically guessed.
250 return detail::partition_batches_of_unit_length({&container_kind,
252 &contents,
253 &col_shares,
254 &row_shares,
255 &active_tab,
256 &visible,
257 &grid_columns})
258 .value_or_throw();
259 }
260 };
261
262} // namespace rerun::blueprint::archetypes
263
264namespace rerun {
265 /// \private
266 template <typename T>
267 struct AsComponents;
268
269 /// \private
270 template <>
271 struct AsComponents<blueprint::archetypes::ContainerBlueprint> {
272 /// Serialize all set component batches.
273 static Result<Collection<ComponentBatch>> as_batches(
275 ) {
276 return detail::collect_batches(
277 {&archetype.container_kind,
278 &archetype.display_name,
279 &archetype.contents,
280 &archetype.col_shares,
281 &archetype.row_shares,
282 &archetype.active_tab,
283 &archetype.visible,
284 &archetype.grid_columns}
285 );
286 }
287 };
288} // 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
Arrow-encoded data of a single batch of components together with a component descriptor.
Definition component_batch.hpp:28
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 description of a container.
Definition container_blueprint.hpp:30
static constexpr auto Descriptor_display_name
ComponentDescriptor for the display_name field.
Definition container_blueprint.hpp:82
ContainerBlueprint with_col_shares(const Collection< rerun::blueprint::components::ColumnShare > &_col_shares) &&
The layout shares of each column in the container.
Definition container_blueprint.hpp:169
std::optional< ComponentBatch > active_tab
Which tab is active.
Definition container_blueprint.hpp:57
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition container_blueprint.hpp:73
std::optional< ComponentBatch > display_name
The name of the container.
Definition container_blueprint.hpp:35
ContainerBlueprint with_container_kind(const rerun::blueprint::components::ContainerKind &_container_kind) &&
The class of the view.
Definition container_blueprint.hpp:139
static constexpr auto Descriptor_grid_columns
ComponentDescriptor for the grid_columns field.
Definition container_blueprint.hpp:112
ContainerBlueprint with_visible(const rerun::components::Visible &_visible) &&
Whether this container is visible.
Definition container_blueprint.hpp:204
std::optional< ComponentBatch > container_kind
The class of the view.
Definition container_blueprint.hpp:32
static constexpr auto Descriptor_contents
ComponentDescriptor for the contents field.
Definition container_blueprint.hpp:87
ContainerBlueprint with_grid_columns(const rerun::blueprint::components::GridColumns &_grid_columns) &&
How many columns this grid should have.
Definition container_blueprint.hpp:214
ContainerBlueprint with_display_name(const rerun::components::Name &_display_name) &&
The name of the container.
Definition container_blueprint.hpp:149
std::optional< ComponentBatch > row_shares
The layout shares of each row of the container.
Definition container_blueprint.hpp:52
std::optional< ComponentBatch > contents
ContainerIds or ViewIds that are children of this container.
Definition container_blueprint.hpp:38
static constexpr auto Descriptor_container_kind
ComponentDescriptor for the container_kind field.
Definition container_blueprint.hpp:77
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition container_blueprint.hpp:249
ContainerBlueprint with_contents(const Collection< rerun::blueprint::components::IncludedContent > &_contents) &&
ContainerIds or ViewIds that are children of this container.
Definition container_blueprint.hpp:156
ContainerBlueprint with_row_shares(const Collection< rerun::blueprint::components::RowShare > &_row_shares) &&
The layout shares of each row of the container.
Definition container_blueprint.hpp:182
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition container_blueprint.hpp:230
static constexpr auto Descriptor_active_tab
ComponentDescriptor for the active_tab field.
Definition container_blueprint.hpp:102
static ContainerBlueprint clear_fields()
Clear all the fields of a ContainerBlueprint.
std::optional< ComponentBatch > col_shares
The layout shares of each column in the container.
Definition container_blueprint.hpp:45
static constexpr auto Descriptor_row_shares
ComponentDescriptor for the row_shares field.
Definition container_blueprint.hpp:97
std::optional< ComponentBatch > visible
Whether this container is visible.
Definition container_blueprint.hpp:62
static constexpr auto Descriptor_col_shares
ComponentDescriptor for the col_shares field.
Definition container_blueprint.hpp:92
static ContainerBlueprint update_fields()
Update only some specific fields of a ContainerBlueprint.
Definition container_blueprint.hpp:131
ContainerBlueprint with_active_tab(const rerun::blueprint::components::ActiveTab &_active_tab) &&
Which tab is active.
Definition container_blueprint.hpp:193
static constexpr auto Descriptor_visible
ComponentDescriptor for the visible field.
Definition container_blueprint.hpp:107
std::optional< ComponentBatch > grid_columns
How many columns this grid should have.
Definition container_blueprint.hpp:69
Component: The active tab in a tabbed container.
Definition active_tab.hpp:19
Component: How many columns a grid container should have.
Definition grid_columns.hpp:17
Component: A display name, typically for an entity or a item like a plot series.
Definition name.hpp:19
Component: Whether the container, view, entity or instance is currently visible.
Definition visible.hpp:14