Rerun C++ SDK
Loading...
Searching...
No Matches
scalar.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/archetypes/scalar.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../component_batch.hpp"
8#include "../components/scalar.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**: A double-precision scalar, e.g. for use for time-series plots.
18 ///
19 /// The current timeline value will be used for the time/X-axis, hence scalars
20 /// cannot be static.
21 ///
22 /// When used to produce a plot, this archetype is used to provide the data that
23 /// is referenced by `archetypes::SeriesLine` or `archetypes::SeriesPoint`. You can do
24 /// this by logging both archetypes to the same path, or alternatively configuring
25 /// the plot-specific archetypes through the blueprint.
26 ///
27 /// ## Example
28 ///
29 /// ### Simple line plot
30 /// ![image](https://static.rerun.io/scalar_simple/8bcc92f56268739f8cd24d60d1fe72a655f62a46/full.png)
31 ///
32 /// ```cpp
33 /// #include <rerun.hpp>
34 ///
35 /// #include <cmath>
36 ///
37 /// int main() {
38 /// const auto rec = rerun::RecordingStream("rerun_example_scalar");
39 /// rec.spawn().exit_on_failure();
40 ///
41 /// // Log the data on a timeline called "step".
42 /// for (int step = 0; step <64; ++step) {
43 /// rec.set_time_sequence("step", step);
44 /// rec.log("scalar", rerun::Scalar(std::sin(static_cast<double>(step) / 10.0)));
45 /// }
46 /// }
47 /// ```
48 struct Scalar {
49 /// The scalar value to log.
51
52 public:
53 static constexpr const char IndicatorComponentName[] = "rerun.components.ScalarIndicator";
54
55 /// Indicator component, used to identify the archetype when converting to a list of components.
57
58 public:
59 Scalar() = default;
60 Scalar(Scalar&& other) = default;
61
62 explicit Scalar(rerun::components::Scalar _scalar) : scalar(std::move(_scalar)) {}
63 };
64
65} // namespace rerun::archetypes
66
67namespace rerun {
68 /// \private
69 template <typename T>
70 struct AsComponents;
71
72 /// \private
73 template <>
74 struct AsComponents<archetypes::Scalar> {
75 /// Serialize all set component batches.
76 static Result<std::vector<ComponentBatch>> serialize(const archetypes::Scalar& archetype);
77 };
78} // namespace rerun
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:77
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Archetype: A double-precision scalar, e.g.
Definition scalar.hpp:48
rerun::components::Scalar scalar
The scalar value to log.
Definition scalar.hpp:50
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32
Component: A scalar value, encoded as a 64-bit floating point.
Definition scalar.hpp:17