MCPcopy Create free account
hub / github.com/OpenNI/OpenNI / xnAutoEnumerateOverSingleInput

Function xnAutoEnumerateOverSingleInput

Source/OpenNI/XnOpenNI.cpp:611–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

609}
610
611XN_C_API XnStatus xnAutoEnumerateOverSingleInput(XnContext* pContext, XnNodeInfoList* pList, XnProductionNodeDescription* pDescription, const XnChar* strCreationInfo, XnProductionNodeType InputType, XnEnumerationErrors* pErrors, XnNodeQuery* pQuery)
612{
613 XnStatus nRetVal = XN_STATUS_OK;
614
615 XN_VALIDATE_INPUT_PTR(pList);
616 XN_VALIDATE_INPUT_PTR(pDescription);
617
618 // enumerate needed node
619 XnNodeInfoList* pInputList;
620 nRetVal = xnEnumerateProductionTrees(pContext, InputType, pQuery, &pInputList, pErrors);
621 if (nRetVal != XN_STATUS_OK && nRetVal != XN_STATUS_NO_NODE_PRESENT)
622 {
623 return (nRetVal);
624 }
625
626 if (nRetVal == XN_STATUS_OK)
627 {
628 // now, for each found node, add one to the list
629 for (XnNodeInfoListIterator it = xnNodeInfoListGetFirst(pInputList);
630 xnNodeInfoListIteratorIsValid(it);
631 it = xnNodeInfoListGetNext(it))
632 {
633 // create needed nodes list
634 XnNodeInfoList* pNeeded;
635 nRetVal = xnNodeInfoListAllocate(&pNeeded);
636 if (nRetVal != XN_STATUS_OK)
637 {
638 xnNodeInfoListFree(pInputList);
639 return (nRetVal);
640 }
641
642 // add this input node to it
643 nRetVal = xnNodeInfoListAddNodeFromList(pNeeded, it);
644 if (nRetVal != XN_STATUS_OK)
645 {
646 xnNodeInfoListFree(pInputList);
647 xnNodeInfoListFree(pNeeded);
648 return (nRetVal);
649 }
650
651 // and add to result list
652 nRetVal = xnNodeInfoListAdd(pList, pDescription, strCreationInfo, pNeeded);
653 if (nRetVal != XN_STATUS_OK)
654 {
655 xnNodeInfoListFree(pInputList);
656 xnNodeInfoListFree(pNeeded);
657 return (nRetVal);
658 }
659
660 xnNodeInfoListFree(pNeeded);
661 }
662
663 // free input nodes list
664 xnNodeInfoListFree(pInputList);
665 }
666
667 return (XN_STATUS_OK);
668}

Callers 1

Calls 6

xnNodeInfoListAllocateFunction · 0.85
xnNodeInfoListFreeFunction · 0.85
xnNodeInfoListAddFunction · 0.85

Tested by

no test coverage detected