Rerun C++ SDK
Loading...
Searching...
No Matches
table_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/table_blueprint.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/column_display_mode.hpp"
8#include "../../blueprint/components/sort_by.hpp"
9#include "../../blueprint/components/sql_filter_expression.hpp"
10#include "../../blueprint/components/table_layout_kind.hpp"
11#include "../../collection.hpp"
12#include "../../component_batch.hpp"
13#include "../../component_column.hpp"
14#include "../../result.hpp"
15
16#include <cstdint>
17#include <optional>
18#include <utility>
19#include <vector>
20
21namespace rerun::blueprint::archetypes {
22 /// **Archetype**: Blueprint for configuring the styling of a table.
23 ///
24 /// The table blueprint as a whole is distributed across these entity paths:
25 /// * `/table` for this archetype and `archetypes::PreviewsConfig`.
26 /// * `/table/layouts/table` for `archetypes::TableLayout`.
27 /// * `/table/layouts/table/columns/{column_name}` for table `archetypes::TableColumn` archetypes and per-column options such as `archetypes::TableColumnPreview`.
28 /// * `/table/layouts/cards` for `archetypes::CardLayout`.
29 /// * `/table/layouts/cards/fields/{column_name}` for card `archetypes::TableColumn` archetypes and per-field options such as `archetypes::TableColumnPreview`.
30 /// * `/view/{view_id}` for preview `archetypes::ViewBlueprint` definitions.
31 ///
32 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
33 ///
35 /// The currently selected layout.
36 ///
37 /// If unset, defaults to card layout if available.
38 /// `Cards` falls back to table layout when no `archetypes::CardLayout` is configured.
39 std::optional<ComponentBatch> layout;
40
41 /// Formatting for column names in table and card layouts.
42 ///
43 /// Defaults to compact formatting when unset.
44 /// Explicit column display names take precedence.
45 std::optional<ComponentBatch> column_display_mode;
46
47 /// Filters for the table's rows.
48 ///
49 /// A row in the table is only shown when *all* filters evaluate to true for it.
50 /// Each filter only sees the values of a single row, so functions that combine rows, such as `sum` or `count`, are not allowed.
51 /// Write one condition per filter instead of joining them with `AND`.
52 ///
53 /// Users cannot write SQL in the viewer.
54 /// They add filters with "Filter" in a column header's menu, which only writes the forms below.
55 /// The viewer shows these forms on a single column `"c"` as filters the user can edit.
56 /// Any other expression shows as a `Custom "c" filter` chip, which the user can only remove and whose SQL only shows on hover:
57 /// * Numbers: `"c" = 7`, `"c" <7`, `"c" <= 7`, `"c"> 7`, `"c">= 7`.
58 /// For a 32-bit float column, write the value as `CAST(0.1 AS REAL)`.
59 /// * Strings: `"c" ILIKE '%text%'` for contains, `'text%'` for starts with, `'%text'` for ends with.
60 /// Put a backslash before a literal `%`, `_` or backslash, and follow the pattern with an ESCAPE clause that names a quoted backslash.
61 /// * Booleans: `"c" = true`, `"c" = false`, and `"c" IS NULL` for a nullable column.
62 /// * Timestamps: `"c" <TIMESTAMPTZ '2026-01-01T00:00:00Z'` for before, `>=` for after, and both joined with `AND` for between.
63 /// Relative ranges have the same shape, such as `"c">= now() - INTERVAL '24 hours' AND "c" <now()` for the last 24 hours,
64 /// or `"c">= date_trunc('day', now()) AND "c" <date_trunc('day', now()) + INTERVAL '1 day'` for today.
65 /// Use `'week'` with `INTERVAL '7 days'` for this week, and shift both bounds back for yesterday or last week.
66 /// For an `Int64` column of nanoseconds, use `to_timestamp_nanos("c")`.
67 /// * Lists: any form above on `x` inside `any_match("c", x -> …)`, true when any element is.
68 ///
69 /// Wrapping a form in `(…) IS NOT TRUE` gives its opposite, such as not equal or does not contain.
70 std::optional<ComponentBatch> filters;
71
72 /// The column and direction the table's rows are sorted by.
73 ///
74 /// Rows keep the order of the data when unset.
75 std::optional<ComponentBatch> sort_by;
76
77 public:
78 /// The name of the archetype as used in `ComponentDescriptor`s.
79 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.TableBlueprint";
80
81 /// `ComponentDescriptor` for the `layout` field.
82 static constexpr auto Descriptor_layout = ComponentDescriptor(
83 ArchetypeName, "TableBlueprint:layout",
85 );
86 /// `ComponentDescriptor` for the `column_display_mode` field.
88 ArchetypeName, "TableBlueprint:column_display_mode",
90 );
91 /// `ComponentDescriptor` for the `filters` field.
92 static constexpr auto Descriptor_filters = ComponentDescriptor(
93 ArchetypeName, "TableBlueprint:filters",
95 );
96 /// `ComponentDescriptor` for the `sort_by` field.
97 static constexpr auto Descriptor_sort_by = ComponentDescriptor(
98 ArchetypeName, "TableBlueprint:sort_by",
100 );
101
102 public:
103 TableBlueprint() = default;
104 TableBlueprint(TableBlueprint&& other) = default;
105 TableBlueprint(const TableBlueprint& other) = default;
106 TableBlueprint& operator=(const TableBlueprint& other) = default;
107 TableBlueprint& operator=(TableBlueprint&& other) = default;
108
109 /// Update only some specific fields of a `TableBlueprint`.
111 return TableBlueprint();
112 }
113
114 /// Clear all the fields of a `TableBlueprint`.
116
117 /// The currently selected layout.
118 ///
119 /// If unset, defaults to card layout if available.
120 /// `Cards` falls back to table layout when no `archetypes::CardLayout` is configured.
121 TableBlueprint with_layout(const rerun::blueprint::components::TableLayoutKind& _layout
122 ) && {
123 layout = ComponentBatch::from_loggable(_layout, Descriptor_layout).value_or_throw();
124 return std::move(*this);
125 }
126
127 /// Formatting for column names in table and card layouts.
128 ///
129 /// Defaults to compact formatting when unset.
130 /// Explicit column display names take precedence.
132 const rerun::blueprint::components::ColumnDisplayMode& _column_display_mode
133 ) && {
136 .value_or_throw();
137 return std::move(*this);
138 }
139
140 /// Filters for the table's rows.
141 ///
142 /// A row in the table is only shown when *all* filters evaluate to true for it.
143 /// Each filter only sees the values of a single row, so functions that combine rows, such as `sum` or `count`, are not allowed.
144 /// Write one condition per filter instead of joining them with `AND`.
145 ///
146 /// Users cannot write SQL in the viewer.
147 /// They add filters with "Filter" in a column header's menu, which only writes the forms below.
148 /// The viewer shows these forms on a single column `"c"` as filters the user can edit.
149 /// Any other expression shows as a `Custom "c" filter` chip, which the user can only remove and whose SQL only shows on hover:
150 /// * Numbers: `"c" = 7`, `"c" <7`, `"c" <= 7`, `"c"> 7`, `"c">= 7`.
151 /// For a 32-bit float column, write the value as `CAST(0.1 AS REAL)`.
152 /// * Strings: `"c" ILIKE '%text%'` for contains, `'text%'` for starts with, `'%text'` for ends with.
153 /// Put a backslash before a literal `%`, `_` or backslash, and follow the pattern with an ESCAPE clause that names a quoted backslash.
154 /// * Booleans: `"c" = true`, `"c" = false`, and `"c" IS NULL` for a nullable column.
155 /// * Timestamps: `"c" <TIMESTAMPTZ '2026-01-01T00:00:00Z'` for before, `>=` for after, and both joined with `AND` for between.
156 /// Relative ranges have the same shape, such as `"c">= now() - INTERVAL '24 hours' AND "c" <now()` for the last 24 hours,
157 /// or `"c">= date_trunc('day', now()) AND "c" <date_trunc('day', now()) + INTERVAL '1 day'` for today.
158 /// Use `'week'` with `INTERVAL '7 days'` for this week, and shift both bounds back for yesterday or last week.
159 /// For an `Int64` column of nanoseconds, use `to_timestamp_nanos("c")`.
160 /// * Lists: any form above on `x` inside `any_match("c", x -> …)`, true when any element is.
161 ///
162 /// Wrapping a form in `(…) IS NOT TRUE` gives its opposite, such as not equal or does not contain.
165 ) && {
166 filters = ComponentBatch::from_loggable(_filters, Descriptor_filters).value_or_throw();
167 return std::move(*this);
168 }
169
170 /// The column and direction the table's rows are sorted by.
171 ///
172 /// Rows keep the order of the data when unset.
174 sort_by = ComponentBatch::from_loggable(_sort_by, Descriptor_sort_by).value_or_throw();
175 return std::move(*this);
176 }
177
178 /// Partitions the component data into multiple sub-batches.
179 ///
180 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
181 /// instead, via `ComponentBatch::partitioned`.
182 ///
183 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
184 ///
185 /// The specified `lengths` must sum to the total length of the component batch.
187 return detail::partition_batches(
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(
201 )
202 .value_or_throw();
203 }
204 };
205
206} // namespace rerun::blueprint::archetypes
207
208namespace rerun {
209 /// \private
210 template <typename T>
211 struct AsComponents;
212
213 /// \private
214 template <>
215 struct AsComponents<blueprint::archetypes::TableBlueprint> {
216 /// Serialize all set component batches.
217 static Result<Collection<ComponentBatch>> as_batches(
219 ) {
220 return detail::collect_batches(
221 {&archetype.layout,
222 &archetype.column_display_mode,
223 &archetype.filters,
224 &archetype.sort_by}
225 );
226 }
227 };
228} // 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: Blueprint for configuring the styling of a table.
Definition table_blueprint.hpp:34
static constexpr auto Descriptor_column_display_mode
ComponentDescriptor for the column_display_mode field.
Definition table_blueprint.hpp:87
static TableBlueprint update_fields()
Update only some specific fields of a TableBlueprint.
Definition table_blueprint.hpp:110
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition table_blueprint.hpp:79
static constexpr auto Descriptor_layout
ComponentDescriptor for the layout field.
Definition table_blueprint.hpp:82
std::optional< ComponentBatch > filters
Filters for the table's rows.
Definition table_blueprint.hpp:70
static constexpr auto Descriptor_filters
ComponentDescriptor for the filters field.
Definition table_blueprint.hpp:92
std::optional< ComponentBatch > layout
The currently selected layout.
Definition table_blueprint.hpp:39
TableBlueprint with_layout(const rerun::blueprint::components::TableLayoutKind &_layout) &&
The currently selected layout.
Definition table_blueprint.hpp:121
TableBlueprint with_filters(const Collection< rerun::blueprint::components::SqlFilterExpression > &_filters) &&
Filters for the table's rows.
Definition table_blueprint.hpp:163
static constexpr auto Descriptor_sort_by
ComponentDescriptor for the sort_by field.
Definition table_blueprint.hpp:97
TableBlueprint with_sort_by(const rerun::blueprint::components::SortBy &_sort_by) &&
The column and direction the table's rows are sorted by.
Definition table_blueprint.hpp:173
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition table_blueprint.hpp:198
std::optional< ComponentBatch > column_display_mode
Formatting for column names in table and card layouts.
Definition table_blueprint.hpp:45
std::optional< ComponentBatch > sort_by
The column and direction the table's rows are sorted by.
Definition table_blueprint.hpp:75
TableBlueprint with_column_display_mode(const rerun::blueprint::components::ColumnDisplayMode &_column_display_mode) &&
Formatting for column names in table and card layouts.
Definition table_blueprint.hpp:131
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition table_blueprint.hpp:186
static TableBlueprint clear_fields()
Clear all the fields of a TableBlueprint.
Component: The column and direction a table's rows are sorted by.
Definition sort_by.hpp:18