| 1385 | } |
| 1386 | |
| 1387 | XnStatus XnModuleLoader::Enumerate(XnContext* pContext, XnProductionNodeType Type, XnNodeInfoList* pList, XnEnumerationErrors* pErrors) |
| 1388 | { |
| 1389 | XnStatus nRetVal = XN_STATUS_OK; |
| 1390 | |
| 1391 | XnArray<const XnLoadedGenerator*> foundGenerators; |
| 1392 | foundGenerators.Reserve(50); |
| 1393 | |
| 1394 | for (XnLoadedGeneratorsHash::ConstIterator it = m_AllGenerators.Begin(); it != m_AllGenerators.End(); ++it) |
| 1395 | { |
| 1396 | const XnLoadedGenerator& LoadedGenerator = it->Value(); |
| 1397 | |
| 1398 | // check if it's of the same type and it's not a mock node |
| 1399 | if (LoadedGenerator.Description.Type == Type) |
| 1400 | { |
| 1401 | nRetVal = foundGenerators.AddLast(&LoadedGenerator); |
| 1402 | XN_IS_STATUS_OK(nRetVal); |
| 1403 | } |
| 1404 | } |
| 1405 | |
| 1406 | // now sort the list, so that new versions of a specific generator (vendor + name) will appear first |
| 1407 | XnAlgorithms::BubbleSort(foundGenerators.GetData(), foundGenerators.GetSize(), CompareGeneratorsByVersion); |
| 1408 | |
| 1409 | // and now enumerate each one |
| 1410 | for (XnUInt32 i = 0; i < foundGenerators.GetSize(); ++i) |
| 1411 | { |
| 1412 | XnNodeInfoList* pGeneratorList = NULL; |
| 1413 | nRetVal = xnNodeInfoListAllocate(&pGeneratorList); |
| 1414 | XN_IS_STATUS_OK(nRetVal); |
| 1415 | |
| 1416 | const XnLoadedGenerator* pLoadedGenerator = foundGenerators[i]; |
| 1417 | nRetVal = pLoadedGenerator->ExportedInterface.EnumerateProductionTrees(pContext, pGeneratorList, pErrors); |
| 1418 | if (nRetVal != XN_STATUS_OK && pErrors != NULL) |
| 1419 | { |
| 1420 | nRetVal = xnEnumerationErrorsAdd(pErrors, &pLoadedGenerator->Description, nRetVal); |
| 1421 | if (nRetVal != XN_STATUS_OK) |
| 1422 | { |
| 1423 | xnNodeInfoListFree(pGeneratorList); |
| 1424 | return (nRetVal); |
| 1425 | } |
| 1426 | } |
| 1427 | |
| 1428 | xnNodeInfoListAppend(pList, pGeneratorList); |
| 1429 | xnNodeInfoListFree(pGeneratorList); |
| 1430 | } |
| 1431 | |
| 1432 | return (XN_STATUS_OK); |
| 1433 | } |
| 1434 | |
| 1435 | XnStatus XnModuleLoader::CreateRootNode(XnContext* pContext, XnNodeInfo* pTree, XnModuleInstance** ppInstance) |
| 1436 | { |
no test coverage detected