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