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