// 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/archetypes/coordinate_frame.fbs".

#include "coordinate_frame.hpp"

#include "../collection_adapter_builtins.hpp"

namespace rerun::archetypes {
    CoordinateFrame CoordinateFrame::clear_fields() {
        auto archetype = CoordinateFrame();
        archetype.frame_id =
            ComponentBatch::empty<rerun::components::TransformFrameId>(Descriptor_frame_id)
                .value_or_throw();
        return archetype;
    }

    Collection<ComponentColumn> CoordinateFrame::columns(const Collection<uint32_t>& lengths_) {
        std::vector<ComponentColumn> columns;
        columns.reserve(1);
        if (frame_id.has_value()) {
            columns.push_back(frame_id.value().partitioned(lengths_).value_or_throw());
        }
        return columns;
    }

    Collection<ComponentColumn> CoordinateFrame::columns() {
        if (frame_id.has_value()) {
            return columns(std::vector<uint32_t>(frame_id.value().length(), 1));
        }
        return Collection<ComponentColumn>();
    }
} // namespace rerun::archetypes

namespace rerun {

    Result<Collection<ComponentBatch>> AsComponents<archetypes::CoordinateFrame>::as_batches(
        const archetypes::CoordinateFrame& archetype
    ) {
        using namespace archetypes;
        std::vector<ComponentBatch> cells;
        cells.reserve(1);

        if (archetype.frame_id.has_value()) {
            cells.push_back(archetype.frame_id.value());
        }

        return rerun::take_ownership(std::move(cells));
    }
} // namespace rerun
