Rerun C++ SDK
Loading...
Searching...
No Matches
clear.hpp
1// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/re_types/definitions/rerun/archetypes/clear.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../components/clear_is_recursive.hpp"
8#include "../data_cell.hpp"
9#include "../indicator_component.hpp"
10#include "../rerun_sdk_export.hpp"
11#include "../result.hpp"
12
13#include <cstdint>
14#include <utility>
15#include <vector>
16
17namespace rerun::archetypes {
18 /// **Archetype**: Empties all the components of an entity.
19 ///
20 /// The presence of a clear means that a latest-at query of components at a given path(s)
21 /// will not return any components that were logged at those paths before the clear.
22 /// Any logged components after the clear are unaffected by the clear.
23 ///
24 /// This implies that a range query that includes time points that are before the clear,
25 /// still returns all components at the given path(s).
26 /// Meaning that in practice clears are ineffective when making use of visible time ranges.
27 /// Scalar plots are an exception: they track clears and use them to represent holes in the
28 /// data (i.e. discontinuous lines).
29 ///
30 /// ## Example
31 ///
32 /// ### Flat
33 /// ![image](https://static.rerun.io/clear_simple/2f5df95fcc53e9f0552f65670aef7f94830c5c1a/full.png)
34 ///
35 /// ```cpp
36 /// #include <rerun.hpp>
37 ///
38 /// #include <cmath>
39 /// #include <numeric>
40 /// #include <string> // to_string
41 /// #include <vector>
42 ///
43 /// int main() {
44 /// const auto rec = rerun::RecordingStream("rerun_example_clear");
45 /// rec.spawn().exit_on_failure();
46 ///
47 /// std::vector<rerun::Vector3D> vectors = {
48 /// {1.0, 0.0, 0.0},
49 /// {0.0, -1.0, 0.0},
50 /// {-1.0, 0.0, 0.0},
51 /// {0.0, 1.0, 0.0},
52 /// };
53 /// std::vector<rerun::Position3D> origins = {
54 /// {-0.5, 0.5, 0.0},
55 /// {0.5, 0.5, 0.0},
56 /// {0.5, -0.5, 0.0},
57 /// {-0.5, -0.5, 0.0},
58 /// };
59 /// std::vector<rerun::Color> colors = {
60 /// {200, 0, 0},
61 /// {0, 200, 0},
62 /// {0, 0, 200},
63 /// {200, 0, 200},
64 /// };
65 ///
66 /// // Log a handful of arrows.
67 /// for (size_t i = 0; i <vectors.size(); ++i) {
68 /// auto entity_path = "arrows/" + std::to_string(i);
69 /// rec.log(
70 /// entity_path,
71 /// rerun::Arrows3D::from_vectors(vectors[i])
72 /// .with_origins(origins[i])
73 /// .with_colors(colors[i])
74 /// );
75 /// }
76 ///
77 /// // Now clear them, one by one on each tick.
78 /// for (size_t i = 0; i <vectors.size(); ++i) {
79 /// auto entity_path = "arrows/" + std::to_string(i);
80 /// rec.log(entity_path, rerun::Clear::FLAT);
81 /// }
82 /// }
83 /// ```
84 struct Clear {
86
87 public:
88 static constexpr const char IndicatorComponentName[] = "rerun.components.ClearIndicator";
89
90 /// Indicator component, used to identify the archetype when converting to a list of components.
92
93 public:
94 // Extensions to generated type defined in 'clear_ext.cpp'
95
96 RERUN_SDK_EXPORT static const Clear FLAT;
97
98 RERUN_SDK_EXPORT static const Clear RECURSIVE;
99
100 Clear(bool _is_recursive = false) : Clear(components::ClearIsRecursive(_is_recursive)) {}
101
102 public:
103 Clear() = default;
104 Clear(Clear&& other) = default;
105
106 explicit Clear(rerun::components::ClearIsRecursive _is_recursive)
107 : is_recursive(std::move(_is_recursive)) {}
108 };
109
110} // namespace rerun::archetypes
111
112namespace rerun {
113 /// \private
114 template <typename T>
115 struct AsComponents;
116
117 /// \private
118 template <>
119 struct AsComponents<archetypes::Clear> {
120 /// Serialize all set component batches.
121 static Result<std::vector<DataCell>> serialize(const archetypes::Clear& archetype);
122 };
123} // namespace rerun
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:72
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:21
Archetype: Empties all the components of an entity.
Definition clear.hpp:84
Component: Configures how a clear operation should behave - recursive or not.
Definition clear_is_recursive.hpp:19
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:23