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

Function xnNodeInfoGetTreeStringRepresentationImpl

Source/OpenNI/XnOpenNI.cpp:1032–1107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1030}
1031
1032XnStatus xnNodeInfoGetTreeStringRepresentationImpl(XnNodeInfo* pNodeInfo, XnChar* csResult, XnUInt32 nSize, XnUInt32 nDepth)
1033{
1034 XnStatus nRetVal = XN_STATUS_OK;
1035 XnUInt32 nLen = 0;
1036 XnUInt32 nWritten = 0;
1037
1038 XnChar strIndentation[100] = "";
1039 if (nDepth >= 100)
1040 {
1041 XN_ASSERT(FALSE);
1042 return XN_STATUS_INTERNAL_BUFFER_TOO_SMALL;
1043 }
1044
1045 for (XnUInt32 i = 0; i < nDepth; ++i)
1046 {
1047 strIndentation[i] = '\t';
1048 }
1049
1050 nRetVal = xnOSStrCopy(csResult + nLen, strIndentation, nSize - nLen);
1051 XN_IS_STATUS_OK(nRetVal);
1052
1053 nLen = xnOSStrLen(csResult);
1054
1055 nRetVal = xnProductionNodeDescriptionToString(&pNodeInfo->Description, csResult + nLen, nSize - nLen);
1056 XN_IS_STATUS_OK(nRetVal);
1057
1058 if (pNodeInfo->strInstanceName[0] != '\0')
1059 {
1060 nLen = xnOSStrLen(csResult);
1061 nRetVal = xnOSStrFormat(csResult + nLen, nSize - nLen, &nWritten, "[\"%s\"]", pNodeInfo->strInstanceName);
1062 XN_IS_STATUS_OK(nRetVal);
1063 }
1064
1065 if (pNodeInfo->strCreationInfo[0] != '\0')
1066 {
1067 nLen = xnOSStrLen(csResult);
1068 nRetVal = xnOSStrFormat(csResult + nLen, nSize - nLen, &nWritten, "(%s)", pNodeInfo->strCreationInfo);
1069 XN_IS_STATUS_OK(nRetVal);
1070 }
1071
1072 if (pNodeInfo->pNeededTrees != NULL)
1073 {
1074 // add list of needed nodes
1075 XnBool bFirst = TRUE;
1076
1077 for (XnNodeInfoListIterator it = xnNodeInfoListGetFirst(pNodeInfo->pNeededTrees);
1078 xnNodeInfoListIteratorIsValid(it);
1079 it = xnNodeInfoListGetNext(it))
1080 {
1081 nLen = xnOSStrLen(csResult);
1082
1083 if (bFirst)
1084 {
1085 nRetVal = xnOSStrFormat(csResult + nLen, nSize - nLen, &nWritten, " ->\n", strIndentation);
1086 XN_IS_STATUS_OK(nRetVal);
1087 }
1088
1089 nLen = xnOSStrLen(csResult);

Callers 1

Calls 6

xnOSStrFormatFunction · 0.85
xnNodeInfoListGetCurrentFunction · 0.85
xnOSStrCopyFunction · 0.50
xnOSStrLenFunction · 0.50

Tested by

no test coverage detected