MCPcopy Create free account
hub / github.com/PDAL/PDAL / l_createObject

Method l_createObject

pdal/PluginManager.cpp:357–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355
356template <typename T>
357T *PluginManager<T>::l_createObject(const std::string& objectType)
358{
359 // Static plugins already here.
360 auto find([this, &objectType]()->bool
361 {
362 std::lock_guard<std::mutex> lock(m_pluginMutex);
363 return m_plugins.count(objectType);
364 });
365
366 if (find() || (l_loadDynamic(objectType) && find()))
367 {
368 // Kernels contain a PipelineManager, which may load other plugins,
369 // so the lock must be released prior to invoking the ctor to
370 // avoid deadlock.
371 std::function<T *()> f;
372 {
373 // Lock must be released before the creation function is invoked.
374 std::lock_guard<std::mutex> lock(m_pluginMutex);
375 f = m_plugins[objectType].create;
376 }
377 return f();
378 }
379 return nullptr;
380}
381
382
383template <typename T>

Callers 1

createObjectMethod · 0.80

Calls 1

findFunction · 0.85

Tested by

no test coverage detected