Class filter_builder_base

Synopsis

#include <include/flecs/addons/cpp/builder.hpp>

template<typename ... Components>
class filter_builder_base
    : public filter_builder_i<filter_builder_base<Components...>, Components ...>

Description

No description yet.

Inheritance

Ancestors: filter_builder_i

Methods

filter_builder_base overload
build
operator ecs_filter_t
operator filter< Components ... >
world

Source

Lines 838-890 in include/flecs/addons/cpp/builder.hpp.

template<typename ... Components>
class filter_builder_base
    : public filter_builder_i<filter_builder_base<Components...>, Components ...>
{
public:
    filter_builder_base(flecs::world_t *world) 
        : filter_builder_i<filter_builder_base<Components...>, Components ...>(&m_desc)
        , m_desc({})
        , m_world(world)
    { 
        this->populate_filter_from_pack();
    }

    filter_builder_base(const filter_builder_base& obj) 
        : filter_builder_i<filter_builder_base<Components...>, Components ...>(&m_desc, obj.m_term_index)
    {
        m_world = obj.m_world;
        m_desc = obj.m_desc;
    }

    filter_builder_base(filter_builder_base&& obj) 
        : filter_builder_i<filter_builder_base<Components...>, Components ...>(&m_desc, obj.m_term_index)
    {
        m_world = obj.m_world;
        m_desc = obj.m_desc;
    }

    operator filter<Components ...>() const;

    operator ecs_filter_t() const {
        ecs_filter_t f;

        int res = ecs_filter_init(this->m_world, &f, &this->m_desc);
        if (res != 0) {
            ecs_abort(ECS_INVALID_PARAMETER, NULL);
        }

        if (this->m_desc.terms_buffer) {
            ecs_os_free(this->m_desc.terms_buffer);
        }

        return f;
    }

    filter<Components ...> build() const;

    ecs_filter_desc_t m_desc;

    flecs::world_t* world() override { return m_world; }

protected:
    flecs::world_t *m_world;
};