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

Function xnScriptNodeRun

Source/OpenNI/XnOpenNI.cpp:6991–7059  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6989}
6990
6991XN_C_API XnStatus xnScriptNodeRun(XnNodeHandle hScript, XnEnumerationErrors* pErrors)
6992{
6993 XnStatus nRetVal = XN_STATUS_OK;
6994
6995 XN_VALIDATE_INTERFACE_TYPE(hScript, XN_NODE_TYPE_SCRIPT);
6996
6997 XnNodeInfoList* pCreatedNodes = NULL;
6998 nRetVal = xnNodeInfoListAllocate(&pCreatedNodes);
6999 XN_IS_STATUS_OK(nRetVal);
7000
7001 XnEnumerationErrors* pActualErrors = pErrors;
7002 if (pActualErrors == NULL)
7003 {
7004 nRetVal = xnEnumerationErrorsAllocate(&pActualErrors);
7005 if (nRetVal != XN_STATUS_OK)
7006 {
7007 xnNodeInfoListFree(pCreatedNodes);
7008 return (nRetVal);
7009 }
7010 }
7011
7012 // run the script
7013 nRetVal = xnScriptNodeRunImpl(hScript, pCreatedNodes, pActualErrors);
7014
7015 if (nRetVal == XN_STATUS_OK)
7016 {
7017 // add all created nodes to the list of dependencies
7018 for (XnNodeInfoListIterator it = xnNodeInfoListGetFirst(pCreatedNodes);
7019 xnNodeInfoListIteratorIsValid(it);
7020 it = xnNodeInfoListGetNext(it))
7021 {
7022 XnNodeInfo* pInfo = xnNodeInfoListGetCurrent(it);
7023 if (pInfo->hNode == NULL)
7024 {
7025 nRetVal = XN_STATUS_ERROR;
7026 break;
7027 }
7028
7029 nRetVal = xnAddNeededNode(hScript, pInfo->hNode);
7030 if (nRetVal != XN_STATUS_OK)
7031 {
7032 break;
7033 }
7034 }
7035 }
7036
7037 // release all nodes (either we had an error, or they are already added to the list of needed nodes
7038 for (XnNodeInfoListIterator it = xnNodeInfoListGetFirst(pCreatedNodes);
7039 xnNodeInfoListIteratorIsValid(it);
7040 it = xnNodeInfoListGetNext(it))
7041 {
7042 XnNodeInfo* pInfo = xnNodeInfoListGetCurrent(it);
7043 if (pInfo->hNode != NULL)
7044 {
7045 xnProductionNodeRelease(pInfo->hNode);
7046 }
7047 }
7048

Callers 4

RunMethod · 0.85
xnContextRunXmlScriptExFunction · 0.85

Calls 9

xnNodeInfoListAllocateFunction · 0.85
xnNodeInfoListFreeFunction · 0.85
xnScriptNodeRunImplFunction · 0.85
xnNodeInfoListGetCurrentFunction · 0.85
xnAddNeededNodeFunction · 0.85
xnProductionNodeReleaseFunction · 0.85
xnEnumerationErrorsFreeFunction · 0.85

Tested by

no test coverage detected