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 ///
58 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
59 ///
60 struct ViewContents {
61 /// The `QueryExpression` that populates the contents for the view.
62 ///
63 /// They determine which entities are part of the view.
64 std::optional<ComponentBatch> query;
65
66 public:
67 static constexpr const char IndicatorComponentName[] =
68 "rerun.blueprint.components.ViewContentsIndicator";
69
70 /// Indicator component, used to identify the archetype when converting to a list of components.
72 /// The name of the archetype as used in `ComponentDescriptor`s.
73 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.ViewContents";
74
75 /// `ComponentDescriptor` for the `query` field.
76 static constexpr auto Descriptor_query = ComponentDescriptor(
77 ArchetypeName, "query",
79 );
80
81 public:
82 ViewContents() = default;
83 ViewContents(ViewContents&& other) = default;
84 ViewContents(const ViewContents& other) = default;
85 ViewContents& operator=(const ViewContents& other) = default;
86 ViewContents& operator=(ViewContents&& other) = default;
87
89 : query(ComponentBatch::from_loggable(std::move(_query), Descriptor_query)
90 .value_or_throw()) {}
91
92 /// Update only some specific fields of a `ViewContents`.
94 return ViewContents();
95 }
96
97 /// Clear all the fields of a `ViewContents`.
99
100 /// The `QueryExpression` that populates the contents for the view.
101 ///
102 /// They determine which entities are part of the view.
105 ) && {
106 query = ComponentBatch::from_loggable(_query, Descriptor_query).value_or_throw();
107 return std::move(*this);
108 }
109
110 /// Partitions the component data into multiple sub-batches.
111 ///
112 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
113 /// instead, via `ComponentBatch::partitioned`.
114 ///
115 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
116 ///
117 /// The specified `lengths` must sum to the total length of the component batch.
119
120 /// Partitions the component data into unit-length sub-batches.
121 ///
122 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
123 /// where `n` is automatically guessed.
125 };
126
127} // namespace rerun::blueprint::archetypes
128
129namespace rerun {
130 /// \private
131 template <typename T>
132 struct AsComponents;
133
134 /// \private
135 template <>
136 struct AsComponents<blueprint::archetypes::ViewContents> {
137 /// Serialize all set component batches.
138 static Result<Collection<ComponentBatch>> as_batches(
140 );
141 };
142} // 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:60
std::optional< ComponentBatch > query
The QueryExpression that populates the contents for the view.
Definition view_contents.hpp:64
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:103
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition view_contents.hpp:73
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:93
static constexpr auto Descriptor_query
ComponentDescriptor for the query field.
Definition view_contents.hpp:76
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