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