// 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/blueprint/components/filter_is_not_null.fbs".

#pragma once

#include "../../blueprint/datatypes/filter_is_not_null.hpp"
#include "../../component_descriptor.hpp"
#include "../../result.hpp"

#include <cstdint>
#include <memory>
#include <utility>

namespace rerun::blueprint::components {
    /// **Component**: Configuration for the filter is not null feature of the dataframe view.
    struct FilterIsNotNull {
        rerun::blueprint::datatypes::FilterIsNotNull filter_is_not_null;

      public:
        FilterIsNotNull() = default;

        FilterIsNotNull(rerun::blueprint::datatypes::FilterIsNotNull filter_is_not_null_)
            : filter_is_not_null(std::move(filter_is_not_null_)) {}

        FilterIsNotNull& operator=(rerun::blueprint::datatypes::FilterIsNotNull filter_is_not_null_
        ) {
            filter_is_not_null = std::move(filter_is_not_null_);
            return *this;
        }

        /// Cast to the underlying FilterIsNotNull datatype
        operator rerun::blueprint::datatypes::FilterIsNotNull() const {
            return filter_is_not_null;
        }
    };
} // namespace rerun::blueprint::components

namespace rerun {
    static_assert(
        sizeof(rerun::blueprint::datatypes::FilterIsNotNull) ==
        sizeof(blueprint::components::FilterIsNotNull)
    );

    /// \private
    template <>
    struct Loggable<blueprint::components::FilterIsNotNull> {
        static constexpr ComponentDescriptor Descriptor =
            "rerun.blueprint.components.FilterIsNotNull";

        /// Returns the arrow data type this type corresponds to.
        static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
            return Loggable<rerun::blueprint::datatypes::FilterIsNotNull>::arrow_datatype();
        }

        /// Serializes an array of `rerun::blueprint:: components::FilterIsNotNull` into an arrow array.
        static Result<std::shared_ptr<arrow::Array>> to_arrow(
            const blueprint::components::FilterIsNotNull* instances, size_t num_instances
        ) {
            if (num_instances == 0) {
                return Loggable<rerun::blueprint::datatypes::FilterIsNotNull>::to_arrow(nullptr, 0);
            } else if (instances == nullptr) {
                return rerun::Error(
                    ErrorCode::UnexpectedNullArgument,
                    "Passed array instances is null when num_elements> 0."
                );
            } else {
                return Loggable<rerun::blueprint::datatypes::FilterIsNotNull>::to_arrow(
                    &instances->filter_is_not_null,
                    num_instances
                );
            }
        }
    };
} // namespace rerun
