// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
// Based on "crates/store/re_sdk_types/definitions/rerun/datatypes/channel_datatype.fbs".

#pragma once

#include "../result.hpp"

#include <cstdint>
#include <memory>

namespace arrow {
    /// \private
    template <typename T>
    class NumericBuilder;

    class Array;
    class DataType;
    class UInt8Type;
    using UInt8Builder = NumericBuilder<UInt8Type>;
} // namespace arrow

namespace rerun::datatypes {
    /// **Datatype**: The innermost datatype of an image.
    ///
    /// How individual color channel components are encoded.
    enum class ChannelDatatype : uint8_t {

        /// 8-bit unsigned integer.
        U8 = 6,

        /// 8-bit signed integer.
        I8 = 7,

        /// 16-bit unsigned integer.
        U16 = 8,

        /// 16-bit signed integer.
        I16 = 9,

        /// 32-bit unsigned integer.
        U32 = 10,

        /// 32-bit signed integer.
        I32 = 11,

        /// 64-bit unsigned integer.
        U64 = 12,

        /// 64-bit signed integer.
        I64 = 13,

        /// 16-bit IEEE-754 floating point, also known as `half`.
        F16 = 33,

        /// 32-bit IEEE-754 floating point, also known as `float` or `single`.
        F32 = 34,

        /// 64-bit IEEE-754 floating point, also known as `double`.
        F64 = 35,
    };
} // namespace rerun::datatypes

namespace rerun {
    template <typename T>
    struct Loggable;

    /// \private
    template <>
    struct Loggable<datatypes::ChannelDatatype> {
        static constexpr std::string_view ComponentType = "rerun.datatypes.ChannelDatatype";

        /// Returns the arrow data type this type corresponds to.
        static const std::shared_ptr<arrow::DataType>& arrow_datatype();

        /// Serializes an array of `rerun::datatypes::ChannelDatatype` into an arrow array.
        static Result<std::shared_ptr<arrow::Array>> to_arrow(
            const datatypes::ChannelDatatype* instances, size_t num_instances
        );

        /// Fills an arrow array builder with an array of this type.
        static rerun::Error fill_arrow_array_builder(
            arrow::UInt8Builder* builder, const datatypes::ChannelDatatype* elements,
            size_t num_elements
        );
    };
} // namespace rerun
