示例#1
0
void *PluginManager::createObject(const std::string& objectType)
{
    void* obj(0);

    auto find([this, &objectType]()->bool
    {
        return m_exactMatchMap.count(objectType);
    });

    if (find() || (guessLoadByPath(objectType) && find()))
    {
        obj = m_exactMatchMap[objectType].createFunc();
    }

    return obj;
}
示例#2
0
void *PluginManager::l_createObject(const std::string& objectType)
{
    auto find([this, &objectType]()->bool
    {
        std::lock_guard<std::mutex> lock(m_mutex);
        return m_plugins.count(objectType);
    });


    void *obj(0);
    if (find() || (guessLoadByPath(objectType) && find()))
    {
        PF_CreateFunc f;
        {
            std::lock_guard<std::mutex> lock(m_mutex);
            f = m_plugins[objectType].createFunc;
        }
        obj = f();
    }

    return obj;
}