Example #1
0
//--------------------------------------------------------------------------------------------------
static legato::Component& GetComponent
(
    const std::string& name     ///< Name of the component.
)
//--------------------------------------------------------------------------------------------------
{
    auto& map = App.ComponentMap();

    // Check if we have already parsed a component with the same name.
    // If so, it's an error!
    if (map.find(name) != map.end())
    {
        throw legato::Exception("Multiple components with the same name (" + name + ").");
    }

    // Tell the App to create a new Component object for us and then get the parser to populate it.
    legato::Component& component = App.CreateComponent(name);
    legato::parser::ParseComponent(component, BuildParams);

    return component;
}