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

#pragma once

#include "../result.hpp"

#include <cstdint>
#include <memory>
#include <optional>
#include <string>

namespace arrow {
    class Array;
    class DataType;
    class StructBuilder;
} // namespace arrow

namespace rerun::datatypes {
    /// **Datatype**: A single dimension within a multi-dimensional tensor.
    struct TensorDimension {
        /// The length of this dimension.
        uint64_t size;

        /// The name of this dimension, e.g. "width", "height", "channel", "batch', ….
        std::optional<std::string> name;

      public: // START of extensions from tensor_dimension_ext.cpp:
        /// Nameless dimension.
        TensorDimension(size_t size_) : size(size_) {}

        /// Dimension with name.
        TensorDimension(size_t size_, std::string name_) : size(size_), name(std::move(name_)) {}

        // END of extensions from tensor_dimension_ext.cpp, start of generated code:

      public:
        TensorDimension() = default;
    };
} // namespace rerun::datatypes

namespace rerun {
    template <typename T>
    struct Loggable;

    /// \private
    template <>
    struct Loggable<datatypes::TensorDimension> {
        static constexpr const char Name[] = "rerun.datatypes.TensorDimension";

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

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

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