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

Function SetHandle

Include/XnCppWrapper.h:1725–1758  ·  view source on GitHub ↗

* Replaces the object being pointed. */

Source from the content-addressed store, hash-verified

1723 * Replaces the object being pointed.
1724 */
1725 inline void SetHandle(XnNodeHandle hNode)
1726 {
1727 if (m_hNode == hNode)
1728 {
1729 // Optimization: do nothing
1730 return;
1731 }
1732
1733 // check currently held node. If we're holding a node, release it
1734 if (m_hNode != NULL)
1735 {
1736 XnContext* pContext = xnGetRefContextFromNodeHandle(m_hNode);
1737 xnContextUnregisterFromShutdown(pContext, m_hShuttingDownCallback);
1738 xnContextRelease(pContext);
1739 xnProductionNodeRelease(m_hNode);
1740 }
1741
1742 // check new node handle, if it points to a node, add ref to it
1743 if (hNode != NULL)
1744 {
1745 XnStatus nRetVal = xnProductionNodeAddRef(hNode);
1746 XN_ASSERT(nRetVal == XN_STATUS_OK);
1747 XN_REFERENCE_VARIABLE(nRetVal);
1748
1749 XnContext* pContext = xnGetRefContextFromNodeHandle(hNode);
1750
1751 nRetVal = xnContextRegisterForShutdown(pContext, ContextShuttingDownCallback, this, &m_hShuttingDownCallback);
1752 XN_ASSERT(nRetVal == XN_STATUS_OK);
1753
1754 xnContextRelease(pContext);
1755 }
1756
1757 m_hNode = hNode;
1758 }
1759
1760 inline void TakeOwnership(XnNodeHandle hNode)
1761 {

Callers 7

NodeWrapperFunction · 0.85
XnCppWrapper.hFile · 0.85
~NodeWrapperFunction · 0.85
ReleaseFunction · 0.85
TakeOwnershipFunction · 0.85
ContextFunction · 0.85
~ContextFunction · 0.85

Calls 8

xnContextReleaseFunction · 0.85
xnProductionNodeReleaseFunction · 0.85
xnProductionNodeAddRefFunction · 0.85
xnForceShutdownFunction · 0.85
xnContextAddRefFunction · 0.85

Tested by

no test coverage detected