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

Method AddNode

Source/OpenNI/XnRecorderImpl.cpp:90–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90XnStatus RecorderImpl::AddNode(ProductionNode &node, XnCodecID compression)
91{
92 if (!node.IsValid())
93 {
94 return XN_STATUS_BAD_PARAM;
95 }
96
97 NodeWatchersMap::ConstIterator it = m_nodeWatchersMap.Find(node.GetHandle());
98 if (it != m_nodeWatchersMap.End())
99 {
100 return XN_STATUS_NODE_ALREADY_RECORDED;
101 }
102
103 if (compression == XN_CODEC_NULL)
104 {
105 compression = GetDefaultCodecID(node);
106 }
107
108 // take the predefined type (if we'll store extension types, we won't be able to play them later on)
109 XnProductionNodeType type = TypeManager::GetInstance().GetPredefinedBaseType(node.GetInfo().GetDescription().Type);
110
111 NodeWatcher* pNodeWatcher = NULL;
112 XnStatus nRetVal = CreateNodeWatcher(node, type, ModuleHandle(), Notifications(), pNodeWatcher);
113 XN_IS_STATUS_OK(nRetVal);
114 nRetVal = pNodeWatcher->Register();
115 if (nRetVal != XN_STATUS_OK)
116 {
117 XN_DELETE(pNodeWatcher);
118 return nRetVal;
119 }
120
121 nRetVal = NotifyNodeAdded(node.GetHandle(), type, compression);
122 if (nRetVal != XN_STATUS_OK)
123 {
124 XN_DELETE(pNodeWatcher);
125 return nRetVal;
126 }
127
128 nRetVal = pNodeWatcher->NotifyState();
129 if (nRetVal != XN_STATUS_OK)
130 {
131 XN_DELETE(pNodeWatcher);
132 return nRetVal;
133 }
134
135 nRetVal = m_nodeWatchersMap.Set(node.GetHandle(), pNodeWatcher);
136 if (nRetVal != XN_STATUS_OK)
137 {
138 XN_DELETE(pNodeWatcher);
139 return nRetVal;
140 }
141
142 return XN_STATUS_OK;
143}
144
145XnStatus RecorderImpl::RemoveNode(ProductionNode &node)
146{

Callers

nothing calls this directly

Calls 11

CreateNodeWatcherFunction · 0.85
GetHandleMethod · 0.80
GetPredefinedBaseTypeMethod · 0.80
NotifyStateMethod · 0.80
IsValidMethod · 0.45
FindMethod · 0.45
EndMethod · 0.45
GetDescriptionMethod · 0.45
GetInfoMethod · 0.45
RegisterMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected