Rerun C++ SDK
Loading...
Searching...
No Matches
bar_chart.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/bar_chart.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../component_batch.hpp"
9#include "../components/color.hpp"
10#include "../components/tensor_data.hpp"
11#include "../indicator_component.hpp"
12#include "../result.hpp"
13
14#include <cstdint>
15#include <optional>
16#include <utility>
17#include <vector>
18
19namespace rerun::archetypes {
20 /// **Archetype**: A bar chart.
21 ///
22 /// The x values will be the indices of the array, and the bar heights will be the provided values.
23 ///
24 /// ## Example
25 ///
26 /// ### Simple bar chart
27 /// ![image](https://static.rerun.io/barchart_simple/cf6014b18265edfcaa562c06526c0716b296b193/full.png)
28 ///
29 /// ```cpp
30 /// #include <rerun.hpp>
31 ///
32 /// int main() {
33 /// const auto rec = rerun::RecordingStream("rerun_example_bar_chart");
34 /// rec.spawn().exit_on_failure();
35 ///
36 /// rec.log("bar_chart", rerun::BarChart::i64({8, 4, 0, 9, 1, 4, 1, 6, 9, 0}));
37 /// }
38 /// ```
39 struct BarChart {
40 /// The values. Should always be a 1-dimensional tensor (i.e. a vector).
42
43 /// The color of the bar chart
44 std::optional<rerun::components::Color> color;
45
46 public:
47 static constexpr const char IndicatorComponentName[] = "rerun.components.BarChartIndicator";
48
49 /// Indicator component, used to identify the archetype when converting to a list of components.
51
52 public: // START of extensions from bar_chart_ext.cpp:
54 auto num_elems = buffer.num_elems();
55 this->values = rerun::components::TensorData({num_elems}, std::move(buffer));
56 }
57
58 // --------------------------------------------------------------------
59 // Implicit constructors:
60
61 /// Construct a `BarChart` from a `Collection<uint8_t>`.
63 : BarChart(rerun::datatypes::TensorBuffer::u8(std::move(u8))) {}
64
65 /// Construct a `BarChart` from a `Collection<uint16_t>`.
67 : BarChart(rerun::datatypes::TensorBuffer::u16(std::move(u16))) {}
68
69 /// Construct a `BarChart` from a `Collection<uint32_t>`.
71 : BarChart(rerun::datatypes::TensorBuffer::u32(std::move(u32))) {}
72
73 /// Construct a `BarChart` from a `Collection<uint64_t>`.
75 : BarChart(rerun::datatypes::TensorBuffer::u64(std::move(u64))) {}
76
77 /// Construct a `BarChart` from a `Collection<int8_t>`.
79 : BarChart(rerun::datatypes::TensorBuffer::i8(std::move(i8))) {}
80
81 /// Construct a `BarChart` from a `Collection<int16_t>`.
83 : BarChart(rerun::datatypes::TensorBuffer::i16(std::move(i16))) {}
84
85 /// Construct a `BarChart` from a `Collection<int32_t>`.
87 : BarChart(rerun::datatypes::TensorBuffer::i32(std::move(i32))) {}
88
89 /// Construct a `BarChart` from a `Collection<int64_t>`.
91 : BarChart(rerun::datatypes::TensorBuffer::i64(std::move(i64))) {}
92
93 /// Construct aBarChart` from a `Collection<half>`.
95 : BarChart(rerun::datatypes::TensorBuffer::f16(std::move(f16))) {}
96
97 /// Construct a `BarChart` from a `Collection<float>`.
99 : BarChart(rerun::datatypes::TensorBuffer::f32(std::move(f32))) {}
100
101 /// Construct a `BarChart` from a `Collection<double>`.
103 : BarChart(rerun::datatypes::TensorBuffer::f64(std::move(f64))) {}
104
105 // --------------------------------------------------------------------
106 // Explicit static constructors:
107
108 /// Construct a `BarChart` from a `Collection<uint8_t>`.
110 return BarChart(std::move(u8));
111 }
112
113 /// Construct a `BarChart` from a `Collection<uint16_t>`.
115 return BarChart(std::move(u16));
116 }
117
118 /// Construct a `BarChart` from a `Collection<uint32_t>`.
120 return BarChart(std::move(u32));
121 }
122
123 /// Construct a `BarChart` from a `Collection<uint64_t>`.
125 return BarChart(std::move(u64));
126 }
127
128 /// Construct a `BarChart` from a `Collection<int8_t>`.
130 return BarChart(std::move(i8));
131 }
132
133 /// Construct a `BarChart` from a `Collection<int16_t>`.
135 return BarChart(std::move(i16));
136 }
137
138 /// Construct a `BarChart` from a `Collection<int32_t>`.
140 return BarChart(std::move(i32));
141 }
142
143 /// Construct a `BarChart` from a `Collection<int64_t>`.
145 return BarChart(std::move(i64));
146 }
147
148 /// Construct a `BarChart` from a `Collection<half>`.
150 return BarChart(std::move(f16));
151 }
152
153 /// Construct a `BarChart` from a `Collection<float>`.
155 return BarChart(std::move(f32));
156 }
157
158 /// Construct a `BarChart` from a `Collection<double>`.
160 return BarChart(std::move(f64));
161 }
162
163 // END of extensions from bar_chart_ext.cpp, start of generated code:
164
165 public:
166 BarChart() = default;
167 BarChart(BarChart&& other) = default;
168
169 explicit BarChart(rerun::components::TensorData _values) : values(std::move(_values)) {}
170
171 /// The color of the bar chart
173 color = std::move(_color);
174 // See: https://github.com/rerun-io/rerun/issues/4027
175 RR_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
176 }
177 };
178
179} // namespace rerun::archetypes
180
181namespace rerun {
182 /// \private
183 template <typename T>
184 struct AsComponents;
185
186 /// \private
187 template <>
188 struct AsComponents<archetypes::BarChart> {
189 /// Serialize all set component batches.
190 static Result<std::vector<ComponentBatch>> serialize(const archetypes::BarChart& archetype);
191 };
192} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:76
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
Archetype: A bar chart.
Definition bar_chart.hpp:39
BarChart(Collection< double > f64)
Construct a BarChart from a Collection<double>.
Definition bar_chart.hpp:102
BarChart(Collection< int64_t > i64)
Construct a BarChart from a Collection<int64_t>.
Definition bar_chart.hpp:90
rerun::components::TensorData values
The values. Should always be a 1-dimensional tensor (i.e. a vector).
Definition bar_chart.hpp:41
static BarChart u32(Collection< uint32_t > u32)
Construct a BarChart from a Collection<uint32_t>.
Definition bar_chart.hpp:119
static BarChart f16(Collection< rerun::half > f16)
Construct a BarChart from a Collection<half>.
Definition bar_chart.hpp:149
BarChart(Collection< int32_t > i32)
Construct a BarChart from a Collection<int32_t>.
Definition bar_chart.hpp:86
static BarChart i64(Collection< int64_t > i64)
Construct a BarChart from a Collection<int64_t>.
Definition bar_chart.hpp:144
static BarChart i16(Collection< int16_t > i16)
Construct a BarChart from a Collection<int16_t>.
Definition bar_chart.hpp:134
static BarChart f64(Collection< double > f64)
Construct a BarChart from a Collection<double>.
Definition bar_chart.hpp:159
static BarChart u64(Collection< uint64_t > u64)
Construct a BarChart from a Collection<uint64_t>.
Definition bar_chart.hpp:124
static BarChart f32(Collection< float > f32)
Construct a BarChart from a Collection<float>.
Definition bar_chart.hpp:154
static BarChart u16(Collection< uint16_t > u16)
Construct a BarChart from a Collection<uint16_t>.
Definition bar_chart.hpp:114
BarChart(Collection< rerun::half > f16)
Construct aBarChartfrom aCollection<half>`.
Definition bar_chart.hpp:94
BarChart(Collection< uint16_t > u16)
Construct a BarChart from a Collection<uint16_t>.
Definition bar_chart.hpp:66
static BarChart u8(Collection< uint8_t > u8)
Construct a BarChart from a Collection<uint8_t>.
Definition bar_chart.hpp:109
BarChart(Collection< uint8_t > u8)
Construct a BarChart from a Collection<uint8_t>.
Definition bar_chart.hpp:62
BarChart(Collection< float > f32)
Construct a BarChart from a Collection<float>.
Definition bar_chart.hpp:98
BarChart(Collection< int8_t > i8)
Construct a BarChart from a Collection<int8_t>.
Definition bar_chart.hpp:78
BarChart(Collection< uint32_t > u32)
Construct a BarChart from a Collection<uint32_t>.
Definition bar_chart.hpp:70
static BarChart i32(Collection< int32_t > i32)
Construct a BarChart from a Collection<int32_t>.
Definition bar_chart.hpp:139
BarChart(Collection< uint64_t > u64)
Construct a BarChart from a Collection<uint64_t>.
Definition bar_chart.hpp:74
BarChart with_color(rerun::components::Color _color) &&
The color of the bar chart.
Definition bar_chart.hpp:172
BarChart(Collection< int16_t > i16)
Construct a BarChart from a Collection<int16_t>.
Definition bar_chart.hpp:82
static BarChart i8(Collection< int8_t > i8)
Construct a BarChart from a Collection<int8_t>.
Definition bar_chart.hpp:129
std::optional< rerun::components::Color > color
The color of the bar chart.
Definition bar_chart.hpp:44
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:17
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:30
Component: An N-dimensional array of numbers.
Definition tensor_data.hpp:22
Datatype: The underlying storage for archetypes::Tensor.
Definition tensor_buffer.hpp:98
size_t num_elems() const
Number of elements in the buffer.