Rerun C++ SDK
Loading...
Searching...
No Matches
table_column.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_column.def.rs".
3
4#pragma once
5
6#include "../../blueprint/components/column_type.hpp"
7#include "../../blueprint/components/editable.hpp"
8#include "../../collection.hpp"
9#include "../../component_batch.hpp"
10#include "../../component_column.hpp"
11#include "../../components/name.hpp"
12#include "../../components/visible.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 a column used by a table or card layout.
22 ///
23 /// This archetype is stored at the layout-specific path for its source column.
24 /// The source is the final `components::ColumnName` part of that path.
25 ///
26 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
27 ///
28 struct TableColumn {
29 /// The name shown for the column.
30 ///
31 /// If unset, the name is inferred from the source column.
32 std::optional<ComponentBatch> name;
33
34 /// Whether the column's values can be edited.
35 ///
36 /// If unset, editing is disabled.
37 /// Edits require a remote table with a column marked by `rerun:is_table_index` metadata and write permission.
38 /// A column can only be edited when its component type has an editor in the Viewer.
39 std::optional<ComponentBatch> editable;
40
41 /// Whether the column is visible in this layout.
42 ///
43 /// If unset, the enclosing layout determines visibility.
44 /// Columns listed in the enclosing layout's `column_order` or `field_order` are shown.
45 /// Unlisted columns use the viewer default for table layouts and are hidden in card layouts.
46 std::optional<ComponentBatch> visible;
47
48 /// Overrides the component the column's values are shown as.
49 ///
50 /// This picks the component UI for every value of the column.
51 /// The column's Arrow datatype must match the datatype of the component type.
52 /// If unset, the component of the source column is used, or the Viewer infers one from the column's datatype.
53 std::optional<ComponentBatch> column_type;
54
55 public:
56 /// The name of the archetype as used in `ComponentDescriptor`s.
57 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.TableColumn";
58
59 /// `ComponentDescriptor` for the `name` field.
60 static constexpr auto Descriptor_name = ComponentDescriptor(
62 );
63 /// `ComponentDescriptor` for the `editable` field.
65 ArchetypeName, "TableColumn:editable",
67 );
68 /// `ComponentDescriptor` for the `visible` field.
69 static constexpr auto Descriptor_visible = ComponentDescriptor(
70 ArchetypeName, "TableColumn:visible",
72 );
73 /// `ComponentDescriptor` for the `column_type` field.
75 ArchetypeName, "TableColumn:column_type",
77 );
78
79 public:
80 TableColumn() = default;
81 TableColumn(TableColumn&& other) = default;
82 TableColumn(const TableColumn& other) = default;
83 TableColumn& operator=(const TableColumn& other) = default;
84 TableColumn& operator=(TableColumn&& other) = default;
85
86 /// Update only some specific fields of a `TableColumn`.
88 return TableColumn();
89 }
90
91 /// Clear all the fields of a `TableColumn`.
93
94 /// The name shown for the column.
95 ///
96 /// If unset, the name is inferred from the source column.
98 name = ComponentBatch::from_loggable(_name, Descriptor_name).value_or_throw();
99 return std::move(*this);
100 }
101
102 /// Whether the column's values can be edited.
103 ///
104 /// If unset, editing is disabled.
105 /// Edits require a remote table with a column marked by `rerun:is_table_index` metadata and write permission.
106 /// A column can only be edited when its component type has an editor in the Viewer.
108 editable =
109 ComponentBatch::from_loggable(_editable, Descriptor_editable).value_or_throw();
110 return std::move(*this);
111 }
112
113 /// Whether the column is visible in this layout.
114 ///
115 /// If unset, the enclosing layout determines visibility.
116 /// Columns listed in the enclosing layout's `column_order` or `field_order` are shown.
117 /// Unlisted columns use the viewer default for table layouts and are hidden in card layouts.
119 visible = ComponentBatch::from_loggable(_visible, Descriptor_visible).value_or_throw();
120 return std::move(*this);
121 }
122
123 /// Overrides the component the column's values are shown as.
124 ///
125 /// This picks the component UI for every value of the column.
126 /// The column's Arrow datatype must match the datatype of the component type.
127 /// If unset, the component of the source column is used, or the Viewer infers one from the column's datatype.
129 ) && {
131 .value_or_throw();
132 return std::move(*this);
133 }
134
135 /// Partitions the component data into multiple sub-batches.
136 ///
137 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
138 /// instead, via `ComponentBatch::partitioned`.
139 ///
140 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
141 ///
142 /// The specified `lengths` must sum to the total length of the component batch.
144
145 /// Partitions the component data into unit-length sub-batches.
146 ///
147 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
148 /// where `n` is automatically guessed.
150 };
151
152} // namespace rerun::blueprint::archetypes
153
154namespace rerun {
155 /// \private
156 template <typename T>
157 struct AsComponents;
158
159 /// \private
160 template <>
161 struct AsComponents<blueprint::archetypes::TableColumn> {
162 /// Serialize all set component batches.
163 static Result<Collection<ComponentBatch>> as_batches(
165 );
166 };
167} // 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 a column used by a table or card layout.
Definition table_column.hpp:28
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
std::optional< ComponentBatch > visible
Whether the column is visible in this layout.
Definition table_column.hpp:46
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition table_column.hpp:57
TableColumn with_visible(const rerun::components::Visible &_visible) &&
Whether the column is visible in this layout.
Definition table_column.hpp:118
static TableColumn clear_fields()
Clear all the fields of a TableColumn.
std::optional< ComponentBatch > editable
Whether the column's values can be edited.
Definition table_column.hpp:39
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
std::optional< ComponentBatch > column_type
Overrides the component the column's values are shown as.
Definition table_column.hpp:53
static constexpr auto Descriptor_column_type
ComponentDescriptor for the column_type field.
Definition table_column.hpp:74
static constexpr auto Descriptor_editable
ComponentDescriptor for the editable field.
Definition table_column.hpp:64
TableColumn with_editable(const rerun::blueprint::components::Editable &_editable) &&
Whether the column's values can be edited.
Definition table_column.hpp:107
static TableColumn update_fields()
Update only some specific fields of a TableColumn.
Definition table_column.hpp:87
std::optional< ComponentBatch > name
The name shown for the column.
Definition table_column.hpp:32
TableColumn with_name(const rerun::components::Name &_name) &&
The name shown for the column.
Definition table_column.hpp:97
static constexpr auto Descriptor_name
ComponentDescriptor for the name field.
Definition table_column.hpp:60
TableColumn with_column_type(const rerun::blueprint::components::ColumnType &_column_type) &&
Overrides the component the column's values are shown as.
Definition table_column.hpp:128
static constexpr auto Descriptor_visible
ComponentDescriptor for the visible field.
Definition table_column.hpp:69
Component: Overrides the component a table column's values are shown as.
Definition column_type.hpp:18
Component: Whether a table column's values can be edited.
Definition editable.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