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

#include "instance_poses3d.hpp"

#include "../collection_adapter_builtins.hpp"

namespace rerun::archetypes {}

namespace rerun {

    Result<std::vector<ComponentBatch>> AsComponents<archetypes::InstancePoses3D>::serialize(
        const archetypes::InstancePoses3D& archetype
    ) {
        using namespace archetypes;
        std::vector<ComponentBatch> cells;
        cells.reserve(6);

        if (archetype.translations.has_value()) {
            auto result = ComponentBatch::from_loggable(archetype.translations.value());
            RR_RETURN_NOT_OK(result.error);
            cells.push_back(std::move(result.value));
        }
        if (archetype.rotation_axis_angles.has_value()) {
            auto result = ComponentBatch::from_loggable(archetype.rotation_axis_angles.value());
            RR_RETURN_NOT_OK(result.error);
            cells.push_back(std::move(result.value));
        }
        if (archetype.quaternions.has_value()) {
            auto result = ComponentBatch::from_loggable(archetype.quaternions.value());
            RR_RETURN_NOT_OK(result.error);
            cells.push_back(std::move(result.value));
        }
        if (archetype.scales.has_value()) {
            auto result = ComponentBatch::from_loggable(archetype.scales.value());
            RR_RETURN_NOT_OK(result.error);
            cells.push_back(std::move(result.value));
        }
        if (archetype.mat3x3.has_value()) {
            auto result = ComponentBatch::from_loggable(archetype.mat3x3.value());
            RR_RETURN_NOT_OK(result.error);
            cells.push_back(std::move(result.value));
        }
        {
            auto indicator = InstancePoses3D::IndicatorComponent();
            auto result = ComponentBatch::from_loggable(indicator);
            RR_RETURN_NOT_OK(result.error);
            cells.emplace_back(std::move(result.value));
        }

        return cells;
    }
} // namespace rerun
