Contents

SushiEngine::Simulation::BehaviorRegistry

create

std::unique_ptr< IEntityBehavior > create(const std::string &type_name) const

Parameters

NameType
type_nameconst std::string &

Returns

std::unique_ptr< IEntityBehavior >

Description

Constructs a fresh instance of type_name, or nullptr if never registered.

Example

bool can_construct(const SushiEngine::Simulation::BehaviorRegistry& registry,
                   const std::string& type_name)
{
    const std::unique_ptr<SushiEngine::Simulation::IEntityBehavior> behavior =
        registry.create(type_name);
    return behavior != nullptr;
}