Rerun C++ SDK
Loading...
Searching...
No Matches
tensor_slice_selection.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/tensor_slice_selection.fbs".
3
4#pragma once
5
6#include "../../blueprint/components/tensor_dimension_index_slider.hpp"
7#include "../../collection.hpp"
8#include "../../component_batch.hpp"
9#include "../../component_column.hpp"
10#include "../../components/tensor_dimension_index_selection.hpp"
11#include "../../components/tensor_height_dimension.hpp"
12#include "../../components/tensor_width_dimension.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**: Specifies a 2D slice of a tensor.
22 ///
23 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
24 ///
26 /// Which dimension to map to width.
27 ///
28 /// If not specified, the height will be determined automatically based on the name and index of the dimension.
29 std::optional<ComponentBatch> width;
30
31 /// Which dimension to map to height.
32 ///
33 /// If not specified, the height will be determined automatically based on the name and index of the dimension.
34 std::optional<ComponentBatch> height;
35
36 /// Selected indices for all other dimensions.
37 ///
38 /// If any of the here listed dimensions is equal to `width` or `height`, it will be ignored.
39 std::optional<ComponentBatch> indices;
40
41 /// Any dimension listed here will have a slider for the index.
42 ///
43 /// Edits to the sliders will directly manipulate dimensions on the `indices` list.
44 /// If any of the here listed dimensions is equal to `width` or `height`, it will be ignored.
45 /// If not specified, adds slides for any dimension in `indices`.
46 std::optional<ComponentBatch> slider;
47
48 public:
49 /// The name of the archetype as used in `ComponentDescriptor`s.
50 static constexpr const char ArchetypeName[] =
51 "rerun.blueprint.archetypes.TensorSliceSelection";
52
53 /// `ComponentDescriptor` for the `width` field.
54 static constexpr auto Descriptor_width = ComponentDescriptor(
55 ArchetypeName, "TensorSliceSelection:width",
57 );
58 /// `ComponentDescriptor` for the `height` field.
59 static constexpr auto Descriptor_height = ComponentDescriptor(
60 ArchetypeName, "TensorSliceSelection:height",
62 );
63 /// `ComponentDescriptor` for the `indices` field.
64 static constexpr auto Descriptor_indices = ComponentDescriptor(
65 ArchetypeName, "TensorSliceSelection:indices",
67 );
68 /// `ComponentDescriptor` for the `slider` field.
69 static constexpr auto Descriptor_slider = ComponentDescriptor(
70 ArchetypeName, "TensorSliceSelection:slider",
72 );
73
74 public:
75 TensorSliceSelection() = default;
77 TensorSliceSelection(const TensorSliceSelection& other) = default;
78 TensorSliceSelection& operator=(const TensorSliceSelection& other) = default;
79 TensorSliceSelection& operator=(TensorSliceSelection&& other) = default;
80
81 /// Update only some specific fields of a `TensorSliceSelection`.
83 return TensorSliceSelection();
84 }
85
86 /// Clear all the fields of a `TensorSliceSelection`.
88
89 /// Which dimension to map to width.
90 ///
91 /// If not specified, the height will be determined automatically based on the name and index of the dimension.
93 width = ComponentBatch::from_loggable(_width, Descriptor_width).value_or_throw();
94 return std::move(*this);
95 }
96
97 /// Which dimension to map to height.
98 ///
99 /// If not specified, the height will be determined automatically based on the name and index of the dimension.
101 ) && {
102 height = ComponentBatch::from_loggable(_height, Descriptor_height).value_or_throw();
103 return std::move(*this);
104 }
105
106 /// Selected indices for all other dimensions.
107 ///
108 /// If any of the here listed dimensions is equal to `width` or `height`, it will be ignored.
111 ) && {
112 indices = ComponentBatch::from_loggable(_indices, Descriptor_indices).value_or_throw();
113 return std::move(*this);
114 }
115
116 /// Any dimension listed here will have a slider for the index.
117 ///
118 /// Edits to the sliders will directly manipulate dimensions on the `indices` list.
119 /// If any of the here listed dimensions is equal to `width` or `height`, it will be ignored.
120 /// If not specified, adds slides for any dimension in `indices`.
123 ) && {
124 slider = ComponentBatch::from_loggable(_slider, Descriptor_slider).value_or_throw();
125 return std::move(*this);
126 }
127
128 /// Partitions the component data into multiple sub-batches.
129 ///
130 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
131 /// instead, via `ComponentBatch::partitioned`.
132 ///
133 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
134 ///
135 /// The specified `lengths` must sum to the total length of the component batch.
137
138 /// Partitions the component data into unit-length sub-batches.
139 ///
140 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
141 /// where `n` is automatically guessed.
143 };
144
145} // namespace rerun::blueprint::archetypes
146
147namespace rerun {
148 /// \private
149 template <typename T>
150 struct AsComponents;
151
152 /// \private
153 template <>
154 struct AsComponents<blueprint::archetypes::TensorSliceSelection> {
155 /// Serialize all set component batches.
156 static Result<Collection<ComponentBatch>> as_batches(
158 );
159 };
160} // 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
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: Specifies a 2D slice of a tensor.
Definition tensor_slice_selection.hpp:25
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition tensor_slice_selection.hpp:50
std::optional< ComponentBatch > width
Which dimension to map to width.
Definition tensor_slice_selection.hpp:29
std::optional< ComponentBatch > indices
Selected indices for all other dimensions.
Definition tensor_slice_selection.hpp:39
static constexpr auto Descriptor_slider
ComponentDescriptor for the slider field.
Definition tensor_slice_selection.hpp:69
TensorSliceSelection with_height(const rerun::components::TensorHeightDimension &_height) &&
Which dimension to map to height.
Definition tensor_slice_selection.hpp:100
static constexpr auto Descriptor_indices
ComponentDescriptor for the indices field.
Definition tensor_slice_selection.hpp:64
TensorSliceSelection with_width(const rerun::components::TensorWidthDimension &_width) &&
Which dimension to map to width.
Definition tensor_slice_selection.hpp:92
TensorSliceSelection with_slider(const Collection< rerun::blueprint::components::TensorDimensionIndexSlider > &_slider) &&
Any dimension listed here will have a slider for the index.
Definition tensor_slice_selection.hpp:121
static constexpr auto Descriptor_width
ComponentDescriptor for the width field.
Definition tensor_slice_selection.hpp:54
TensorSliceSelection with_indices(const Collection< rerun::components::TensorDimensionIndexSelection > &_indices) &&
Selected indices for all other dimensions.
Definition tensor_slice_selection.hpp:109
static TensorSliceSelection update_fields()
Update only some specific fields of a TensorSliceSelection.
Definition tensor_slice_selection.hpp:82
static constexpr auto Descriptor_height
ComponentDescriptor for the height field.
Definition tensor_slice_selection.hpp:59
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
static TensorSliceSelection clear_fields()
Clear all the fields of a TensorSliceSelection.
std::optional< ComponentBatch > height
Which dimension to map to height.
Definition tensor_slice_selection.hpp:34
std::optional< ComponentBatch > slider
Any dimension listed here will have a slider for the index.
Definition tensor_slice_selection.hpp:46
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Component: Specifies which dimension to use for height.
Definition tensor_height_dimension.hpp:14
Component: Specifies which dimension to use for width.
Definition tensor_width_dimension.hpp:14