Rerun C++ SDK
Loading...
Searching...
No Matches
visualizer_instruction.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/visualizer_instruction.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/visualizer_component_mapping.hpp"
8#include "../../blueprint/components/visualizer_type.hpp"
9#include "../../collection.hpp"
10#include "../../component_batch.hpp"
11#include "../../component_column.hpp"
12#include "../../result.hpp"
13
14#include <cstdint>
15#include <optional>
16#include <utility>
17#include <vector>
18
19namespace rerun::blueprint::archetypes {
20 /// **Archetype**: A visualizer instruction for an entity.
21 ///
22 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
23 ///
25 /// The type of the visualizer.
26 std::optional<ComponentBatch> visualizer_type;
27
28 /// The component mapping pairs.
29 std::optional<ComponentBatch> component_map;
30
31 public:
32 /// The name of the archetype as used in `ComponentDescriptor`s.
33 static constexpr const char ArchetypeName[] =
34 "rerun.blueprint.archetypes.VisualizerInstruction";
35
36 /// `ComponentDescriptor` for the `visualizer_type` field.
38 ArchetypeName, "VisualizerInstruction:visualizer_type",
40 );
41 /// `ComponentDescriptor` for the `component_map` field.
43 ArchetypeName, "VisualizerInstruction:component_map",
45 );
46
47 public:
48 VisualizerInstruction() = default;
50 VisualizerInstruction(const VisualizerInstruction& other) = default;
51 VisualizerInstruction& operator=(const VisualizerInstruction& other) = default;
52 VisualizerInstruction& operator=(VisualizerInstruction&& other) = default;
53
55 )
56 : visualizer_type(ComponentBatch::from_loggable(
57 std::move(_visualizer_type), Descriptor_visualizer_type
58 )
59 .value_or_throw()) {}
60
61 /// Update only some specific fields of a `VisualizerInstruction`.
63 return VisualizerInstruction();
64 }
65
66 /// Clear all the fields of a `VisualizerInstruction`.
68
69 /// The type of the visualizer.
72 ) && {
75 .value_or_throw();
76 return std::move(*this);
77 }
78
79 /// The component mapping pairs.
82 _component_map
83 ) && {
85 .value_or_throw();
86 return std::move(*this);
87 }
88
89 /// Partitions the component data into multiple sub-batches.
90 ///
91 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
92 /// instead, via `ComponentBatch::partitioned`.
93 ///
94 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
95 ///
96 /// The specified `lengths` must sum to the total length of the component batch.
98 return detail::partition_batches({&visualizer_type, &component_map}, lengths_)
99 .value_or_throw();
100 }
101
102 /// Partitions the component data into unit-length sub-batches.
103 ///
104 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
105 /// where `n` is automatically guessed.
107 return detail::partition_batches_of_unit_length({&visualizer_type, &component_map})
108 .value_or_throw();
109 }
110 };
111
112} // namespace rerun::blueprint::archetypes
113
114namespace rerun {
115 /// \private
116 template <typename T>
117 struct AsComponents;
118
119 /// \private
120 template <>
121 struct AsComponents<blueprint::archetypes::VisualizerInstruction> {
122 /// Serialize all set component batches.
123 static Result<Collection<ComponentBatch>> as_batches(
125 ) {
126 return detail::collect_batches({&archetype.visualizer_type, &archetype.component_map});
127 }
128 };
129} // 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: A visualizer instruction for an entity.
Definition visualizer_instruction.hpp:24
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition visualizer_instruction.hpp:33
std::optional< ComponentBatch > component_map
The component mapping pairs.
Definition visualizer_instruction.hpp:29
static constexpr auto Descriptor_visualizer_type
ComponentDescriptor for the visualizer_type field.
Definition visualizer_instruction.hpp:37
VisualizerInstruction with_component_map(const Collection< rerun::blueprint::components::VisualizerComponentMapping > &_component_map) &&
The component mapping pairs.
Definition visualizer_instruction.hpp:80
static VisualizerInstruction clear_fields()
Clear all the fields of a VisualizerInstruction.
VisualizerInstruction with_visualizer_type(const rerun::blueprint::components::VisualizerType &_visualizer_type) &&
The type of the visualizer.
Definition visualizer_instruction.hpp:70
static VisualizerInstruction update_fields()
Update only some specific fields of a VisualizerInstruction.
Definition visualizer_instruction.hpp:62
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition visualizer_instruction.hpp:97
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition visualizer_instruction.hpp:106
std::optional< ComponentBatch > visualizer_type
The type of the visualizer.
Definition visualizer_instruction.hpp:26
static constexpr auto Descriptor_component_map
ComponentDescriptor for the component_map field.
Definition visualizer_instruction.hpp:42
Component: The type of the visualizer.
Definition visualizer_type.hpp:19