Rerun C++ SDK
Loading...
Searching...
No Matches
annotation_context.hpp
1// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/re_types/definitions/rerun/components/annotation_context.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../datatypes/class_description_map_elem.hpp"
8#include "../result.hpp"
9
10#include <cstdint>
11#include <memory>
12#include <type_traits>
13#include <utility>
14
15namespace arrow {
16 class Array;
17 class DataType;
18 class ListBuilder;
19} // namespace arrow
20
21namespace rerun::components {
22 /// **Component**: The `AnnotationContext` provides additional information on how to display entities.
23 ///
24 /// Entities can use `ClassId`s and `KeypointId`s to provide annotations, and
25 /// the labels and colors will be looked up in the appropriate
26 /// `AnnotationContext`. We use the *first* annotation context we find in the
27 /// path-hierarchy when searching up through the ancestors of a given entity
28 /// path.
30 /// List of class descriptions, mapping class indices to class names, colors etc.
32
33 public:
34 // Extensions to generated type defined in 'annotation_context_ext.cpp'
35
36 /// Construct from an initializer list of elements from which `rerun::datatypes::ClassDescriptionMapElem`s can be constructed.
37 ///
38 /// This will then create a new collection of `rerun::datatypes::ClassDescriptionMapElem`.
39 ///
40 /// _Implementation note_:
41 /// We handle this type of conversion in a generic `rerun::ContainerAdapter`.
42 /// However, it is *still* necessary since initializer list overload resolution is handled
43 /// in a special way by the compiler, making this case not being covered by the general container case.
44 template <
45 typename TElement, //
46 typename = std::enable_if_t<
47 std::is_constructible_v<datatypes::ClassDescriptionMapElem, TElement>> //
48 >
49 AnnotationContext(std::initializer_list<TElement> class_descriptions) {
50 std::vector<datatypes::ClassDescriptionMapElem> class_map_new;
51 class_map_new.reserve(class_descriptions.size());
52 for (const auto& class_description : class_descriptions) {
53 class_map_new.emplace_back(std::move(class_description));
54 }
56 std::move(class_map_new)
57 );
58 }
59
60 public:
61 AnnotationContext() = default;
62
64 : class_map(std::move(class_map_)) {}
65
66 AnnotationContext& operator=(
68 ) {
69 class_map = std::move(class_map_);
70 return *this;
71 }
72 };
73} // namespace rerun::components
74
75namespace rerun {
76 template <typename T>
77 struct Loggable;
78
79 /// \private
80 template <>
81 struct Loggable<components::AnnotationContext> {
82 static constexpr const char Name[] = "rerun.components.AnnotationContext";
83
84 /// Returns the arrow data type this type corresponds to.
85 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
86
87 /// Fills an arrow array builder with an array of this type.
88 static rerun::Error fill_arrow_array_builder(
89 arrow::ListBuilder* builder, const components::AnnotationContext* elements,
90 size_t num_elements
91 );
92
93 /// Serializes an array of `rerun::components::AnnotationContext` into an arrow array.
94 static Result<std::shared_ptr<arrow::Array>> to_arrow(
95 const components::AnnotationContext* instances, size_t num_instances
96 );
97 };
98} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:47
static Collection< TElement > take_ownership(std::vector< TElement > &&data)
Takes ownership of a temporary std::vector, moving it into the collection.
Definition collection.hpp:183
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:87
All built-in components. See Types in the Rerun manual.
Definition rerun.hpp:69
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:20
Archetype: The AnnotationContext provides additional information on how to display entities.
Definition annotation_context.hpp:63
Component: The AnnotationContext provides additional information on how to display entities.
Definition annotation_context.hpp:29
rerun::Collection< rerun::datatypes::ClassDescriptionMapElem > class_map
List of class descriptions, mapping class indices to class names, colors etc.
Definition annotation_context.hpp:31
AnnotationContext(std::initializer_list< TElement > class_descriptions)
Construct from an initializer list of elements from which rerun::datatypes::ClassDescriptionMapElems ...
Definition annotation_context.hpp:49