Rerun C++ SDK
Loading...
Searching...
No Matches
card_layout.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/card_layout.def.rs".
3
4#pragma once
5
6#include "../../blueprint/components/column_name.hpp"
7#include "../../collection.hpp"
8#include "../../component_batch.hpp"
9#include "../../component_column.hpp"
10#include "../../result.hpp"
11
12#include <cstdint>
13#include <optional>
14#include <utility>
15#include <vector>
16
17namespace rerun::blueprint::archetypes {
18 /// **Archetype**: Blueprint for displaying table records as cards.
19 ///
20 /// This archetype is stored at the entity `/table/layouts/cards`.
21 ///
22 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
23 ///
24 struct CardLayout {
25 /// The source column used for card titles.
26 ///
27 /// If unset, the first visible string column is used as the title.
28 std::optional<ComponentBatch> title;
29
30 /// The source column containing the target opened when a card is activated.
31 ///
32 /// If unset, the first configured preview field is used, then the first inferred URL column.
33 std::optional<ComponentBatch> link;
34
35 /// Source columns visible by default in each card, in display order.
36 ///
37 /// Unlisted fields are hidden unless their `archetypes::TableColumn` visibility overrides the default.
38 /// Each source column may appear at most once.
39 ///
40 /// Fields with `TableCellKind::Flag` are omitted from the labeled-field list and the first one is shown in the card header.
41 /// Card layouts currently support at most one flag field.
42 std::optional<ComponentBatch> field_order;
43
44 public:
45 /// The name of the archetype as used in `ComponentDescriptor`s.
46 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.CardLayout";
47
48 /// `ComponentDescriptor` for the `title` field.
49 static constexpr auto Descriptor_title = ComponentDescriptor(
50 ArchetypeName, "CardLayout:title",
52 );
53 /// `ComponentDescriptor` for the `link` field.
54 static constexpr auto Descriptor_link = ComponentDescriptor(
55 ArchetypeName, "CardLayout:link",
57 );
58 /// `ComponentDescriptor` for the `field_order` field.
60 ArchetypeName, "CardLayout:field_order",
62 );
63
64 public:
65 CardLayout() = default;
66 CardLayout(CardLayout&& other) = default;
67 CardLayout(const CardLayout& other) = default;
68 CardLayout& operator=(const CardLayout& other) = default;
69 CardLayout& operator=(CardLayout&& other) = default;
70
73 ComponentBatch::from_loggable(std::move(_field_order), Descriptor_field_order)
74 .value_or_throw()
75 ) {}
76
77 /// Update only some specific fields of a `CardLayout`.
79 return CardLayout();
80 }
81
82 /// Clear all the fields of a `CardLayout`.
84
85 /// The source column used for card titles.
86 ///
87 /// If unset, the first visible string column is used as the title.
89 title = ComponentBatch::from_loggable(_title, Descriptor_title).value_or_throw();
90 return std::move(*this);
91 }
92
93 /// The source column containing the target opened when a card is activated.
94 ///
95 /// If unset, the first configured preview field is used, then the first inferred URL column.
97 link = ComponentBatch::from_loggable(_link, Descriptor_link).value_or_throw();
98 return std::move(*this);
99 }
100
101 /// Source columns visible by default in each card, in display order.
102 ///
103 /// Unlisted fields are hidden unless their `archetypes::TableColumn` visibility overrides the default.
104 /// Each source column may appear at most once.
105 ///
106 /// Fields with `TableCellKind::Flag` are omitted from the labeled-field list and the first one is shown in the card header.
107 /// Card layouts currently support at most one flag field.
110 ) && {
112 .value_or_throw();
113 return std::move(*this);
114 }
115
116 /// Partitions the component data into multiple sub-batches.
117 ///
118 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
119 /// instead, via `ComponentBatch::partitioned`.
120 ///
121 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
122 ///
123 /// The specified `lengths` must sum to the total length of the component batch.
125
126 /// Partitions the component data into unit-length sub-batches.
127 ///
128 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
129 /// where `n` is automatically guessed.
131 };
132
133} // namespace rerun::blueprint::archetypes
134
135namespace rerun {
136 /// \private
137 template <typename T>
138 struct AsComponents;
139
140 /// \private
141 template <>
142 struct AsComponents<blueprint::archetypes::CardLayout> {
143 /// Serialize all set component batches.
144 static Result<Collection<ComponentBatch>> as_batches(
145 const blueprint::archetypes::CardLayout& archetype
146 );
147 };
148} // 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: Blueprint for displaying table records as cards.
Definition card_layout.hpp:24
CardLayout with_link(const rerun::blueprint::components::ColumnName &_link) &&
The source column containing the target opened when a card is activated.
Definition card_layout.hpp:96
std::optional< ComponentBatch > field_order
Source columns visible by default in each card, in display order.
Definition card_layout.hpp:42
static CardLayout clear_fields()
Clear all the fields of a CardLayout.
static constexpr auto Descriptor_field_order
ComponentDescriptor for the field_order field.
Definition card_layout.hpp:59
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
std::optional< ComponentBatch > link
The source column containing the target opened when a card is activated.
Definition card_layout.hpp:33
static constexpr auto Descriptor_title
ComponentDescriptor for the title field.
Definition card_layout.hpp:49
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition card_layout.hpp:46
static constexpr auto Descriptor_link
ComponentDescriptor for the link field.
Definition card_layout.hpp:54
std::optional< ComponentBatch > title
The source column used for card titles.
Definition card_layout.hpp:28
CardLayout with_title(const rerun::blueprint::components::ColumnName &_title) &&
The source column used for card titles.
Definition card_layout.hpp:88
static CardLayout update_fields()
Update only some specific fields of a CardLayout.
Definition card_layout.hpp:78
CardLayout with_field_order(const Collection< rerun::blueprint::components::ColumnName > &_field_order) &&
Source columns visible by default in each card, in display order.
Definition card_layout.hpp:108
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Component: The name of a column in a table.
Definition column_name.hpp:22