Rerun C++ SDK
Loading...
Searching...
No Matches
view_contents.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/view_contents.fbs".
3
4#pragma once
5
6#include "../../blueprint/components/query_expression.hpp"
7#include "../../collection.hpp"
8#include "../../component_batch.hpp"
9#include "../../component_column.hpp"
10#include "../../indicator_component.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**: The contents of a `View`.
20 ///
21 /// The contents are found by combining a collection of `QueryExpression`s.
22 ///
23 /// ```diff
24 /// + /world/** # add everything…
25 /// - /world/roads/** # …but remove all roads…
26 /// + /world/roads/main # …but show main road
27 /// ```
28 ///
29 /// If there is multiple matching rules, the most specific rule wins.
30 /// If there are multiple rules of the same specificity, the last one wins.
31 /// If no rules match, the path is excluded.
32 ///
33 /// Specifying a path without a `+` or `-` prefix is equivalent to `+`:
34 /// ```diff
35 /// /world/** # add everything…
36 /// - /world/roads/** # …but remove all roads…
37 /// /world/roads/main # …but show main road
38 /// ```
39 ///
40 /// The `/**` suffix matches the whole subtree, i.e. self and any child, recursively
41 /// (`/world/**` matches both `/world` and `/world/car/driver`).
42 /// Other uses of `*` are not (yet) supported.
43 ///
44 /// Internally, `EntityPathFilter` sorts the rule by entity path, with recursive coming before non-recursive.
45 /// This means the last matching rule is also the most specific one. For instance:
46 /// ```diff
47 /// + /world/**
48 /// - /world
49 /// - /world/car/**
50 /// + /world/car/driver
51 /// ```
52 ///
53 /// The last rule matching `/world/car/driver` is `+ /world/car/driver`, so it is included.
54 /// The last rule matching `/world/car/hood` is `- /world/car/**`, so it is excluded.
55 /// The last rule matching `/world` is `- /world`, so it is excluded.
56 /// The last rule matching `/world/house` is `+ /world/**`, so it is included.
57 struct ViewContents {
58 /// The `QueryExpression` that populates the contents for the view.
59 ///
60 /// They determine which entities are part of the view.
61 std::optional<ComponentBatch> query;
62
63 public:
64 static constexpr const char IndicatorComponentName[] =
65 "rerun.blueprint.components.ViewContentsIndicator";
66
67 /// Indicator component, used to identify the archetype when converting to a list of components.
69 /// The name of the archetype as used in `ComponentDescriptor`s.
70 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.ViewContents";
71
72 /// `ComponentDescriptor` for the `query` field.
73 static constexpr auto Descriptor_query = ComponentDescriptor(
74 ArchetypeName, "query",
76 );
77
78 public:
79 ViewContents() = default;
80 ViewContents(ViewContents&& other) = default;
81 ViewContents(const ViewContents& other) = default;
82 ViewContents& operator=(const ViewContents& other) = default;
83 ViewContents& operator=(ViewContents&& other) = default;
84
86 : query(ComponentBatch::from_loggable(std::move(_query), Descriptor_query)
87 .value_or_throw()) {}
88
89 /// Update only some specific fields of a `ViewContents`.
91 return ViewContents();
92 }
93
94 /// Clear all the fields of a `ViewContents`.
96
97 /// The `QueryExpression` that populates the contents for the view.
98 ///
99 /// They determine which entities are part of the view.
102 ) && {
103 query = ComponentBatch::from_loggable(_query, Descriptor_query).value_or_throw();
104 return std::move(*this);
105 }
106
107 /// Partitions the component data into multiple sub-batches.
108 ///
109 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
110 /// instead, via `ComponentBatch::partitioned`.
111 ///
112 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
113 ///
114 /// The specified `lengths` must sum to the total length of the component batch.
116
117 /// Partitions the component data into unit-length sub-batches.
118 ///
119 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
120 /// where `n` is automatically guessed.
122 };
123
124} // namespace rerun::blueprint::archetypes
125
126namespace rerun {
127 /// \private
128 template <typename T>
129 struct AsComponents;
130
131 /// \private
132 template <>
133 struct AsComponents<blueprint::archetypes::ViewContents> {
134 /// Serialize all set component batches.
135 static Result<Collection<ComponentBatch>> as_batches(
137 );
138 };
139} // 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: The contents of a View.
Definition view_contents.hpp:57
std::optional< ComponentBatch > query
The QueryExpression that populates the contents for the view.
Definition view_contents.hpp:61
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
ViewContents with_query(const Collection< rerun::blueprint::components::QueryExpression > &_query) &&
The QueryExpression that populates the contents for the view.
Definition view_contents.hpp:100
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition view_contents.hpp:70
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
static ViewContents update_fields()
Update only some specific fields of a ViewContents.
Definition view_contents.hpp:90
static constexpr auto Descriptor_query
ComponentDescriptor for the query field.
Definition view_contents.hpp:73
static ViewContents clear_fields()
Clear all the fields of a ViewContents.
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32