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