Rerun C++ SDK
Loading...
Searching...
No Matches
flag.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/flag.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**: Whether a record is flagged, e.g. for review.
14 ///
15 /// The Viewer shows it as a flag button.
16 /// Table card layouts show the first flag field in the card header.
17 ///
18 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
19 ///
20 struct Flag {
22
23 public:
24 Flag() = default;
25
26 Flag(rerun::encodings::Bool flagged_) : flagged(flagged_) {}
27
28 Flag& operator=(rerun::encodings::Bool flagged_) {
29 flagged = flagged_;
30 return *this;
31 }
32
33 Flag(bool value_) : flagged(value_) {}
34
35 Flag& operator=(bool value_) {
36 flagged = value_;
37 return *this;
38 }
39
40 /// Cast to the underlying Bool encoding
41 operator rerun::encodings::Bool() const {
42 return flagged;
43 }
44 };
45} // namespace rerun::components
46
47namespace rerun {
48 static_assert(sizeof(rerun::encodings::Bool) == sizeof(components::Flag));
49
50 /// \private
51 template <>
52 struct Loggable<components::Flag> {
53 static constexpr std::string_view ComponentType = "rerun.components.Flag";
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::Flag` into an arrow array.
61 static Result<std::shared_ptr<arrow::Array>> to_arrow(
62 const components::Flag* 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(
73 &instances->flagged,
74 num_instances
75 );
76 }
77 }
78 };
79} // 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: Whether a record is flagged, e.g.
Definition flag.hpp:20
Encoding: A single boolean.
Definition bool.hpp:19