Rerun C++ SDK
Loading...
Searching...
No Matches
entity_behavior.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/entity_behavior.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../collection.hpp"
8#include "../../component_batch.hpp"
9#include "../../component_column.hpp"
10#include "../../components/interactive.hpp"
11#include "../../components/visible.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**: General visualization behavior of an entity.
21 ///
22 /// Its fields currently only have an effect when sent as part of a blueprint (e.g. as a view override), not when logged together with the data.
23 /// See <https://github.com/rerun-io/rerun/issues/6541>.
25 /// Whether the entity can be interacted with.
26 ///
27 /// This property is propagated down the entity hierarchy until another child entity
28 /// sets `interactive` to a different value at which point propagation continues with that value instead.
29 ///
30 /// Defaults to parent's `interactive` value or true if there is no parent.
31 std::optional<ComponentBatch> interactive;
32
33 /// Whether the entity is visible.
34 ///
35 /// This property is propagated down the entity hierarchy until another child entity
36 /// sets `visible` to a different value at which point propagation continues with that value instead.
37 ///
38 /// Defaults to parent's `visible` value or true if there is no parent.
39 std::optional<ComponentBatch> visible;
40
41 public:
42 /// The name of the archetype as used in `ComponentDescriptor`s.
43 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.EntityBehavior";
44
45 /// `ComponentDescriptor` for the `interactive` field.
47 ArchetypeName, "EntityBehavior:interactive",
49 );
50 /// `ComponentDescriptor` for the `visible` field.
51 static constexpr auto Descriptor_visible = ComponentDescriptor(
52 ArchetypeName, "EntityBehavior:visible",
54 );
55
56 public:
57 EntityBehavior() = default;
58 EntityBehavior(EntityBehavior&& other) = default;
59 EntityBehavior(const EntityBehavior& other) = default;
60 EntityBehavior& operator=(const EntityBehavior& other) = default;
61 EntityBehavior& operator=(EntityBehavior&& other) = default;
62
63 /// Update only some specific fields of a `EntityBehavior`.
65 return EntityBehavior();
66 }
67
68 /// Clear all the fields of a `EntityBehavior`.
70
71 /// Whether the entity can be interacted with.
72 ///
73 /// This property is propagated down the entity hierarchy until another child entity
74 /// sets `interactive` to a different value at which point propagation continues with that value instead.
75 ///
76 /// Defaults to parent's `interactive` value or true if there is no parent.
79 .value_or_throw();
80 return std::move(*this);
81 }
82
83 /// Whether the entity is visible.
84 ///
85 /// This property is propagated down the entity hierarchy until another child entity
86 /// sets `visible` to a different value at which point propagation continues with that value instead.
87 ///
88 /// Defaults to parent's `visible` value or true if there is no parent.
90 visible = ComponentBatch::from_loggable(_visible, Descriptor_visible).value_or_throw();
91 return std::move(*this);
92 }
93
94 /// Partitions the component data into multiple sub-batches.
95 ///
96 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
97 /// instead, via `ComponentBatch::partitioned`.
98 ///
99 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
100 ///
101 /// The specified `lengths` must sum to the total length of the component batch.
103 return detail::partition_batches({&interactive, &visible}, lengths_).value_or_throw();
104 }
105
106 /// Partitions the component data into unit-length sub-batches.
107 ///
108 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
109 /// where `n` is automatically guessed.
111 return detail::partition_batches_of_unit_length({&interactive, &visible})
112 .value_or_throw();
113 }
114 };
115
116} // namespace rerun::blueprint::archetypes
117
118namespace rerun {
119 /// \private
120 template <typename T>
121 struct AsComponents;
122
123 /// \private
124 template <>
125 struct AsComponents<blueprint::archetypes::EntityBehavior> {
126 /// Serialize all set component batches.
127 static Result<Collection<ComponentBatch>> as_batches(
129 ) {
130 return detail::collect_batches({&archetype.interactive, &archetype.visible});
131 }
132 };
133} // 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
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: General visualization behavior of an entity.
Definition entity_behavior.hpp:24
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition entity_behavior.hpp:43
EntityBehavior with_visible(const rerun::components::Visible &_visible) &&
Whether the entity is visible.
Definition entity_behavior.hpp:89
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition entity_behavior.hpp:110
std::optional< ComponentBatch > interactive
Whether the entity can be interacted with.
Definition entity_behavior.hpp:31
static EntityBehavior update_fields()
Update only some specific fields of a EntityBehavior.
Definition entity_behavior.hpp:64
EntityBehavior with_interactive(const rerun::components::Interactive &_interactive) &&
Whether the entity can be interacted with.
Definition entity_behavior.hpp:77
static EntityBehavior clear_fields()
Clear all the fields of a EntityBehavior.
static constexpr auto Descriptor_interactive
ComponentDescriptor for the interactive field.
Definition entity_behavior.hpp:46
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition entity_behavior.hpp:102
std::optional< ComponentBatch > visible
Whether the entity is visible.
Definition entity_behavior.hpp:39
static constexpr auto Descriptor_visible
ComponentDescriptor for the visible field.
Definition entity_behavior.hpp:51
Component: Whether the entity can be interacted with.
Definition interactive.hpp:16
Component: Whether the container, view, entity or instance is currently visible.
Definition visible.hpp:14