Rerun C++ SDK
Loading...
Searching...
No Matches
background.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/background.fbs".
3
4#pragma once
5
6#include "../../blueprint/components/background_kind.hpp"
7#include "../../collection.hpp"
8#include "../../component_batch.hpp"
9#include "../../component_column.hpp"
10#include "../../components/color.hpp"
11#include "../../result.hpp"
12
13#include <cstdint>
14#include <optional>
15#include <utility>
16#include <vector>
17
18namespace rerun::blueprint::archetypes {
19 /// **Archetype**: Configuration for the background of a view.
20 ///
21 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
22 ///
23 struct Background {
24 /// The type of the background.
25 std::optional<ComponentBatch> kind;
26
27 /// Color used for the solid background type.
28 std::optional<ComponentBatch> color;
29
30 public:
31 /// The name of the archetype as used in `ComponentDescriptor`s.
32 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.Background";
33
34 /// `ComponentDescriptor` for the `kind` field.
35 static constexpr auto Descriptor_kind = ComponentDescriptor(
36 ArchetypeName, "Background:kind",
38 );
39 /// `ComponentDescriptor` for the `color` field.
40 static constexpr auto Descriptor_color = ComponentDescriptor(
42 );
43
44 public:
45 Background() = default;
46 Background(Background&& other) = default;
47 Background(const Background& other) = default;
48 Background& operator=(const Background& other) = default;
49 Background& operator=(Background&& other) = default;
50
51 explicit Background(rerun::blueprint::components::BackgroundKind _kind)
52 : kind(ComponentBatch::from_loggable(std::move(_kind), Descriptor_kind).value_or_throw()
53 ) {}
54
55 /// Update only some specific fields of a `Background`.
57 return Background();
58 }
59
60 /// Clear all the fields of a `Background`.
62
63 /// The type of the background.
64 Background with_kind(const rerun::blueprint::components::BackgroundKind& _kind) && {
65 kind = ComponentBatch::from_loggable(_kind, Descriptor_kind).value_or_throw();
66 return std::move(*this);
67 }
68
69 /// Color used for the solid background type.
71 color = ComponentBatch::from_loggable(_color, Descriptor_color).value_or_throw();
72 return std::move(*this);
73 }
74
75 /// Partitions the component data into multiple sub-batches.
76 ///
77 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
78 /// instead, via `ComponentBatch::partitioned`.
79 ///
80 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
81 ///
82 /// The specified `lengths` must sum to the total length of the component batch.
84
85 /// Partitions the component data into unit-length sub-batches.
86 ///
87 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
88 /// where `n` is automatically guessed.
90 };
91
92} // namespace rerun::blueprint::archetypes
93
94namespace rerun {
95 /// \private
96 template <typename T>
97 struct AsComponents;
98
99 /// \private
100 template <>
101 struct AsComponents<blueprint::archetypes::Background> {
102 /// Serialize all set component batches.
103 static Result<Collection<ComponentBatch>> as_batches(
104 const blueprint::archetypes::Background& archetype
105 );
106 };
107} // 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
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: Configuration for the background of a view.
Definition background.hpp:23
Background with_kind(const rerun::blueprint::components::BackgroundKind &_kind) &&
The type of the background.
Definition background.hpp:64
Background with_color(const rerun::components::Color &_color) &&
Color used for the solid background type.
Definition background.hpp:70
static constexpr auto Descriptor_color
ComponentDescriptor for the color field.
Definition background.hpp:40
static Background clear_fields()
Clear all the fields of a Background.
static constexpr auto Descriptor_kind
ComponentDescriptor for the kind field.
Definition background.hpp:35
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
std::optional< ComponentBatch > kind
The type of the background.
Definition background.hpp:25
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
static Background update_fields()
Update only some specific fields of a Background.
Definition background.hpp:56
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition background.hpp:32
std::optional< ComponentBatch > color
Color used for the solid background type.
Definition background.hpp:28
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:17