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