Rerun C++ SDK
Loading...
Searching...
No Matches
image_format.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/image_format.fbs".
3
4#pragma once
5
6#include "../datatypes/image_format.hpp"
7#include "../result.hpp"
8
9#include <cstdint>
10#include <memory>
11
12namespace rerun::components {
13 /// **Component**: The metadata describing the contents of a `components::ImageBuffer`.
14 struct ImageFormat {
16
17 public: // START of extensions from image_format_ext.cpp:
18 /// From a specific pixel format.
20 : image_format(resolution, pixel_format) {}
21
22 /// Create a new image format for depth or segmentation images with the given resolution and datatype.
24 : image_format(resolution, datatype) {}
25
27 rerun::WidthHeight resolution, datatypes::ColorModel color_model,
29 )
30 : image_format(resolution, color_model, datatype) {}
31
32 // END of extensions from image_format_ext.cpp, start of generated code:
33
34 public:
35 ImageFormat() = default;
36
37 ImageFormat(rerun::datatypes::ImageFormat image_format_) : image_format(image_format_) {}
38
39 ImageFormat& operator=(rerun::datatypes::ImageFormat image_format_) {
40 image_format = image_format_;
41 return *this;
42 }
43
44 /// Cast to the underlying ImageFormat datatype
46 return image_format;
47 }
48 };
49} // namespace rerun::components
50
51namespace rerun {
52 static_assert(sizeof(rerun::datatypes::ImageFormat) == sizeof(components::ImageFormat));
53
54 /// \private
55 template <>
56 struct Loggable<components::ImageFormat> {
57 static constexpr const char Name[] = "rerun.components.ImageFormat";
58
59 /// Returns the arrow data type this type corresponds to.
60 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
61 return Loggable<rerun::datatypes::ImageFormat>::arrow_datatype();
62 }
63
64 /// Serializes an array of `rerun::components::ImageFormat` into an arrow array.
65 static Result<std::shared_ptr<arrow::Array>> to_arrow(
66 const components::ImageFormat* instances, size_t num_instances
67 ) {
68 if (num_instances == 0) {
69 return Loggable<rerun::datatypes::ImageFormat>::to_arrow(nullptr, 0);
70 } else if (instances == nullptr) {
71 return rerun::Error(
72 ErrorCode::UnexpectedNullArgument,
73 "Passed array instances is null when num_elements> 0."
74 );
75 } else {
76 return Loggable<rerun::datatypes::ImageFormat>::to_arrow(
77 &instances->image_format,
78 num_instances
79 );
80 }
81 }
82 };
83} // namespace rerun
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:79
PixelFormat
Datatype: Specifieds a particular format of an archetypes::Image.
Definition pixel_format.hpp:34
ColorModel
Datatype: Specified what color components are present in an archetypes::Image.
Definition color_model.hpp:26
ChannelDatatype
Datatype: The innermost datatype of an image.
Definition channel_datatype.hpp:26
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
The width and height of an image.
Definition image_utils.hpp:13
Component: The metadata describing the contents of a components::ImageBuffer.
Definition image_format.hpp:14
ImageFormat(rerun::WidthHeight resolution, datatypes::ChannelDatatype datatype)
Create a new image format for depth or segmentation images with the given resolution and datatype.
Definition image_format.hpp:23
ImageFormat(rerun::WidthHeight resolution, datatypes::PixelFormat pixel_format)
From a specific pixel format.
Definition image_format.hpp:19
Datatype: The metadata describing the contents of a components::ImageBuffer.
Definition image_format.hpp:24