Rerun C++ SDK
Loading...
Searching...
No Matches
graph_node.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/components/graph_node.fbs".
3
4#pragma once
5
6#include "../datatypes/utf8.hpp"
7#include "../result.hpp"
8
9#include <cstdint>
10#include <memory>
11#include <string>
12#include <utility>
13
14namespace rerun::components {
15 /// **Component**: A string-based ID representing a node in a graph.
16 struct GraphNode {
18
19 public: // START of extensions from graph_node_ext.cpp:
20 /// Create a new graph edge from a c string.
21 GraphNode(const char* value_) : id(value_) {}
22
23 // END of extensions from graph_node_ext.cpp, start of generated code:
24
25 public:
26 GraphNode() = default;
27
28 GraphNode(rerun::datatypes::Utf8 id_) : id(std::move(id_)) {}
29
30 GraphNode& operator=(rerun::datatypes::Utf8 id_) {
31 id = std::move(id_);
32 return *this;
33 }
34
35 GraphNode(std::string value_) : id(std::move(value_)) {}
36
37 GraphNode& operator=(std::string value_) {
38 id = std::move(value_);
39 return *this;
40 }
41
42 /// Cast to the underlying Utf8 datatype
43 operator rerun::datatypes::Utf8() const {
44 return id;
45 }
46 };
47} // namespace rerun::components
48
49namespace rerun {
50 static_assert(sizeof(rerun::datatypes::Utf8) == sizeof(components::GraphNode));
51
52 /// \private
53 template <>
54 struct Loggable<components::GraphNode> {
55 static constexpr std::string_view ComponentType = "rerun.components.GraphNode";
56
57 /// Returns the arrow data type this type corresponds to.
58 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
59 return Loggable<rerun::datatypes::Utf8>::arrow_datatype();
60 }
61
62 /// Serializes an array of `rerun::components::GraphNode` into an arrow array.
63 static Result<std::shared_ptr<arrow::Array>> to_arrow(
64 const components::GraphNode* instances, size_t num_instances
65 ) {
66 if (num_instances == 0) {
67 return Loggable<rerun::datatypes::Utf8>::to_arrow(nullptr, 0);
68 } else if (instances == nullptr) {
69 return rerun::Error(
70 ErrorCode::UnexpectedNullArgument,
71 "Passed array instances is null when num_elements> 0."
72 );
73 } else {
74 return Loggable<rerun::datatypes::Utf8>::to_arrow(&instances->id, num_instances);
75 }
76 }
77 };
78} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:99
All built-in components. See Types in the Rerun manual.
Definition rerun.hpp:79
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Component: A string-based ID representing a node in a graph.
Definition graph_node.hpp:16
GraphNode(const char *value_)
Create a new graph edge from a c string.
Definition graph_node.hpp:21
Datatype: A string of text, encoded as UTF-8.
Definition utf8.hpp:21