Rerun C++ SDK
Loading...
Searching...
No Matches
bool.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/build/re_type_definitions/rerun/components/bool.def.rs".
3
4#pragma once
5
6#include "../encodings/bool.hpp"
7#include "../result.hpp"
8
9#include <cstdint>
10#include <memory>
11
12namespace rerun::components {
13 /// **Component**: A boolean value.
14 ///
15 /// The Viewer shows it as a checkbox.
16 /// Boolean table columns without a component type are shown with this component.
17 ///
18 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
19 ///
20 struct Bool {
22
23 public:
24 Bool() = default;
25
26 Bool(rerun::encodings::Bool value_) : value(value_) {}
27
28 Bool& operator=(rerun::encodings::Bool value_) {
29 value = value_;
30 return *this;
31 }
32
33 Bool(bool value_) : value(value_) {}
34
35 Bool& operator=(bool value_) {
36 value = value_;
37 return *this;
38 }
39
40 /// Cast to the underlying Bool encoding
41 operator rerun::encodings::Bool() const {
42 return value;
43 }
44 };
45} // namespace rerun::components
46
47namespace rerun {
48 static_assert(sizeof(rerun::encodings::Bool) == sizeof(components::Bool));
49
50 /// \private
51 template <>
52 struct Loggable<components::Bool> {
53 static constexpr std::string_view ComponentType = "rerun.components.Bool";
54
55 /// Returns the arrow data type this type corresponds to.
56 static const std::shared_ptr<arrow::DataType>& arrow_data_type() {
57 return Loggable<rerun::encodings::Bool>::arrow_data_type();
58 }
59
60 /// Serializes an array of `rerun::components::Bool` into an arrow array.
61 static Result<std::shared_ptr<arrow::Array>> to_arrow(
62 const components::Bool* instances, size_t num_instances
63 ) {
64 if (num_instances == 0) {
65 return Loggable<rerun::encodings::Bool>::to_arrow(nullptr, 0);
66 } else if (instances == nullptr) {
67 return rerun::Error(
68 ErrorCode::UnexpectedNullArgument,
69 "Passed array instances is null when num_elements> 0."
70 );
71 } else {
72 return Loggable<rerun::encodings::Bool>::to_arrow(&instances->value, num_instances);
73 }
74 }
75 };
76} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:104
All built-in components. See Types in the Rerun manual.
Definition rerun.hpp:93
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:26
Component: A boolean value.
Definition bool.hpp:20
Encoding: A single boolean.
Definition bool.hpp:19