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/store/re_types/definitions/rerun/blueprint/archetypes/container_blueprint.fbs".
3
4#pragma once
5
6#include "../../blueprint/components/active_tab.hpp"
7#include "../../blueprint/components/column_share.hpp"
8#include "../../blueprint/components/container_kind.hpp"
9#include "../../blueprint/components/grid_columns.hpp"
10#include "../../blueprint/components/included_content.hpp"
11#include "../../blueprint/components/row_share.hpp"
12#include "../../blueprint/components/visible.hpp"
13#include "../../collection.hpp"
14#include "../../component_batch.hpp"
15#include "../../component_column.hpp"
16#include "../../components/name.hpp"
17#include "../../indicator_component.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.
28 /// The class of the view.
29 std::optional<ComponentBatch> container_kind;
30
31 /// The name of the container.
32 std::optional<ComponentBatch> display_name;
33
34 /// `ContainerId`s or `ViewId`s that are children of this container.
35 std::optional<ComponentBatch> contents;
36
37 /// The layout shares of each column in the container.
38 ///
39 /// For `components::ContainerKind::Horizontal` containers, the length of this list should always match the number of contents.
40 ///
41 /// Ignored for `components::ContainerKind::Vertical` containers.
42 std::optional<ComponentBatch> col_shares;
43
44 /// The layout shares of each row of the container.
45 ///
46 /// For `components::ContainerKind::Vertical` containers, the length of this list should always match the number of contents.
47 ///
48 /// Ignored for `components::ContainerKind::Horizontal` containers.
49 std::optional<ComponentBatch> row_shares;
50
51 /// Which tab is active.
52 ///
53 /// Only applies to `Tabs` containers.
54 std::optional<ComponentBatch> active_tab;
55
56 /// Whether this container is visible.
57 ///
58 /// Defaults to true if not specified.
59 std::optional<ComponentBatch> visible;
60
61 /// How many columns this grid should have.
62 ///
63 /// If unset, the grid layout will be auto.
64 ///
65 /// Ignored for `components::ContainerKind::Horizontal`/`components::ContainerKind::Vertical` containers.
66 std::optional<ComponentBatch> grid_columns;
67
68 public:
69 static constexpr const char IndicatorComponentName[] =
70 "rerun.blueprint.components.ContainerBlueprintIndicator";
71
72 /// Indicator component, used to identify the archetype when converting to a list of components.
74 /// The name of the archetype as used in `ComponentDescriptor`s.
75 static constexpr const char ArchetypeName[] =
76 "rerun.blueprint.archetypes.ContainerBlueprint";
77
78 /// `ComponentDescriptor` for the `container_kind` field.
80 ArchetypeName, "container_kind",
82 );
83 /// `ComponentDescriptor` for the `display_name` field.
85 ArchetypeName, "display_name",
87 );
88 /// `ComponentDescriptor` for the `contents` field.
90 ArchetypeName, "contents",
92 );
93 /// `ComponentDescriptor` for the `col_shares` field.
95 ArchetypeName, "col_shares",
97 );
98 /// `ComponentDescriptor` for the `row_shares` field.
100 ArchetypeName, "row_shares",
102 );
103 /// `ComponentDescriptor` for the `active_tab` field.
105 ArchetypeName, "active_tab",
107 );
108 /// `ComponentDescriptor` for the `visible` field.
110 ArchetypeName, "visible",
112 );
113 /// `ComponentDescriptor` for the `grid_columns` field.
115 ArchetypeName, "grid_columns",
117 );
118
119 public:
120 ContainerBlueprint() = default;
121 ContainerBlueprint(ContainerBlueprint&& other) = default;
122 ContainerBlueprint(const ContainerBlueprint& other) = default;
123 ContainerBlueprint& operator=(const ContainerBlueprint& other) = default;
124 ContainerBlueprint& operator=(ContainerBlueprint&& other) = default;
125
126 explicit ContainerBlueprint(rerun::blueprint::components::ContainerKind _container_kind)
127 : container_kind(ComponentBatch::from_loggable(
128 std::move(_container_kind), Descriptor_container_kind
129 )
130 .value_or_throw()) {}
131
132 /// Update only some specific fields of a `ContainerBlueprint`.
134 return ContainerBlueprint();
135 }
136
137 /// Clear all the fields of a `ContainerBlueprint`.
139
140 /// The class of the view.
142 const rerun::blueprint::components::ContainerKind& _container_kind
143 ) && {
146 .value_or_throw();
147 return std::move(*this);
148 }
149
150 /// The name of the container.
153 .value_or_throw();
154 return std::move(*this);
155 }
156
157 /// `ContainerId`s or `ViewId`s that are children of this container.
160 ) && {
161 contents =
162 ComponentBatch::from_loggable(_contents, Descriptor_contents).value_or_throw();
163 return std::move(*this);
164 }
165
166 /// The layout shares of each column in the container.
167 ///
168 /// For `components::ContainerKind::Horizontal` containers, the length of this list should always match the number of contents.
169 ///
170 /// Ignored for `components::ContainerKind::Vertical` containers.
173 ) && {
174 col_shares =
175 ComponentBatch::from_loggable(_col_shares, Descriptor_col_shares).value_or_throw();
176 return std::move(*this);
177 }
178
179 /// The layout shares of each row of the container.
180 ///
181 /// For `components::ContainerKind::Vertical` containers, the length of this list should always match the number of contents.
182 ///
183 /// Ignored for `components::ContainerKind::Horizontal` containers.
186 ) && {
187 row_shares =
188 ComponentBatch::from_loggable(_row_shares, Descriptor_row_shares).value_or_throw();
189 return std::move(*this);
190 }
191
192 /// Which tab is active.
193 ///
194 /// Only applies to `Tabs` containers.
197 ) && {
198 active_tab =
199 ComponentBatch::from_loggable(_active_tab, Descriptor_active_tab).value_or_throw();
200 return std::move(*this);
201 }
202
203 /// Whether this container is visible.
204 ///
205 /// Defaults to true if not specified.
207 visible = ComponentBatch::from_loggable(_visible, Descriptor_visible).value_or_throw();
208 return std::move(*this);
209 }
210
211 /// How many columns this grid should have.
212 ///
213 /// If unset, the grid layout will be auto.
214 ///
215 /// Ignored for `components::ContainerKind::Horizontal`/`components::ContainerKind::Vertical` containers.
218 ) && {
220 .value_or_throw();
221 return std::move(*this);
222 }
223
224 /// Partitions the component data into multiple sub-batches.
225 ///
226 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
227 /// instead, via `ComponentBatch::partitioned`.
228 ///
229 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
230 ///
231 /// The specified `lengths` must sum to the total length of the component batch.
233
234 /// Partitions the component data into unit-length sub-batches.
235 ///
236 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
237 /// where `n` is automatically guessed.
239 };
240
241} // namespace rerun::blueprint::archetypes
242
243namespace rerun {
244 /// \private
245 template <typename T>
246 struct AsComponents;
247
248 /// \private
249 template <>
250 struct AsComponents<blueprint::archetypes::ContainerBlueprint> {
251 /// Serialize all set component batches.
252 static Result<Collection<ComponentBatch>> as_batches(
254 );
255 };
256} // 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:23
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=rerun::Loggable< T >::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:14
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:27
static constexpr auto Descriptor_display_name
ComponentDescriptor for the display_name field.
Definition container_blueprint.hpp:84
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:171
std::optional< ComponentBatch > active_tab
Which tab is active.
Definition container_blueprint.hpp:54
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition container_blueprint.hpp:75
std::optional< ComponentBatch > display_name
The name of the container.
Definition container_blueprint.hpp:32
ContainerBlueprint with_container_kind(const rerun::blueprint::components::ContainerKind &_container_kind) &&
The class of the view.
Definition container_blueprint.hpp:141
static constexpr auto Descriptor_grid_columns
ComponentDescriptor for the grid_columns field.
Definition container_blueprint.hpp:114
std::optional< ComponentBatch > container_kind
The class of the view.
Definition container_blueprint.hpp:29
static constexpr auto Descriptor_contents
ComponentDescriptor for the contents field.
Definition container_blueprint.hpp:89
ContainerBlueprint with_visible(const rerun::blueprint::components::Visible &_visible) &&
Whether this container is visible.
Definition container_blueprint.hpp:206
ContainerBlueprint with_grid_columns(const rerun::blueprint::components::GridColumns &_grid_columns) &&
How many columns this grid should have.
Definition container_blueprint.hpp:216
ContainerBlueprint with_display_name(const rerun::components::Name &_display_name) &&
The name of the container.
Definition container_blueprint.hpp:151
std::optional< ComponentBatch > row_shares
The layout shares of each row of the container.
Definition container_blueprint.hpp:49
std::optional< ComponentBatch > contents
ContainerIds or ViewIds that are children of this container.
Definition container_blueprint.hpp:35
static constexpr auto Descriptor_container_kind
ComponentDescriptor for the container_kind field.
Definition container_blueprint.hpp:79
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
ContainerBlueprint with_contents(const Collection< rerun::blueprint::components::IncludedContent > &_contents) &&
ContainerIds or ViewIds that are children of this container.
Definition container_blueprint.hpp:158
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:184
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
static constexpr auto Descriptor_active_tab
ComponentDescriptor for the active_tab field.
Definition container_blueprint.hpp:104
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:42
static constexpr auto Descriptor_row_shares
ComponentDescriptor for the row_shares field.
Definition container_blueprint.hpp:99
std::optional< ComponentBatch > visible
Whether this container is visible.
Definition container_blueprint.hpp:59
static constexpr auto Descriptor_col_shares
ComponentDescriptor for the col_shares field.
Definition container_blueprint.hpp:94
static ContainerBlueprint update_fields()
Update only some specific fields of a ContainerBlueprint.
Definition container_blueprint.hpp:133
ContainerBlueprint with_active_tab(const rerun::blueprint::components::ActiveTab &_active_tab) &&
Which tab is active.
Definition container_blueprint.hpp:195
static constexpr auto Descriptor_visible
ComponentDescriptor for the visible field.
Definition container_blueprint.hpp:109
std::optional< ComponentBatch > grid_columns
How many columns this grid should have.
Definition container_blueprint.hpp:66
Component: The active tab in a tabbed container.
Definition active_tab.hpp:17
Component: How many columns a grid container should have.
Definition grid_columns.hpp:15
Component: Whether the container, view, entity or instance is currently visible.
Definition visible.hpp:15
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32
Component: A display name, typically for an entity or a item like a plot series.
Definition name.hpp:17