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 "../../indicator_component.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**: Configuration for the background of a view.
21 ///
22 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
23 ///
24 struct Background {
25 /// The type of the background.
26 std::optional<ComponentBatch> kind;
27
28 /// Color used for the solid background type.
29 std::optional<ComponentBatch> color;
30
31 public:
32 static constexpr const char IndicatorComponentName[] =
33 "rerun.blueprint.components.BackgroundIndicator";
34
35 /// Indicator component, used to identify the archetype when converting to a list of components.
37 /// The name of the archetype as used in `ComponentDescriptor`s.
38 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.Background";
39
40 /// `ComponentDescriptor` for the `kind` field.
41 static constexpr auto Descriptor_kind = ComponentDescriptor(
42 ArchetypeName, "kind",
44 );
45 /// `ComponentDescriptor` for the `color` field.
46 static constexpr auto Descriptor_color = ComponentDescriptor(
48 );
49
50 public:
51 Background() = default;
52 Background(Background&& other) = default;
53 Background(const Background& other) = default;
54 Background& operator=(const Background& other) = default;
55 Background& operator=(Background&& other) = default;
56
57 explicit Background(rerun::blueprint::components::BackgroundKind _kind)
58 : kind(ComponentBatch::from_loggable(std::move(_kind), Descriptor_kind).value_or_throw()
59 ) {}
60
61 /// Update only some specific fields of a `Background`.
63 return Background();
64 }
65
66 /// Clear all the fields of a `Background`.
68
69 /// The type of the background.
70 Background with_kind(const rerun::blueprint::components::BackgroundKind& _kind) && {
71 kind = ComponentBatch::from_loggable(_kind, Descriptor_kind).value_or_throw();
72 return std::move(*this);
73 }
74
75 /// Color used for the solid background type.
77 color = ComponentBatch::from_loggable(_color, Descriptor_color).value_or_throw();
78 return std::move(*this);
79 }
80
81 /// Partitions the component data into multiple sub-batches.
82 ///
83 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
84 /// instead, via `ComponentBatch::partitioned`.
85 ///
86 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
87 ///
88 /// The specified `lengths` must sum to the total length of the component batch.
90
91 /// Partitions the component data into unit-length sub-batches.
92 ///
93 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
94 /// where `n` is automatically guessed.
96 };
97
98} // namespace rerun::blueprint::archetypes
99
100namespace rerun {
101 /// \private
102 template <typename T>
103 struct AsComponents;
104
105 /// \private
106 template <>
107 struct AsComponents<blueprint::archetypes::Background> {
108 /// Serialize all set component batches.
109 static Result<Collection<ComponentBatch>> as_batches(
110 const blueprint::archetypes::Background& archetype
111 );
112 };
113} // 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=rerun::Loggable< T >::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:14
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:24
Background with_kind(const rerun::blueprint::components::BackgroundKind &_kind) &&
The type of the background.
Definition background.hpp:70
Background with_color(const rerun::components::Color &_color) &&
Color used for the solid background type.
Definition background.hpp:76
static constexpr auto Descriptor_color
ComponentDescriptor for the color field.
Definition background.hpp:46
static Background clear_fields()
Clear all the fields of a Background.
static constexpr auto Descriptor_kind
ComponentDescriptor for the kind field.
Definition background.hpp:41
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:26
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:62
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition background.hpp:38
std::optional< ComponentBatch > color
Color used for the solid background type.
Definition background.hpp:29
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:18
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32