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 "../result.hpp"
11
12#include <cstdint>
13#include <utility>
14#include <vector>
15
16namespace rerun::archetypes {
17 /// **Archetype**: Empties all the components of an entity.
18 ///
19 /// ## Example
20 ///
21 /// ### Flat
22 /// ![image](https://static.rerun.io/clear_simple/2f5df95fcc53e9f0552f65670aef7f94830c5c1a/full.png)
23 ///
24 /// ```cpp
25 /// #include <rerun.hpp>
26 ///
27 /// #include <cmath>
28 /// #include <numeric>
29 /// #include <string> // to_string
30 /// #include <vector>
31 ///
32 /// int main() {
33 /// const auto rec = rerun::RecordingStream("rerun_example_clear_simple");
34 /// rec.spawn().exit_on_failure();
35 ///
36 /// std::vector<rerun::Vector3D> vectors = {
37 /// {1.0, 0.0, 0.0},
38 /// {0.0, -1.0, 0.0},
39 /// {-1.0, 0.0, 0.0},
40 /// {0.0, 1.0, 0.0},
41 /// };
42 /// std::vector<rerun::Position3D> origins = {
43 /// {-0.5, 0.5, 0.0},
44 /// {0.5, 0.5, 0.0},
45 /// {0.5, -0.5, 0.0},
46 /// {-0.5, -0.5, 0.0},
47 /// };
48 /// std::vector<rerun::Color> colors = {
49 /// {200, 0, 0},
50 /// {0, 200, 0},
51 /// {0, 0, 200},
52 /// {200, 0, 200},
53 /// };
54 ///
55 /// // Log a handful of arrows.
56 /// for (size_t i = 0; i <vectors.size(); ++i) {
57 /// auto entity_path = "arrows/" + std::to_string(i);
58 /// rec.log(
59 /// entity_path,
60 /// rerun::Arrows3D::from_vectors(vectors[i])
61 /// .with_origins(origins[i])
62 /// .with_colors(colors[i])
63 /// );
64 /// }
65 ///
66 /// // Now clear them, one by one on each tick.
67 /// for (size_t i = 0; i <vectors.size(); ++i) {
68 /// auto entity_path = "arrows/" + std::to_string(i);
69 /// rec.log(entity_path, rerun::Clear::FLAT);
70 /// }
71 /// }
72 /// ```
73 struct Clear {
75
76 public:
77 static constexpr const char IndicatorComponentName[] = "rerun.components.ClearIndicator";
78
79 /// Indicator component, used to identify the archetype when converting to a list of components.
81
82 public:
83 // Extensions to generated type defined in 'clear_ext.cpp'
84
85 static const Clear FLAT;
86
87 static const Clear RECURSIVE;
88
89 Clear(bool _is_recursive = false) : Clear(components::ClearIsRecursive(_is_recursive)) {}
90
91 public:
92 Clear() = default;
93 Clear(Clear&& other) = default;
94
95 explicit Clear(rerun::components::ClearIsRecursive _is_recursive)
96 : is_recursive(std::move(_is_recursive)) {}
97
98 /// Returns the number of primary instances of this archetype.
99 size_t num_instances() const {
100 return 1;
101 }
102 };
103
104} // namespace rerun::archetypes
105
106namespace rerun {
107 /// \private
108 template <typename T>
109 struct AsComponents;
110
111 /// \private
112 template <>
113 struct AsComponents<archetypes::Clear> {
114 /// Serialize all set component batches.
115 static Result<std::vector<DataCell>> serialize(const archetypes::Clear& archetype);
116 };
117} // namespace rerun
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:66
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:20
Archetype: Empties all the components of an entity.
Definition clear.hpp:73
size_t num_instances() const
Returns the number of primary instances of this archetype.
Definition clear.hpp:99
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