Rerun C++ SDK
Loading...
Searching...
No Matches
resolution.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/resolution.fbs".
3
4#pragma once
5
6#include "../datatypes/vec2d.hpp"
7#include "../result.hpp"
8
9#include <array>
10#include <cstdint>
11#include <memory>
12
13namespace arrow {
14 class Array;
15 class DataType;
16 class FixedSizeListBuilder;
17} // namespace arrow
18
19namespace rerun::components {
20 /// **Component**: Pixel resolution width & height, e.g. of a camera sensor.
21 ///
22 /// Typically in integer units, but for some use cases floating point may be used.
23 struct Resolution {
24 rerun::datatypes::Vec2D resolution;
25
26 public:
27 // Extensions to generated type defined in 'resolution_ext.cpp'
28
29 static const Resolution IDENTITY;
30
31 /// Construct resolution from width and height floats.
32 Resolution(float width, float height) : resolution{width, height} {}
33
34 /// Construct resolution from width and height integers.
35 Resolution(int width, int height)
36 : resolution{static_cast<float>(width), static_cast<float>(height)} {}
37
38 public:
39 Resolution() = default;
40
41 Resolution(rerun::datatypes::Vec2D resolution_) : resolution(resolution_) {}
42
43 Resolution& operator=(rerun::datatypes::Vec2D resolution_) {
44 resolution = resolution_;
45 return *this;
46 }
47
48 Resolution(std::array<float, 2> xy_) : resolution(xy_) {}
49
50 Resolution& operator=(std::array<float, 2> xy_) {
51 resolution = xy_;
52 return *this;
53 }
54
55 /// Cast to the underlying Vec2D datatype
56 operator rerun::datatypes::Vec2D() const {
57 return resolution;
58 }
59 };
60} // namespace rerun::components
61
62namespace rerun {
63 template <typename T>
64 struct Loggable;
65
66 /// \private
67 template <>
68 struct Loggable<components::Resolution> {
69 static constexpr const char Name[] = "rerun.components.Resolution";
70
71 /// Returns the arrow data type this type corresponds to.
72 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
73
74 /// Fills an arrow array builder with an array of this type.
75 static rerun::Error fill_arrow_array_builder(
76 arrow::FixedSizeListBuilder* builder, const components::Resolution* elements,
77 size_t num_elements
78 );
79
80 /// Serializes an array of `rerun::components::Resolution` into an arrow array.
81 static Result<std::shared_ptr<arrow::Array>> to_arrow(
82 const components::Resolution* instances, size_t num_instances
83 );
84 };
85} // namespace rerun
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
Component: Pixel resolution width & height, e.g.
Definition resolution.hpp:23
Resolution(float width, float height)
Construct resolution from width and height floats.
Definition resolution.hpp:32
Resolution(int width, int height)
Construct resolution from width and height integers.
Definition resolution.hpp:35
Datatype: A vector in 2D space.
Definition vec2d.hpp:20