summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2016-01-11 17:08:02 +0200
committerMiikka Heikkinen <miikka.heikkinen@theqtcompany.com>2016-01-13 09:36:43 +0000
commit6e7fa62347dde5592e8c0694b2d66c3018d08ba6 (patch)
tree07826fe5943bebff55893faf0fdeb55db8a95947
parent25fa07daf70b8b00cd6832a9e180dfa517da4b8b (diff)
Remove some manual test apps
Removed - Kinectsurface - Has 3rd party code. - qmlcamera - Ugly mess and kinda pointless. - qmlmultiwindow - Test is not relevant and is buggy. - spectrum - Has 3rd party code. Change-Id: Ic28ffddf9e45f51a5320d4ebd0e2b7b373452cb7 Reviewed-by: Tomi Korpipää <tomi.korpipaa@theqtcompany.com>
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/00openni_notes.txt2
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/ARC/XnOSARC.h166
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/ARC/XnPlatformARC.h194
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Android-Arm/XnPlatformAndroid-Arm.h49
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/IXnNodeAllocator.h53
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Linux-Arm/XnPlatformLinux-Arm.h37
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Linux-x86/XnOSLinux-x86.h165
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Linux-x86/XnPlatformLinux-x86.h195
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/MacOSX/XnPlatformMacOSX.h43
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Win32/XnOSWin32.h157
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Win32/XnPlatformWin32.h255
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Win32/usb100.h270
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnAlgorithms.h81
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnArray.h313
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnBaseNode.h59
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnBitSet.h135
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCallback.h41
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCodecIDs.h34
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnContext.h569
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCppWrapper.h10100
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCyclicQueueT.h79
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCyclicStackT.h80
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDataTypes.h120
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDerivedCast.h80
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDump.h202
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDumpWriters.h127
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnEnumerationErrors.h142
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnEvent.h301
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnEventT.h393
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnFPSCalculator.h72
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnGeneralBuffer.h119
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnHash.h1014
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnHashT.h668
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnInternalDefs.h27
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnLicensing.h72
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnList.h749
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnListT.h556
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnLog.h545
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnLogTypes.h80
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnLogWriterBase.h128
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnMacros.h128
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnModuleCFunctions.h1995
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnModuleCppInterface.h605
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnModuleCppRegistratration.h303
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnModuleInterface.h1351
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnNode.h76
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnNodeAllocator.h46
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnOS.h784
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnOSCpp.h163
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnOSMemory.h47
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnOSStrings.h47
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnOpenNI.h50
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnPlatform.h124
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnPrdNode.h2614
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnPrdNodeInfo.h126
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnPrdNodeInfoList.h226
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnProfiling.h131
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnPropNames.h62
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueries.h159
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueue.h198
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnQueueT.h63
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnScheduler.h92
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnStack.h151
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnStackT.h58
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnStatus.h110
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnStatusCodes.h81
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnStatusRegister.h81
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnStringsHash.h118
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnStringsHashT.h90
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnThreadSafeQueue.h156
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnTypes.h1188
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnUSB.h128
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnUSBDevice.h117
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnUtils.h427
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnVersion.h58
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/mingw-win32/XnOSLinux-x86.h165
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/mingw-win32/XnPlatformLinux-x86.h196
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/QKinectWrapper.cpp283
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/QKinectWrapper.h117
-rw-r--r--tests/manual/kinectsurface/QtKinectWrapper/config.pro60
-rw-r--r--tests/manual/kinectsurface/kinectsurface.pro71
-rw-r--r--tests/manual/kinectsurface/main.cpp187
-rw-r--r--tests/manual/kinectsurface/surfacedata.cpp403
-rw-r--r--tests/manual/kinectsurface/surfacedata.h106
-rw-r--r--tests/manual/manual.pro8
-rw-r--r--tests/manual/qmlcamera/main.cpp48
-rw-r--r--tests/manual/qmlcamera/qml/qmlcamera/Axes.qml49
-rw-r--r--tests/manual/qmlcamera/qml/qmlcamera/ControlSurface.qml56
-rw-r--r--tests/manual/qmlcamera/qml/qmlcamera/Data.qml144
-rw-r--r--tests/manual/qmlcamera/qml/qmlcamera/main.qml238
-rw-r--r--tests/manual/qmlcamera/qmlcamera.pro10
-rw-r--r--tests/manual/qmlcamera/qmlcamera.qrc12
-rw-r--r--tests/manual/qmlcamera/shuttle.obj6349
-rw-r--r--tests/manual/qmlcamera/shuttle.pngbin1361 -> 0 bytes
-rw-r--r--tests/manual/qmlmultiwindow/main.cpp50
-rw-r--r--tests/manual/qmlmultiwindow/qml/qmlmultiwindow/Data.qml51
-rw-r--r--tests/manual/qmlmultiwindow/qml/qmlmultiwindow/NewButton.qml55
-rw-r--r--tests/manual/qmlmultiwindow/qml/qmlmultiwindow/main.qml263
-rw-r--r--tests/manual/qmlmultiwindow/qmlmultiwindow.pro12
-rw-r--r--tests/manual/qmlmultiwindow/qmlmultiwindow.qrc7
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/Array.h97
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/Array.hpp98
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/DynArray.h100
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/DynArray.hpp143
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTReal.dsp273
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTReal.dsw29
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTReal.h142
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTReal.hpp916
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTRealFixLen.h130
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTRealFixLen.hpp322
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTRealFixLenParam.h93
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTRealPassDirect.h96
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTRealPassDirect.hpp204
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTRealPassInverse.h101
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTRealPassInverse.hpp229
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTRealSelect.h77
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTRealSelect.hpp62
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTRealUseTrigo.h101
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/FFTRealUseTrigo.hpp91
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/OscSinCos.h106
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/OscSinCos.hpp122
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/TestAccuracy.h105
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/TestAccuracy.hpp472
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/TestHelperFixLen.h93
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/TestHelperFixLen.hpp93
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/TestHelperNormal.h94
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/TestHelperNormal.hpp99
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/TestSpeed.h95
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/TestSpeed.hpp223
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/TestWhiteNoiseGen.h95
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/TestWhiteNoiseGen.hpp91
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/def.h60
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/fftreal.pas661
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/fftreal.pro44
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/fftreal_wrapper.cpp54
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/fftreal_wrapper.h63
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/license.txt459
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/readme.txt242
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/test.cpp267
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/test_fnc.h53
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/test_fnc.hpp56
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/test_settings.h45
-rw-r--r--tests/manual/spectrum/3rdparty/fftreal/testapp.dpr150
-rw-r--r--tests/manual/spectrum/README.txt103
-rw-r--r--tests/manual/spectrum/spectrum.pri18
-rw-r--r--tests/manual/spectrum/spectrum.pro16
-rw-r--r--tests/manual/spectrum/spectrumapp/engine.cpp622
-rw-r--r--tests/manual/spectrum/spectrumapp/engine.h250
-rw-r--r--tests/manual/spectrum/spectrumapp/frequencyspectrum.cpp70
-rw-r--r--tests/manual/spectrum/spectrumapp/frequencyspectrum.h79
-rw-r--r--tests/manual/spectrum/spectrumapp/main.cpp212
-rw-r--r--tests/manual/spectrum/spectrumapp/soundFiles/Rockhop.wavbin1059308 -> 0 bytes
-rw-r--r--tests/manual/spectrum/spectrumapp/soundFiles/futurebells_beat.wavbin352084 -> 0 bytes
-rw-r--r--tests/manual/spectrum/spectrumapp/soundFiles/onclassical_demo_fiati-di-parma_thuille_terzo-tempo_sestetto_small-version.wavbin1055502 -> 0 bytes
-rw-r--r--tests/manual/spectrum/spectrumapp/spectrum.h114
-rw-r--r--tests/manual/spectrum/spectrumapp/spectrum.qrc7
-rw-r--r--tests/manual/spectrum/spectrumapp/spectrumanalyser.cpp212
-rw-r--r--tests/manual/spectrum/spectrumapp/spectrumanalyser.h153
-rw-r--r--tests/manual/spectrum/spectrumapp/spectrumapp.pro73
-rw-r--r--tests/manual/spectrum/spectrumapp/utils.cpp120
-rw-r--r--tests/manual/spectrum/spectrumapp/utils.h93
-rw-r--r--tests/manual/spectrum/spectrumapp/wavfile.cpp132
-rw-r--r--tests/manual/spectrum/spectrumapp/wavfile.h47
163 files changed, 1 insertions, 49031 deletions
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/00openni_notes.txt b/tests/manual/kinectsurface/QtKinectWrapper/00openni_notes.txt
deleted file mode 100644
index 2487a1ff..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/00openni_notes.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-OpenNI/Include: contains includes of OpenNI-1.5.4
-
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/ARC/XnOSARC.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/ARC/XnOSARC.h
deleted file mode 100644
index 0a183724..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/ARC/XnOSARC.h
+++ /dev/null
@@ -1,166 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef _XN_OSLINUX_X86_H_
-#define _XN_OSLINUX_X86_H_
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <sys/types.h>
-#include <stdarg.h>
-#include <time.h>
-#include <stdio.h>
-
-//---------------------------------------------------------------------------
-// Files
-//---------------------------------------------------------------------------
-/** A generic handle type. */
-typedef void* XN_HANDLE;
-
-/** A file handle type. */
-typedef FILE* XN_FILE_HANDLE;
-
-/** The value of an invalid file handle. */
-#define XN_INVALID_FILE_HANDLE NULL
-
-/** A string that specifies the current directory. */
-#define XN_FILE_LOCAL_DIR "./"
-
-/** The file directory separator. */
-#define XN_FILE_DIR_SEP "/"
-
-/** The file extension separator. */
-#define XN_FILE_EXT_SEP "."
-
-/** The file "all" wildcard. */
-#define XN_FILE_ALL_WILDCARD "*"
-
-/** The newline separation string. */
-#define XN_NEW_LINE_SEP "\n"
-
-//---------------------------------------------------------------------------
-// INI Files
-//---------------------------------------------------------------------------
-/** A string that specifies the extension of INI files. */
-#define XN_INI_FILE_EXT "ini"
-
-/** The maximum allowed INI string length (in bytes). */
-// Note: This must always be big enough to contain a 32-bit number!
-#define XN_INI_MAX_LEN 256
-
-//---------------------------------------------------------------------------
-// Shared Libraries
-//---------------------------------------------------------------------------
-/** A shared library handle type. */
-typedef void* XN_LIB_HANDLE;
-
-/** A string that specifies the prefix of shared library files. */
-#define XN_SHARED_LIBRARY_PREFIX "lib"
-
-/** A string that specifies the postfix of shared library files. */
-#define XN_SHARED_LIBRARY_POSTFIX ".so"
-
-//---------------------------------------------------------------------------
-// Threads
-//---------------------------------------------------------------------------
-/** A Xiron thread type. */
-typedef int XN_THREAD_HANDLE;
-
-/** A Xiron thread ID. */
-typedef int XN_THREAD_ID;
-
-/** A Xiron process ID. */
-typedef int XN_PROCESS_ID;
-
-/** The thread entry point function prototype. */
-typedef void* (*XN_THREAD_PROC_PROTO)(void* arg);
-
-/** The thread entry point function definition. */
-#define XN_THREAD_PROC void*
-
-/** The thread return function. */
-#define XN_THREAD_PROC_RETURN(ret) return((void*)ret)
-
-/** The thread passable data pointer type. */
-typedef void* XN_THREAD_PARAM;
-
-//---------------------------------------------------------------------------
-// Time Outs
-//---------------------------------------------------------------------------
-/** The mutex lock infinite timeout. */
-#define XN_WAIT_INFINITE 0xFFFFFFFF
-
-//---------------------------------------------------------------------------
-// Mutex
-//---------------------------------------------------------------------------
-/** A Xiron mutex type. */
-struct XnMutex;
-typedef struct XnMutex* XN_MUTEX_HANDLE;
-
-//---------------------------------------------------------------------------
-// Critical Sections
-//---------------------------------------------------------------------------
-/** A Xiron critical sections type. */
-typedef XN_MUTEX_HANDLE XN_CRITICAL_SECTION_HANDLE;
-
-//---------------------------------------------------------------------------
-// Events
-//---------------------------------------------------------------------------
-/** A Xiron event type. */
-struct _XnEvent;
-typedef struct _XnEvent *XN_EVENT_HANDLE;
-
-//---------------------------------------------------------------------------
-// Semaphores
-//---------------------------------------------------------------------------
-/** A Xiron event type. */
-struct _XnSemaphore;
-typedef struct _XnSemaphore *XN_SEMAPHORE_HANDLE;
-
-//---------------------------------------------------------------------------
-// Timer
-//---------------------------------------------------------------------------
-/** The Xiron OS timer structure. */
-typedef struct XnOSTimer
-{
- XnUInt64 nStartTick;
-} XnOSTimer;
-
-//---------------------------------------------------------------------------
-// Network
-//---------------------------------------------------------------------------
-/** The network host name and port separator. */
-#define XN_NETWORK_HOST_PORT_SEP ":"
-
-//---------------------------------------------------------------------------
-// Swaps
-//---------------------------------------------------------------------------
-#define XN_PREPARE_VAR16_IN_BUFFER(var) (var)
-#define XN_PREPARE_VAR32_IN_BUFFER(var) (var)
-#define XN_PREPARE_VAR64_IN_BUFFER(var) (var)
-#define XN_PREPARE_VAR_FLOAT_IN_BUFFER(var) (var)
-
-#define XN_IMPLEMENT_OS \
- printf("Not Implemented: %s at %s(%u)\n", __FUNCTION__, __FILE__, __LINE__); \
- _brk();
-
-#endif //_XN_OSLINUX_X86_H_
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/ARC/XnPlatformARC.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/ARC/XnPlatformARC.h
deleted file mode 100644
index 01bebafe..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/ARC/XnPlatformARC.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef _XN_PLATFORM_ARC_H_
-#define _XN_PLATFORM_ARC_H_
-
-//---------------------------------------------------------------------------
-// Prerequisites
-//---------------------------------------------------------------------------
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
-//---------------------------------------------------------------------------
-// Platform Basic Definition
-//---------------------------------------------------------------------------
-#define XN_PLATFORM XN_PLATFORM_ARC
-#define XN_PLATFORM_STRING "ARC"
-
-//---------------------------------------------------------------------------
-// Platform Capabilities
-//---------------------------------------------------------------------------
-#define XN_PLATFORM_ENDIAN_TYPE XN_PLATFORM_IS_LITTLE_ENDIAN
-#define XN_PLATFORM_VAARGS_TYPE XN_PLATFORM_USE_ARC_VAARGS_STYLE
-#define XN_PLATFORM_SUPPORTS_DYNAMIC_LIBS 0
-
-//---------------------------------------------------------------------------
-// Basic Types
-//---------------------------------------------------------------------------
-/** Boolean TRUE/FALSE type. */
-typedef unsigned int XnBool;
-
-/** Signed character for strings. */
-typedef char XnChar;
-/** Unsigned character for strings. */
-typedef unsigned char XnUChar;
-
-/** Signed wide character for strings. */
-typedef wchar_t XnWChar;
-
-/** 8-bit signed integer. */
-typedef signed char XnInt8;
-/** 8-bit unsigned integer. */
-typedef unsigned char XnUInt8;
-
-/** 16-bit signed integer. */
-typedef short XnInt16;
-/** 16-bit unsigned integer. */
-typedef unsigned short XnUInt16;
-
-/** 32-bit signed integer. */
-typedef int XnInt32;
-/** 32-bit unsigned integer. */
-typedef unsigned int XnUInt32;
-
-/** 64-bit signed integer. */
-typedef long long XnInt64;
-/** 64-bit unsigned integer. */
-typedef unsigned long long XnUInt64;
-
-/** natural signed integer. */
-typedef int XnInt;
-/** natural unsigned integer. */
-typedef unsigned int XnUInt;
-
-/** Float (32bit) */
-typedef float XnFloat;
-/** Double (64bit) */
-typedef double XnDouble;
-
-/** Far procedures type (for shared libraries functions). */
-typedef void (*XnFarProc)(void *);
-
-/** Size type. */
-typedef size_t XnSizeT;
-
-/** Max unsigned 8-bit value */
-#define XN_MAX_UINT8 255
-/** Max unsigned 16-bit value */
-#define XN_MAX_UINT16 65535
-/** Max unsigned 32-bit value */
-#define XN_MAX_UINT32 4294967295UL
-/** Max unsigned 64-bit value */
-#define XN_MAX_UINT64 18446744073709551615ULL
-
-/** Min signed 8-bit value */
-#define XN_MIN_INT8 -128
-/** Min signed 16-bit value */
-#define XN_MIN_INT16 -32768
-/** Min signed 32-bit value */
-#define XN_MIN_INT32 -2147483648
-/** Min signed 64-bit value */
-#define XN_MIN_INT64 -9223372036854775808LL
-
-/** Max signed 8-bit value */
-#define XN_MAX_INT8 127
-/** Max signed 16-bit value */
-#define XN_MAX_INT16 32767
-/** Max signed 32-bit value */
-#define XN_MAX_INT32 2147483647
-/** Max signed 64-bit value */
-#define XN_MAX_INT64 9223372036854775807LL
-
-//---------------------------------------------------------------------------
-// Memory
-//---------------------------------------------------------------------------
-/** The default memory alignment. */
-#define XN_DEFAULT_MEM_ALIGN 16
-
-/** The thread static declarator (using TLS). */
-#define XN_THREAD_STATIC __declspec(thread)
-
-//---------------------------------------------------------------------------
-// Files
-//---------------------------------------------------------------------------
-/** The maximum allowed file path size (in bytes). */
-#define XN_FILE_MAX_PATH 256
-
-//---------------------------------------------------------------------------
-// Call back
-//---------------------------------------------------------------------------
-/** The std call type. */
-#define XN_STDCALL __stdcall
-
-/** The call back calling convention. */
-#define XN_CALLBACK_TYPE
-
-/** The C and C++ calling convension. */
-#define XN_C_DECL
-
-//---------------------------------------------------------------------------
-// Macros
-//---------------------------------------------------------------------------
-/** Returns the date and time at compile time. */
-#define XN_TIMESTAMP __DATE__ " " __TIME__
-
-/** Converts n into a pre-processor string. */
-#define XN_STRINGIFY(n) XN_STRINGIFY_HELPER(n)
-#define XN_STRINGIFY_HELPER(n) #n
-
-/** Asserts an expression, only on Debug build. */
-#define XN_ASSERT(x)
-
-//---------------------------------------------------------------------------
-// API Export/Import Macros
-//---------------------------------------------------------------------------
-/** Indicates an exported shared library function. */
-#define XN_API_EXPORT
-
-/** Indicates an imported shared library function. */
-#define XN_API_IMPORT
-
-/** Indicates a deprecated function */
-#define XN_API_DEPRECATED(msg)
-
-#define XN_DEPRECATED_WARNING_IDS
-#define XN_HIDES_PARENT_METHOD_WARNING_ID
-#define XN_CONDITION_IS_CONST_WARNING_ID
-#define XN_INHERITS_VIA_DOMINANCE_WARNING_ID
-#define XN_UNALIGNED_ADDRESS_WARNING_ID
-#define XN_STRUCT_PADDED_WARNING_ID
-
-#define XN_PRAGMA_START_DISABLED_WARNING_SECTION(warnings)
-#define XN_PRAGMA_STOP_DISABLED_WARNING_SECTION
-
-/** Declares a global shared library export function. */
-#define XN_API_EXPORT_INIT()
-
-#endif //_XN_PLATFORM_ARC_H_
-
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Android-Arm/XnPlatformAndroid-Arm.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Android-Arm/XnPlatformAndroid-Arm.h
deleted file mode 100644
index 948a47ea..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Android-Arm/XnPlatformAndroid-Arm.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef _XN_PLATFORM_ANDROID_ARM_H_
-#define _XN_PLATFORM_ANDROID_ARM_H_
-
-// Start with Linux-x86, and override what's different
-#include "../Linux-x86/XnPlatformLinux-x86.h"
-
-//---------------------------------------------------------------------------
-// Platform Basic Definition
-//---------------------------------------------------------------------------
-#undef XN_PLATFORM
-#undef XN_PLATFORM_STRING
-
-#define XN_PLATFORM XN_PLATFORM_ANDROID_ARM
-#define XN_PLATFORM_STRING "Android-Arm"
-
-#define XN_PLATFORM_HAS_NO_TIMED_OPS
-#define XN_PLATFORM_HAS_NO_CLOCK_GETTIME
-#define XN_PLATFORM_HAS_NO_SCHED_PARAM
-#define XN_PLATFORM_HAS_BUILTIN_SEMUN
-
-#define XN_PLATFORM_LINUX_NO_GLIBC
-#define XN_PLATFORM_LINUX_NO_SYSV
-#define XN_PLATFORM_LINUX_NO_GLOB
-#define XN_PLATFORM_LINUX_NO_POSIX_MEMALIGN
-#define XN_PLATFORM_LINUX_NO_SHM
-#define XN_PLATFORM_LINUX_NO_PTHREAD_CANCEL
-
-#endif //_XN_PLATFORM_LINUX_ARM_H_
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/IXnNodeAllocator.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/IXnNodeAllocator.h
deleted file mode 100644
index 1571e881..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/IXnNodeAllocator.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef _ININODEALLOCATOR_H
-#define _ININODEALLOCATOR_H
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-class XnNode;
-
-/**
- * Node Allocator - general interface for node allocation and deallocation.
- */
-class INiNodeAllocator
-{
-public:
- virtual ~INiNodeAllocator() {}
-
- /**
- * Allocate a new XnNode
- *
- * @return NULL if allocating a new node failed
- */
- virtual XnNode *Allocate() = 0;
-
- /**
- * Release an XnNode
- *
- * @param pNode [in] The node to deallocate
- */
- virtual void Deallocate(XnNode *pNode) = 0;
-};
-
-#endif //_ININODEALLOCATOR_H
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Linux-Arm/XnPlatformLinux-Arm.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Linux-Arm/XnPlatformLinux-Arm.h
deleted file mode 100644
index 877e4e72..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Linux-Arm/XnPlatformLinux-Arm.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef _XN_PLATFORM_LINUX_ARM_H_
-#define _XN_PLATFORM_LINUX_ARM_H_
-
-// Start with Linux-x86, and override what's different
-#include "../Linux-x86/XnPlatformLinux-x86.h"
-
-//---------------------------------------------------------------------------
-// Platform Basic Definition
-//---------------------------------------------------------------------------
-#undef XN_PLATFORM
-#undef XN_PLATFORM_STRING
-#define XN_PLATFORM XN_PLATFORM_LINUX_ARM
-#define XN_PLATFORM_STRING "Linux-Arm"
-
-#endif //_XN_PLATFORM_LINUX_ARM_H_
-
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Linux-x86/XnOSLinux-x86.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Linux-x86/XnOSLinux-x86.h
deleted file mode 100644
index 0cbd12fc..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Linux-x86/XnOSLinux-x86.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef _XN_OSLINUX_X86_H_
-#define _XN_OSLINUX_X86_H_
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <sys/types.h>
-#include <stdarg.h>
-#include <time.h>
-#include <pthread.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-//---------------------------------------------------------------------------
-// Files
-//---------------------------------------------------------------------------
-/** A generic handle type. */
-typedef void* XN_HANDLE;
-
-/** A file handle type. */
-typedef XnInt XN_FILE_HANDLE;
-
-/** The value of an invalid file handle. */
-#define XN_INVALID_FILE_HANDLE -1
-
-/** A string that specifies the current directory. */
-#define XN_FILE_LOCAL_DIR "./"
-
-/** The file directory separator. */
-#define XN_FILE_DIR_SEP "/"
-
-/** The file extension separator. */
-#define XN_FILE_EXT_SEP "."
-
-/** The file "all" wildcard. */
-#define XN_FILE_ALL_WILDCARD "*"
-
-/** The newline separation string. */
-#define XN_NEW_LINE_SEP "\n"
-
-//---------------------------------------------------------------------------
-// INI Files
-//---------------------------------------------------------------------------
-/** A string that specifies the extension of INI files. */
-#define XN_INI_FILE_EXT "ini"
-
-/** The maximum allowed INI string length (in bytes). */
-// Note: This must always be big enough to contain a 32-bit number!
-#define XN_INI_MAX_LEN 256
-
-//---------------------------------------------------------------------------
-// Shared Libraries
-//---------------------------------------------------------------------------
-/** A shared library handle type. */
-typedef void* XN_LIB_HANDLE;
-
-/** A string that specifies the prefix of shared library files. */
-#define XN_SHARED_LIBRARY_PREFIX "lib"
-
-/** A string that specifies the postfix of shared library files. */
-#define XN_SHARED_LIBRARY_POSTFIX ".so"
-
-//---------------------------------------------------------------------------
-// Threads
-//---------------------------------------------------------------------------
-/** A Xiron thread type. */
-typedef pthread_t* XN_THREAD_HANDLE;
-
-/** A Xiron thread ID. */
-typedef pthread_t XN_THREAD_ID;
-
-/** A Xiron process ID. */
-typedef pid_t XN_PROCESS_ID;
-
-/** The thread entry point function prototype. */
-typedef void* (*XN_THREAD_PROC_PROTO)(void* arg);
-
-/** The thread entry point function definition. */
-#define XN_THREAD_PROC void*
-
-/** The thread return function. */
-#define XN_THREAD_PROC_RETURN(ret) return((void*)ret)
-
-/** The thread passable data pointer type. */
-typedef void* XN_THREAD_PARAM;
-
-//---------------------------------------------------------------------------
-// Time Outs
-//---------------------------------------------------------------------------
-/** The mutex lock infinite timeout. */
-#define XN_WAIT_INFINITE 0xFFFFFFFF
-
-//---------------------------------------------------------------------------
-// Mutex
-//---------------------------------------------------------------------------
-/** A Xiron mutex type. */
-struct XnMutex;
-typedef struct XnMutex* XN_MUTEX_HANDLE;
-
-//---------------------------------------------------------------------------
-// Critical Sections
-//---------------------------------------------------------------------------
-/** A Xiron critical sections type. */
-typedef XN_MUTEX_HANDLE XN_CRITICAL_SECTION_HANDLE;
-
-//---------------------------------------------------------------------------
-// Events
-//---------------------------------------------------------------------------
-/** A Xiron event type. */
-struct _XnEvent;
-typedef struct _XnEvent _XnEvent, *XN_EVENT_HANDLE ;
-
-//---------------------------------------------------------------------------
-// Semaphores
-//---------------------------------------------------------------------------
-/** A Xiron event type. */
-struct _XnSemaphore;
-typedef struct _XnSemaphore *XN_SEMAPHORE_HANDLE;
-
-//---------------------------------------------------------------------------
-// Timer
-//---------------------------------------------------------------------------
-/** The Xiron OS timer structure. */
-typedef struct XnOSTimer
-{
- struct timespec tStartTime;
- XnBool bHighRes;
-} XnOSTimer;
-
-//---------------------------------------------------------------------------
-// Network
-//---------------------------------------------------------------------------
-/** The network host name and port separator. */
-#define XN_NETWORK_HOST_PORT_SEP ":"
-
-//---------------------------------------------------------------------------
-// Swaps
-//---------------------------------------------------------------------------
-#define XN_PREPARE_VAR16_IN_BUFFER(var) (var)
-#define XN_PREPARE_VAR32_IN_BUFFER(var) (var)
-#define XN_PREPARE_VAR64_IN_BUFFER(var) (var)
-#define XN_PREPARE_VAR_FLOAT_IN_BUFFER(var) (var)
-
-#endif //_XN_OSLINUX_X86_H_
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Linux-x86/XnPlatformLinux-x86.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Linux-x86/XnPlatformLinux-x86.h
deleted file mode 100644
index 1b91a388..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Linux-x86/XnPlatformLinux-x86.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef _XN_PLATFORM_LINUX_X86_H_
-#define _XN_PLATFORM_LINUX_X86_H_
-
-//---------------------------------------------------------------------------
-// Prerequisites
-//---------------------------------------------------------------------------
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <limits.h>
-
-//---------------------------------------------------------------------------
-// Platform Basic Definition
-//---------------------------------------------------------------------------
-#define XN_PLATFORM XN_PLATFORM_LINUX_X86
-#define XN_PLATFORM_STRING "Linux-x86"
-
-//---------------------------------------------------------------------------
-// Platform Capabilities
-//---------------------------------------------------------------------------
-#define XN_PLATFORM_ENDIAN_TYPE XN_PLATFORM_IS_LITTLE_ENDIAN
-#define XN_PLATFORM_VAARGS_TYPE XN_PLATFORM_USE_GCC_VAARGS_STYLE
-#define XN_PLATFORM_SUPPORTS_DYNAMIC_LIBS 1
-
-//---------------------------------------------------------------------------
-// Basic Types
-//---------------------------------------------------------------------------
-/** Boolean TRUE/FALSE type. */
-typedef unsigned int XnBool;
-
-/** Signed character for strings. */
-typedef char XnChar;
-/** Unsigned character for strings. */
-typedef unsigned char XnUChar;
-
-/** Signed wide character for strings. */
-typedef wchar_t XnWChar;
-
-/** 8-bit signed integer. */
-typedef signed char XnInt8;
-/** 8-bit unsigned integer. */
-typedef unsigned char XnUInt8;
-
-/** 16-bit signed integer. */
-typedef short XnInt16;
-/** 16-bit unsigned integer. */
-typedef unsigned short XnUInt16;
-
-/** 32-bit signed integer. */
-typedef int XnInt32;
-/** 32-bit unsigned integer. */
-typedef unsigned int XnUInt32;
-
-/** 64-bit signed integer. */
-typedef long long XnInt64;
-/** 64-bit unsigned integer. */
-typedef unsigned long long XnUInt64;
-
-/** natural signed integer. */
-typedef int XnInt;
-/** natural unsigned integer. */
-typedef unsigned int XnUInt;
-
-/** Float (32bit) */
-typedef float XnFloat;
-/** Double (64bit) */
-typedef double XnDouble;
-
-/** Far procedures type (for shared libraries functions). */
-typedef void (*XnFarProc)(void *);
-
-/** Size type. */
-typedef size_t XnSizeT;
-
-/** Max unsigned 8-bit value */
-#define XN_MAX_UINT8 UCHAR_MAX
-/** Max unsigned 16-bit value */
-#define XN_MAX_UINT16 USHRT_MAX
-/** Max unsigned 32-bit value */
-#define XN_MAX_UINT32 UINT_MAX
-/** Max unsigned 64-bit value */
-#define XN_MAX_UINT64 ULLONG_MAX
-
-/** Min signed 8-bit value */
-#define XN_MIN_INT8 SCHAR_MIN
-/** Min signed 16-bit value */
-#define XN_MIN_INT16 SHRT_MIN
-/** Min signed 32-bit value */
-#define XN_MIN_INT32 INT_MIN
-/** Min signed 64-bit value */
-#define XN_MIN_INT64 LLONG_MIN
-
-/** Max signed 8-bit value */
-#define XN_MAX_INT8 SCHAR_MAX
-/** Max signed 16-bit value */
-#define XN_MAX_INT16 SHRT_MAX
-/** Max signed 32-bit value */
-#define XN_MAX_INT32 INT_MAX
-/** Max signed 64-bit value */
-#define XN_MAX_INT64 LLONG_MAX
-
-//---------------------------------------------------------------------------
-// Memory
-//---------------------------------------------------------------------------
-/** The default memory alignment. */
-#define XN_DEFAULT_MEM_ALIGN 16
-
-/** The thread static declarator (using TLS). */
-#define XN_THREAD_STATIC __thread
-
-//---------------------------------------------------------------------------
-// Files
-//---------------------------------------------------------------------------
-/** The maximum allowed file path size (in bytes). */
-#define XN_FILE_MAX_PATH 256
-
-//---------------------------------------------------------------------------
-// Call back
-//---------------------------------------------------------------------------
-/** The std call type. */
-#define XN_STDCALL __stdcall
-
-/** The call back calling convention. */
-#define XN_CALLBACK_TYPE
-
-/** The C and C++ calling convension. */
-#define XN_C_DECL
-
-//---------------------------------------------------------------------------
-// Macros
-//---------------------------------------------------------------------------
-/** Returns the date and time at compile time. */
-#define XN_TIMESTAMP __DATE__ " " __TIME__
-
-/** Converts n into a pre-processor string. */
-#define XN_STRINGIFY(n) XN_STRINGIFY_HELPER(n)
-#define XN_STRINGIFY_HELPER(n) #n
-
-/** Asserts an expression, only on Debug build. */
-#define XN_ASSERT(x)
-
-//---------------------------------------------------------------------------
-// API Export/Import Macros
-//---------------------------------------------------------------------------
-/** Indicates an exported shared library function. */
-#define XN_API_EXPORT __attribute__ ((visibility("default")))
-
-/** Indicates an imported shared library function. */
-#define XN_API_IMPORT
-
-/** Indicates a deprecated function */
-#define XN_API_DEPRECATED(msg) __attribute__((warning("This function is deprecated: " msg)))
-
-#define XN_DEPRECATED_WARNING_IDS
-#define XN_HIDES_PARENT_METHOD_WARNING_ID
-#define XN_CONDITION_IS_CONST_WARNING_ID
-#define XN_INHERITS_VIA_DOMINANCE_WARNING_ID
-#define XN_UNALIGNED_ADDRESS_WARNING_ID
-#define XN_STRUCT_PADDED_WARNING_ID
-
-#define XN_PRAGMA_START_DISABLED_WARNING_SECTION(warnings)
-#define XN_PRAGMA_STOP_DISABLED_WARNING_SECTION
-
-/** Declares a global shared library export function. */
-#define XN_API_EXPORT_INIT()
-
-#endif //_XN_PLATFORM_LINUX_X86_H_
-
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/MacOSX/XnPlatformMacOSX.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/MacOSX/XnPlatformMacOSX.h
deleted file mode 100644
index cb46dd7d..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/MacOSX/XnPlatformMacOSX.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef _XN_PLATFORM_MACOSX_H_
-#define _XN_PLATFORM_MACOSX_H_
-
-// Start with Linux-x86, and override what's different
-#include "../Linux-x86/XnPlatformLinux-x86.h"
-
-#include <sys/time.h>
-
-#undef XN_PLATFORM
-#undef XN_PLATFORM_STRING
-#define XN_PLATFORM XN_PLATFORM_MACOSX
-#define XN_PLATFORM_STRING "MacOSX"
-
-#define XN_PLATFORM_HAS_NO_TIMED_OPS
-#define XN_PLATFORM_HAS_NO_CLOCK_GETTIME
-#define XN_PLATFORM_HAS_NO_SCHED_PARAM
-#define XN_PLATFORM_HAS_BUILTIN_SEMUN
-
-#undef XN_THREAD_STATIC
-#define XN_THREAD_STATIC
-
-#endif //_XN_PLATFORM_MACOSX_H_
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Win32/XnOSWin32.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Win32/XnOSWin32.h
deleted file mode 100644
index c821744d..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Win32/XnOSWin32.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef __XN_OS_WIN32_H__
-#define __XN_OS_WIN32_H__
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <XnPlatform.h>
-
-//---------------------------------------------------------------------------
-// Files
-//---------------------------------------------------------------------------
-/** A generic handle type. */
-typedef HANDLE XN_HANDLE;
-
-/** A file handle type. */
-typedef HANDLE XN_FILE_HANDLE;
-
-/** The value of an invalid file handle. */
-#define XN_INVALID_FILE_HANDLE INVALID_HANDLE_VALUE
-
-/** A string that specifies the current directory. */
-#define XN_FILE_LOCAL_DIR ".\\"
-
-/** The file directory separator. */
-#define XN_FILE_DIR_SEP "\\"
-
-/** The file extension separator. */
-#define XN_FILE_EXT_SEP "."
-
-/** The file "all" wildcard. */
-#define XN_FILE_ALL_WILDCARD "*"
-
-/** The newline separation string. */
-#define XN_NEW_LINE_SEP "\r\n"
-
-//---------------------------------------------------------------------------
-// INI Files
-//---------------------------------------------------------------------------
-/** A string that specifies the extension of INI files. */
-#define XN_INI_FILE_EXT "ini"
-
-/** The maximum allowed INI string length (in bytes). */
-// Note: This must always be big enough to contain a 32-bit number!
-#define XN_INI_MAX_LEN 256
-
-//---------------------------------------------------------------------------
-// Shared Libraries
-//---------------------------------------------------------------------------
-/** A shared library handle type. */
-typedef HMODULE XN_LIB_HANDLE;
-
-/** A string that specifies the prefix of shared library files. */
-#define XN_SHARED_LIBRARY_PREFIX ""
-
-/** A string that specifies the postfix of shared library files. */
-#define XN_SHARED_LIBRARY_POSTFIX ".dll"
-
-//---------------------------------------------------------------------------
-// Threads
-//---------------------------------------------------------------------------
-/** A Xiron thread type. */
-typedef HANDLE XN_THREAD_HANDLE;
-
-/** A Xiron thread ID. */
-typedef DWORD XN_THREAD_ID;
-
-/** A Xiron process ID. */
-typedef DWORD XN_PROCESS_ID;
-
-/** The thread entry point function prototype. */
-typedef LPTHREAD_START_ROUTINE XN_THREAD_PROC_PROTO;
-
-/** The thread entry point function definition. */
-#define XN_THREAD_PROC DWORD WINAPI
-
-/** The thread return function. */
-#define XN_THREAD_PROC_RETURN(ret) return(ret)
-
-/** The thread passable data pointer type. */
-typedef LPVOID XN_THREAD_PARAM;
-
-//---------------------------------------------------------------------------
-// Time Outs
-//---------------------------------------------------------------------------
-/** The mutex lock infinite timeout. */
-#define XN_WAIT_INFINITE INFINITE
-
-//---------------------------------------------------------------------------
-// Mutex
-//---------------------------------------------------------------------------
-/** A Xiron mutex type. */
-typedef HANDLE XN_MUTEX_HANDLE;
-
-//---------------------------------------------------------------------------
-// Critical Sections
-//---------------------------------------------------------------------------
-/** A Xiron critical sections type. */
-typedef CRITICAL_SECTION* XN_CRITICAL_SECTION_HANDLE;
-
-//---------------------------------------------------------------------------
-// Events
-//---------------------------------------------------------------------------
-/** A Xiron event type. */
-typedef HANDLE XN_EVENT_HANDLE;
-
-//---------------------------------------------------------------------------
-// Semaphores
-//---------------------------------------------------------------------------
-/** A Xiron semaphore type. */
-typedef HANDLE XN_SEMAPHORE_HANDLE;
-
-//---------------------------------------------------------------------------
-// Timer
-//---------------------------------------------------------------------------
-/** The Xiron OS timer structure. */
-typedef struct XnOSTimer
-{
- XnDouble dTicksPerTimeUnit;
- LARGE_INTEGER nStartTick;
-} XnOSTimer;
-
-//---------------------------------------------------------------------------
-// Network
-//---------------------------------------------------------------------------
-/** The network host name and port separator. */
-#define XN_NETWORK_HOST_PORT_SEP ":"
-
-//---------------------------------------------------------------------------
-// Swaps
-//---------------------------------------------------------------------------
-#define XN_PREPARE_VAR16_IN_BUFFER(var) (var)
-#define XN_PREPARE_VAR32_IN_BUFFER(var) (var)
-#define XN_PREPARE_VAR64_IN_BUFFER(var) (var)
-#define XN_PREPARE_VAR_FLOAT_IN_BUFFER(var) (var)
-
-#endif //__XN_OS_WIN32_H__ \ No newline at end of file
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Win32/XnPlatformWin32.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Win32/XnPlatformWin32.h
deleted file mode 100644
index efc26ead..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Win32/XnPlatformWin32.h
+++ /dev/null
@@ -1,255 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef _XN_PLATFORM_WIN32_H_
-#define _XN_PLATFORM_WIN32_H_
-
-//---------------------------------------------------------------------------
-// Prerequisites
-//---------------------------------------------------------------------------
-#ifndef WINVER // Allow use of features specific to Windows XP or later
- #define WINVER 0x0501
-#endif
-#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later
- #define _WIN32_WINNT 0x0501
-#endif
-#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later
- #define _WIN32_WINDOWS 0x0410
-#endif
-#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later
- #define _WIN32_IE 0x0600
-#endif
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
-
-// Undeprecate CRT functions
-#ifndef _CRT_SECURE_NO_DEPRECATE
- #define _CRT_SECURE_NO_DEPRECATE 1
-#endif
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <windows.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <malloc.h>
-#include <io.h>
-#include <time.h>
-#include <assert.h>
-#include <float.h>
-#include <crtdbg.h>
-
-//---------------------------------------------------------------------------
-// Platform Basic Definition
-//---------------------------------------------------------------------------
-#define XN_PLATFORM XN_PLATFORM_WIN32
-#define XN_PLATFORM_STRING "Win32"
-
-//---------------------------------------------------------------------------
-// Platform Capabilities
-//---------------------------------------------------------------------------
-#define XN_PLATFORM_ENDIAN_TYPE XN_PLATFORM_IS_LITTLE_ENDIAN
-
-#if _MSC_VER < 1400 // Before VS2005 there was no support for the vaargs macro...
- #define XN_PLATFORM_VAARGS_TYPE XN_PLATFORM_USE_NO_VAARGS
-#else
- #define XN_PLATFORM_VAARGS_TYPE XN_PLATFORM_USE_WIN32_VAARGS_STYLE
-#endif
-
-#define XN_PLATFORM_SUPPORTS_DYNAMIC_LIBS 1
-
-//---------------------------------------------------------------------------
-// Basic Types
-//---------------------------------------------------------------------------
-/** Boolean TRUE/FALSE type. */
-typedef BOOL XnBool;
-
-/** Signed character for strings. */
-typedef char XnChar;
-/** Unsigned character for strings. */
-typedef unsigned char XnUChar;
-
-/** Signed wide character for strings. */
-typedef wchar_t XnWChar;
-
-/** 8-bit signed integer. */
-typedef signed char XnInt8;
-/** 8-bit unsigned integer. */
-typedef unsigned char XnUInt8;
-
-/** 16-bit signed integer. */
-typedef short XnInt16;
-/** 16-bit unsigned integer. */
-typedef unsigned short XnUInt16;
-
-/** 32-bit signed integer. */
-typedef int XnInt32;
-/** 32-bit unsigned integer. */
-typedef unsigned int XnUInt32;
-
-/** 64-bit signed integer. */
-typedef __int64 XnInt64;
-/** 64-bit unsigned integer. */
-typedef unsigned __int64 XnUInt64;
-
-/** natural signed integer. */
-typedef int XnInt;
-/** natural unsigned integer. */
-typedef unsigned int XnUInt;
-
-/** Float (32bit) */
-typedef float XnFloat;
-/** Double (64bit) */
-typedef double XnDouble;
-
-/** Far procedures type (for shared libraries functions). */
-typedef FARPROC XnFarProc;
-
-/** Size type. */
-typedef size_t XnSizeT;
-
-/** Max unsigned 8-bit value */
-#define XN_MAX_UINT8 _UI8_MAX
-/** Max unsigned 16-bit value */
-#define XN_MAX_UINT16 _UI16_MAX
-/** Max unsigned 32-bit value */
-#define XN_MAX_UINT32 _UI32_MAX
-/** Max unsigned 64-bit value */
-#define XN_MAX_UINT64 _UI64_MAX
-
-/** Min signed 8-bit value */
-#define XN_MIN_INT8 _I8_MIN
-/** Min signed 16-bit value */
-#define XN_MIN_INT16 _I16_MIN
-/** Min signed 32-bit value */
-#define XN_MIN_INT32 _I32_MIN
-/** Min signed 64-bit value */
-#define XN_MIN_INT64 _I64_MIN
-
-/** Max signed 8-bit value */
-#define XN_MAX_INT8 _I8_MAX
-/** Max signed 16-bit value */
-#define XN_MAX_INT16 _I16_MAX
-/** Max signed 32-bit value */
-#define XN_MAX_INT32 _I32_MAX
-/** Max signed 64-bit value */
-#define XN_MAX_INT64 _I64_MAX
-
-/** Min double value */
-#define XN_MIN_DOUBLE DBL_MIN
-/** Max double value */
-#define XN_MAX_DOUBLE DBL_MAX
-
-//---------------------------------------------------------------------------
-// Memory
-//---------------------------------------------------------------------------
-/** The default memory alignment. */
-#define XN_DEFAULT_MEM_ALIGN 16
-
-/** The thread static declarator (using TLS). */
-#define XN_THREAD_STATIC __declspec(thread)
-
-//---------------------------------------------------------------------------
-// Files
-//---------------------------------------------------------------------------
-/** The maximum allowed file path size (in bytes). */
-#define XN_FILE_MAX_PATH MAX_PATH
-
-//---------------------------------------------------------------------------
-// Call backs
-//---------------------------------------------------------------------------
-/** The std call type. */
-#define XN_STDCALL __stdcall
-
-/** The call back calling convention. */
-#define XN_CALLBACK_TYPE XN_STDCALL
-
-/** The C and C++ calling convension. */
-#define XN_C_DECL __cdecl
-
-//---------------------------------------------------------------------------
-// Macros
-//---------------------------------------------------------------------------
-/** Returns the date and time at compile time. */
-#define XN_TIMESTAMP __DATE__ " " __TIME__
-
-/** Converts n into a pre-processor string. */
-#define XN_STRINGIFY(n) XN_STRINGIFY_HELPER(n)
-#define XN_STRINGIFY_HELPER(n) #n
-
-/** Asserts an expression, only on Debug build. */
-#define XN_ASSERT(x) _ASSERTE(x)
-
-//---------------------------------------------------------------------------
-// API Export/Import Macros
-//---------------------------------------------------------------------------
-/** Indicates an exported shared library function. */
-#define XN_API_EXPORT __declspec(dllexport)
-
-/** Indicates an imported shared library function. */
-#define XN_API_IMPORT __declspec(dllimport)
-
-/** Indicates a deprecated function */
-#if _MSC_VER < 1400 // Before VS2005 there was no support for declspec deprecated...
- #define XN_API_DEPRECATED(msg)
-#else
- #define XN_API_DEPRECATED(msg) __declspec(deprecated(msg))
-#endif
-
-#ifdef __INTEL_COMPILER
- #define XN_DEPRECATED_WARNING_IDS 1786
- #define XN_HIDES_PARENT_METHOD_WARNING_ID 1125
- #define XN_CONDITION_IS_CONST_WARNING_ID
- #define XN_INHERITS_VIA_DOMINANCE_WARNING_ID
- #define XN_UNALIGNED_ADDRESS_WARNING_ID
- #define XN_STRUCT_PADDED_WARNING_ID
-#else
- #define XN_DEPRECATED_WARNING_IDS 4995 4996
- #define XN_HIDES_PARENT_METHOD_WARNING_ID
- #define XN_CONDITION_IS_CONST_WARNING_ID 4127
- #define XN_INHERITS_VIA_DOMINANCE_WARNING_ID 4250
- #define XN_UNALIGNED_ADDRESS_WARNING_ID 4366
- #define XN_STRUCT_PADDED_WARNING_ID 4324
-#endif
-
-#define XN_PRAGMA_START_DISABLED_WARNING_SECTION(warnings) \
- __pragma(warning(push)) \
- __pragma(warning(disable: warnings))
-
-#define XN_PRAGMA_STOP_DISABLED_WARNING_SECTION \
- __pragma(warning(pop))
-
-/** Declares a global shared library export function. */
-#define XN_API_EXPORT_INIT() \
- BOOL APIENTRY DllMain (HMODULE /*hModule*/, DWORD nReasonForCall, LPVOID /*lpReserved*/) \
- { \
- switch (nReasonForCall) \
- { \
- case DLL_PROCESS_ATTACH: \
- case DLL_THREAD_ATTACH: \
- case DLL_THREAD_DETACH: \
- case DLL_PROCESS_DETACH: \
- break; \
- } \
- return TRUE; \
- }
-
-#endif //_XN_PLATFORM_WIN32_H_
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Win32/usb100.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Win32/usb100.h
deleted file mode 100644
index 63c87b58..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/Win32/usb100.h
+++ /dev/null
@@ -1,270 +0,0 @@
-#ifndef __USB100_H__
-#define __USB100_H__
-
-
-#include <PSHPACK1.H>
-
-
-//bmRequest.Dir
-#define BMREQUEST_HOST_TO_DEVICE 0
-#define BMREQUEST_DEVICE_TO_HOST 1
-
-//bmRequest.Type
-#define BMREQUEST_STANDARD 0
-#define BMREQUEST_CLASS 1
-#define BMREQUEST_VENDOR 2
-
-//bmRequest.Recipient
-#define BMREQUEST_TO_DEVICE 0
-#define BMREQUEST_TO_INTERFACE 1
-#define BMREQUEST_TO_ENDPOINT 2
-#define BMREQUEST_TO_OTHER 3
-
-
-#define MAXIMUM_USB_STRING_LENGTH 255
-
-// values for the bits returned by the USB GET_STATUS command
-#define USB_GETSTATUS_SELF_POWERED 0x01
-#define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED 0x02
-
-
-#define USB_DEVICE_DESCRIPTOR_TYPE 0x01
-#define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02
-#define USB_STRING_DESCRIPTOR_TYPE 0x03
-#define USB_INTERFACE_DESCRIPTOR_TYPE 0x04
-#define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
-
-// descriptor types defined by DWG documents
-#define USB_RESERVED_DESCRIPTOR_TYPE 0x06
-#define USB_CONFIG_POWER_DESCRIPTOR_TYPE 0x07
-#define USB_INTERFACE_POWER_DESCRIPTOR_TYPE 0x08
-
-#define USB_DESCRIPTOR_MAKE_TYPE_AND_INDEX(d, i) ((USHORT)((USHORT)d<<8 | i))
-
-//
-// Values for bmAttributes field of an
-// endpoint descriptor
-//
-
-#define USB_ENDPOINT_TYPE_MASK 0x03
-
-#define USB_ENDPOINT_TYPE_CONTROL 0x00
-#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01
-#define USB_ENDPOINT_TYPE_BULK 0x02
-#define USB_ENDPOINT_TYPE_INTERRUPT 0x03
-
-
-//
-// definitions for bits in the bmAttributes field of a
-// configuration descriptor.
-//
-#define USB_CONFIG_POWERED_MASK 0xc0
-
-#define USB_CONFIG_BUS_POWERED 0x80
-#define USB_CONFIG_SELF_POWERED 0x40
-#define USB_CONFIG_REMOTE_WAKEUP 0x20
-
-//
-// Endpoint direction bit, stored in address
-//
-
-#define USB_ENDPOINT_DIRECTION_MASK 0x80
-
-// test direction bit in the bEndpointAddress field of
-// an endpoint descriptor.
-#define USB_ENDPOINT_DIRECTION_OUT(addr) (!((addr) & USB_ENDPOINT_DIRECTION_MASK))
-#define USB_ENDPOINT_DIRECTION_IN(addr) ((addr) & USB_ENDPOINT_DIRECTION_MASK)
-
-//
-// USB defined request codes
-// see chapter 9 of the USB 1.0 specifcation for
-// more information.
-//
-
-// These are the correct values based on the USB 1.0
-// specification
-
-#define USB_REQUEST_GET_STATUS 0x00
-#define USB_REQUEST_CLEAR_FEATURE 0x01
-
-#define USB_REQUEST_SET_FEATURE 0x03
-
-#define USB_REQUEST_SET_ADDRESS 0x05
-#define USB_REQUEST_GET_DESCRIPTOR 0x06
-#define USB_REQUEST_SET_DESCRIPTOR 0x07
-#define USB_REQUEST_GET_CONFIGURATION 0x08
-#define USB_REQUEST_SET_CONFIGURATION 0x09
-#define USB_REQUEST_GET_INTERFACE 0x0A
-#define USB_REQUEST_SET_INTERFACE 0x0B
-#define USB_REQUEST_SYNC_FRAME 0x0C
-
-
-//
-// defined USB device classes
-//
-
-
-#define USB_DEVICE_CLASS_RESERVED 0x00
-#define USB_DEVICE_CLASS_AUDIO 0x01
-#define USB_DEVICE_CLASS_COMMUNICATIONS 0x02
-#define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03
-#define USB_DEVICE_CLASS_MONITOR 0x04
-#define USB_DEVICE_CLASS_PHYSICAL_INTERFACE 0x05
-#define USB_DEVICE_CLASS_POWER 0x06
-#define USB_DEVICE_CLASS_PRINTER 0x07
-#define USB_DEVICE_CLASS_STORAGE 0x08
-#define USB_DEVICE_CLASS_HUB 0x09
-#define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF
-
-//
-// USB Core defined Feature selectors
-//
-
-#define USB_FEATURE_ENDPOINT_STALL 0x0000
-#define USB_FEATURE_REMOTE_WAKEUP 0x0001
-
-//
-// USB DWG defined Feature selectors
-//
-
-#define USB_FEATURE_INTERFACE_POWER_D0 0x0002
-#define USB_FEATURE_INTERFACE_POWER_D1 0x0003
-#define USB_FEATURE_INTERFACE_POWER_D2 0x0004
-#define USB_FEATURE_INTERFACE_POWER_D3 0x0005
-
-typedef struct _USB_DEVICE_DESCRIPTOR {
- UCHAR bLength;
- UCHAR bDescriptorType;
- USHORT bcdUSB;
- UCHAR bDeviceClass;
- UCHAR bDeviceSubClass;
- UCHAR bDeviceProtocol;
- UCHAR bMaxPacketSize0;
- USHORT idVendor;
- USHORT idProduct;
- USHORT bcdDevice;
- UCHAR iManufacturer;
- UCHAR iProduct;
- UCHAR iSerialNumber;
- UCHAR bNumConfigurations;
-} USB_DEVICE_DESCRIPTOR, *PUSB_DEVICE_DESCRIPTOR;
-
-typedef struct _USB_ENDPOINT_DESCRIPTOR {
- UCHAR bLength;
- UCHAR bDescriptorType;
- UCHAR bEndpointAddress;
- UCHAR bmAttributes;
- USHORT wMaxPacketSize;
- UCHAR bInterval;
-} USB_ENDPOINT_DESCRIPTOR, *PUSB_ENDPOINT_DESCRIPTOR;
-
-typedef struct _USB_CONFIGURATION_DESCRIPTOR {
- UCHAR bLength;
- UCHAR bDescriptorType;
- USHORT wTotalLength;
- UCHAR bNumInterfaces;
- UCHAR bConfigurationValue;
- UCHAR iConfiguration;
- UCHAR bmAttributes;
- UCHAR MaxPower;
-} USB_CONFIGURATION_DESCRIPTOR, *PUSB_CONFIGURATION_DESCRIPTOR;
-
-typedef struct _USB_INTERFACE_DESCRIPTOR {
- UCHAR bLength;
- UCHAR bDescriptorType;
- UCHAR bInterfaceNumber;
- UCHAR bAlternateSetting;
- UCHAR bNumEndpoints;
- UCHAR bInterfaceClass;
- UCHAR bInterfaceSubClass;
- UCHAR bInterfaceProtocol;
- UCHAR iInterface;
-} USB_INTERFACE_DESCRIPTOR, *PUSB_INTERFACE_DESCRIPTOR;
-
-typedef struct _USB_STRING_DESCRIPTOR {
- UCHAR bLength;
- UCHAR bDescriptorType;
- WCHAR bString[1];
-} USB_STRING_DESCRIPTOR, *PUSB_STRING_DESCRIPTOR;
-
-typedef struct _USB_COMMON_DESCRIPTOR {
- UCHAR bLength;
- UCHAR bDescriptorType;
-} USB_COMMON_DESCRIPTOR, *PUSB_COMMON_DESCRIPTOR;
-
-
-//
-// Standard USB HUB definitions
-//
-// See Chapter 11 USB core specification
-//
-
-typedef struct _USB_HUB_DESCRIPTOR {
- UCHAR bDescriptorLength; // Length of this descriptor
- UCHAR bDescriptorType; // Hub configuration type
- UCHAR bNumberOfPorts; // number of ports on this hub
- USHORT wHubCharacteristics; // Hub Charateristics
- UCHAR bPowerOnToPowerGood; // port power on till power good in 2ms
- UCHAR bHubControlCurrent; // max current in mA
- //
- // room for 255 ports power control and removable bitmask
- UCHAR bRemoveAndPowerMask[64];
-} USB_HUB_DESCRIPTOR, *PUSB_HUB_DESCRIPTOR;
-
-
-//
-// Structures defined by various DWG feature documents
-//
-
-
-//
-// See DWG USB Feature Specification: Interface Power Management
-//
-
-#define USB_SUPPORT_D0_COMMAND 0x01
-#define USB_SUPPORT_D1_COMMAND 0x02
-#define USB_SUPPORT_D2_COMMAND 0x04
-#define USB_SUPPORT_D3_COMMAND 0x08
-
-#define USB_SUPPORT_D1_WAKEUP 0x10
-#define USB_SUPPORT_D2_WAKEUP 0x20
-
-
-typedef struct _USB_CONFIGURATION_POWER_DESCRIPTOR {
- UCHAR bLength;
- UCHAR bDescriptorType;
- UCHAR SelfPowerConsumedD0[3];
- UCHAR bPowerSummaryId;
- UCHAR bBusPowerSavingD1;
- UCHAR bSelfPowerSavingD1;
- UCHAR bBusPowerSavingD2;
- UCHAR bSelfPowerSavingD2;
- UCHAR bBusPowerSavingD3;
- UCHAR bSelfPowerSavingD3;
- USHORT TransitionTimeFromD1;
- USHORT TransitionTimeFromD2;
- USHORT TransitionTimeFromD3;
-} USB_CONFIGURATION_POWER_DESCRIPTOR, *PUSB_CONFIGURATION_POWER_DESCRIPTOR;
-
-
-typedef struct _USB_INTERFACE_POWER_DESCRIPTOR {
- UCHAR bLength;
- UCHAR bDescriptorType;
- UCHAR bmCapabilitiesFlags;
- UCHAR bBusPowerSavingD1;
- UCHAR bSelfPowerSavingD1;
- UCHAR bBusPowerSavingD2;
- UCHAR bSelfPowerSavingD2;
- UCHAR bBusPowerSavingD3;
- UCHAR bSelfPowerSavingD3;
- USHORT TransitionTimeFromD1;
- USHORT TransitionTimeFromD2;
- USHORT TransitionTimeFromD3;
-} USB_INTERFACE_POWER_DESCRIPTOR, *PUSB_INTERFACE_POWER_DESCRIPTOR;
-
-
-#include <POPPACK.H>
-
-
-#endif /* __USB100_H__ */
-
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnAlgorithms.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnAlgorithms.h
deleted file mode 100644
index a829bcbb..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnAlgorithms.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef __XN_ALGORITHMS_H__
-#define __XN_ALGORITHMS_H__
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <XnPlatform.h>
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-template<class T>
-XnBool DefaultComparer(const T& arg1, const T& arg2)
-{
- return arg1 < arg2;
-}
-
-class XnAlgorithms
-{
-public:
- template<class T, class Comparer>
- static void BubbleSort(T elements[], XnUInt32 nCount, Comparer comp)
- {
- XnUInt32 n = nCount;
- XnBool bSwapped;
- T temp;
-
- if (nCount == 0)
- return;
-
- do
- {
- bSwapped = FALSE;
- for (XnUInt32 i = 0; i < n - 1; ++i)
- {
- if (!comp(elements[i], elements[i+1]))
- {
- // swap
- temp = elements[i];
- elements[i] = elements[i+1];
- elements[i+1] = temp;
-
- bSwapped = TRUE;
- }
- }
-
- n -= 1;
-
- } while (bSwapped);
- }
-
- template<class T>
- static void BubbleSort(T elements[], XnUInt32 nCount)
- {
- BubbleSort(elements, nCount, DefaultComparer);
- }
-
-};
-
-#endif // __XN_ALGORITHMS_H__ \ No newline at end of file
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnArray.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnArray.h
deleted file mode 100644
index d90cff0c..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnArray.h
+++ /dev/null
@@ -1,313 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef __XNARRAY_H__
-#define __XNARRAY_H__
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <XnOS.h>
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-template <typename T>
-class XnArray
-{
-public:
- enum {BASE_SIZE = 8};
-
- /** An iterator object that allows you to iterate over members in the array. **/
- typedef T* Iterator;
-
- /** A constant iterator object that allows you to iterate over members in the array as read-only values. **/
- typedef const T* ConstIterator;
-
- /** Default constructor. Initializes the array to BASE_SIZE. **/
- XnArray(XnUInt32 nBaseSize = BASE_SIZE)
- {
- Init(nBaseSize);
- }
-
- /** Copy constructor. Initializes this array from another array of the same type. **/
- XnArray(const XnArray& other) : m_pData(NULL), m_nSize(0), m_nAllocatedSize(0)
- {
- *this = other;
- }
-
- /** Destructor. Deallocates data in this array. **/
- virtual ~XnArray()
- {
- XN_DELETE_ARR(m_pData);
- }
-
- /** Assignment operator. Copies data from another array of the same type. **/
- XnArray& operator=(const XnArray& other)
- {
- CopyFrom(other);
- return *this;
- }
-
- /** Copies data from another array of the same type. **/
- XnStatus CopyFrom(const XnArray& other)
- {
- if (this != &other)
- {
- XnStatus nRetVal = SetData(other.m_pData, other.m_nSize);
- XN_IS_STATUS_OK(nRetVal);
- }
- return XN_STATUS_OK;
- }
-
- /** Copies data from a raw buffer of the same type pointed to by pData, and sets size to nSize. **/
- XnStatus SetData(const T* pData, XnUInt32 nSize)
- {
- Clear();
- XnStatus nRetVal = SetSize(nSize);
- XN_IS_STATUS_OK(nRetVal);
- for (XnUInt32 i = 0; i < nSize; i++)
- {
- m_pData[i] = pData[i];
- }
- return XN_STATUS_OK;
- }
-
- /** @returns the raw data of this array as a read-only buffer. **/
- const T* GetData() const
- {
- return m_pData;
- }
-
- /** @returns the raw data of this array as a modifiable buffer. **/
- T* GetData()
- {
- return m_pData;
- }
-
- /** Reserves space in this array for the specified number of elements.
- This saves you re-allocations and data copies if you know the size in advance. **/
- XnStatus Reserve(XnUInt32 nReservedSize)
- {
- if (nReservedSize > m_nAllocatedSize)
- {
- //Calculate next power of 2 after nReservedSize
- nReservedSize--;
- nReservedSize = (nReservedSize >> 1) | nReservedSize;
- nReservedSize = (nReservedSize >> 2) | nReservedSize;
- nReservedSize = (nReservedSize >> 4) | nReservedSize;
- nReservedSize = (nReservedSize >> 8) | nReservedSize;
- nReservedSize = (nReservedSize >> 16) | nReservedSize;
- nReservedSize++; // nReservedSize is now the next power of 2.
-
- //Allocate new data
- T* pNewData = XN_NEW_ARR(T, nReservedSize);
- XN_VALIDATE_ALLOC_PTR(pNewData);
-
- //Copy old data into new data
- for (XnUInt32 i = 0; i < m_nSize; i++)
- {
- pNewData[i] = m_pData[i];
- }
-
- //Delete old data
- XN_DELETE_ARR(m_pData);
-
- //Point to new data
- m_pData = pNewData;
- m_nAllocatedSize = nReservedSize;
- }
- return XN_STATUS_OK;
- }
-
- /** @returns TRUE if this array is empty, FALSE otherwise. **/
- XnBool IsEmpty() const
- {
- return (m_nSize == 0);
- }
-
- /** @returns The number of elements in this array. **/
- XnUInt32 GetSize() const
- {
- return m_nSize;
- }
-
- /** Sets the size of this array to the specified number of elements.
- Note that for primitive types, the data is uninitialized. **/
- XnStatus SetSize(XnUInt32 nSize)
- {
- //TODO: Shrink allocated array if new size is smaller
- XnStatus nRetVal = SetMinSize(nSize);
- XN_IS_STATUS_OK(nRetVal);
- m_nSize = nSize;
- return XN_STATUS_OK;
- }
-
- /** Sets the size of this array to the specified number of elements, initializing all elements with the
- value specified by fillVal. **/
- XnStatus SetSize(XnUInt32 nSize, const T& fillVal)
- {
- //TODO: Shrink allocated array if new size is smaller
- XnStatus nRetVal = SetMinSize(nSize, fillVal);
- XN_IS_STATUS_OK(nRetVal);
- m_nSize = nSize;
- return XN_STATUS_OK;
- }
-
- /** Makes sure the array has at least nSize elements.
- If nSize is less than the current size, there is no effect.
- Note that for primitive types, any added elements are uninitialized. **/
- XnStatus SetMinSize(XnUInt32 nSize)
- {
- if (nSize > m_nSize)
- {
- XnStatus nRetVal = Reserve(nSize);
- XN_IS_STATUS_OK(nRetVal);
- m_nSize = nSize;
- }
- return XN_STATUS_OK;
- }
-
- /** Makes sure the array has at least nSize elements.
- If nSize is less than the current size, there is no effect.
- Any added elements are initialized by the value specified by fillVal. **/
- XnStatus SetMinSize(XnUInt32 nSize, const T& fillVal)
- {
- if (nSize > m_nSize)
- {
- XnStatus nRetVal = Reserve(nSize);
- XN_IS_STATUS_OK(nRetVal);
- for (XnUInt32 i = m_nSize; i < nSize; i++)
- {
- m_pData[i] = fillVal;
- }
- m_nSize = nSize;
- }
-
- return XN_STATUS_OK;
- }
-
- /** @returns The allocated size of this array. This is the maximum number of elements that the array can hold
- without re-allocating and copying data. **/
- XnUInt32 GetAllocatedSize() const
- {
- return m_nAllocatedSize;
- }
-
- /** Sets value at specified index, grows array if needed.
- Note that when dealing with primitive types and adding beyond the current size of the array,
- any added values that fill the gap are uninitialized**/
- XnStatus Set(XnUInt32 nIndex, const T& val)
- {
- XnStatus nRetVal = SetMinSize(nIndex+1);
- XN_IS_STATUS_OK(nRetVal);
- m_pData[nIndex] = val;
- return XN_STATUS_OK;
- }
-
- /** Sets value at specified index and grows array if needed, filling any resulting blank elements with fillVal. **/
- XnStatus Set(XnUInt32 nIndex, const T& val, const T& fillVal)
- {
- XnStatus nRetVal = SetMinSize(nIndex+1, fillVal);
- XN_IS_STATUS_OK(nRetVal);
- m_pData[nIndex] = val;
- return XN_STATUS_OK;
- }
-
- /** Adds one element to the end of this array. **/
- XnStatus AddLast(const T& val)
- {
- return Set(m_nSize, val);
- }
-
- /** Adds a range of values to the end of this array. **/
- XnStatus AddLast(const T* aValues, XnUInt32 nCount)
- {
- XN_VALIDATE_INPUT_PTR(aValues);
- XnUInt32 nOffset = GetSize();
- XnStatus nRetVal = SetMinSize(GetSize() + nCount);
- XN_IS_STATUS_OK(nRetVal);
- for (XnUInt32 i = 0; i < nCount; ++i)
- {
- m_pData[nOffset + i] = aValues[i];
- }
- return XN_STATUS_OK;
- }
-
- /** Resets the data of this array and sets its size to 0. **/
- void Clear()
- {
- XN_DELETE_ARR(m_pData);
- Init();
- }
-
- /** Element access operator. Returns a modifiable reference to the element at specified index. **/
- T& operator[](XnUInt32 nIndex)
- {
- XN_ASSERT(nIndex < m_nSize);
- return m_pData[nIndex];
- }
-
- /** Element access operator. Returns a const reference to the element at specified index. **/
- const T& operator[](XnUInt32 nIndex) const
- {
- XN_ASSERT(nIndex < m_nSize);
- return m_pData[nIndex];
- }
-
- /** @returns a modifiable iterator pointing to the beginning of this array. **/
- Iterator begin()
- {
- return &m_pData[0];
- }
-
- /** @returns a const iterator pointing to the beginning of this array. **/
- ConstIterator begin() const
- {
- return &m_pData[0];
- }
-
- /** @returns a modifiable itertor pointing to the end of this array. **/
- Iterator end()
- {
- return m_pData + m_nSize;
- }
-
- /** @returns a const itertor pointing to the end of this array. **/
- ConstIterator end() const
- {
- return m_pData + m_nSize;
- }
-
-private:
- void Init(XnUInt32 nBaseSize = BASE_SIZE)
- {
- m_pData = XN_NEW_ARR(T, nBaseSize);
- m_nAllocatedSize = nBaseSize;
- m_nSize = 0;
- }
-
- T* m_pData;
- XnUInt32 m_nSize;
- XnUInt32 m_nAllocatedSize;
-};
-
-#endif // __XNARRAY_H__ \ No newline at end of file
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnBaseNode.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnBaseNode.h
deleted file mode 100644
index a4df6c11..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnBaseNode.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef _NINODEALLOC_H
-#define _NINODEALLOC_H
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <XnDataTypes.h>
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-/**
- * The base of the building block of the data types - XnBaseNode
- */
-typedef struct XnBaseNode
-{
- /** the next XnNode */
- XnBaseNode* m_pNext;
- /** the previous XnNode */
- XnBaseNode* m_pPrevious;
- /** the value of the XnNode */
- XnValue m_Data;
-} XnBaseNode;
-
-//---------------------------------------------------------------------------
-// Exported Function Declaration
-//---------------------------------------------------------------------------
-/**
- * Provide an available xnBaseNode from the node pool.
- */
-XN_C_API XnBaseNode* XN_C_DECL xnAllocateBaseNode();
-
-/**
- * Release an xnBaseNode to the node pool.
- * @param pNode [in] The base node to return to the pool.
- */
-XN_C_API void XN_C_DECL xnDeallocateBaseNode(XnBaseNode* pNode);
-
-#endif //_NINODEALLOC_H
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnBitSet.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnBitSet.h
deleted file mode 100644
index 89ad6450..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnBitSet.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef __XNBITSET_H__
-#define __XNBITSET_H__
-
-#include <XnArray.h>
-
-class XnBitSet
-{
-public:
- XnBitSet() : m_nSize(0) {}
-
- /** Reserves space in this bitset for the specified number of bits.
- This saves you re-allocations and data copies if you know the size in advance. **/
- XnStatus Reserve(XnUInt32 nBits)
- {
- return m_array.Reserve((nBits >> 5) + 1);
- }
-
- /** Sets the size of the bitset to the specified number of bits and sets them all to 0. **/
- XnStatus SetSize(XnUInt32 nBits)
- {
- return m_array.SetSize((nBits >> 5) + 1, 0);
- }
-
- /** Sets the bit at nIndex to bValue. **/
- XnStatus Set(XnUInt32 nIndex, XnBool bValue)
- {
- XnUInt32 nArrayIndex = (nIndex >> 5);
- XnUInt32 nMask = (1 << ((~nIndex) & 0x1F));
- XnUInt32 nOldVal = nArrayIndex < m_array.GetSize() ? m_array[nArrayIndex] : 0;
- XnUInt32 nNewVal = bValue ? (nOldVal | nMask) : (nOldVal & (~nMask));
- XnStatus nRetVal = m_array.Set(nArrayIndex, nNewVal, 0);
- XN_IS_STATUS_OK(nRetVal);
- m_nSize = XN_MAX(m_nSize, nIndex + 1);
- return XN_STATUS_OK;
- }
-
- /** @returns the value of the bit specified by nIndex. **/
- XnBool IsSet(XnUInt32 nIndex) const
- {
- XnUInt32 nArrayIndex = (nIndex >> 5);
- if (nArrayIndex >= m_array.GetSize())
- {
- return FALSE;
- }
- return (m_array[nArrayIndex] & (1 << ((~nIndex) & 0x1F))) ? TRUE : FALSE;
- }
-
- /** Copies raw data from a buffer of dwords to this bitset. **/
- XnStatus SetData(const XnUInt32* pData, XnUInt32 nSizeInDwords)
- {
- XnStatus nRetVal = m_array.SetData(pData, nSizeInDwords);
- XN_IS_STATUS_OK(nRetVal);
- m_nSize = (nSizeInDwords << 5);
- return XN_STATUS_OK;
- }
-
- /** Copies raw data from a buffer of bytes to this bitset. **/
- XnStatus SetDataBytes(const XnUInt8* pData, XnUInt32 nSizeInBytes)
- {
- //XnStatus nRetVal = m_array.SetData(reinterpret_cast<const XnUInt32*>(pData), XN_MAX(1, nSizeInBytes >> 2));
- XnUInt32 nSizeInDwords = XN_MAX(1, nSizeInBytes >> 2);
- XnStatus nRetVal = m_array.SetSize(nSizeInDwords);
- XN_IS_STATUS_OK(nRetVal);
- for (XnUInt32 nDwordIdx = 0, nByteIdx = 0; nDwordIdx < nSizeInDwords; nDwordIdx++, nByteIdx += 4)
- {
- m_array[nDwordIdx] = ((pData[nByteIdx] << 24) | (pData[nByteIdx + 1] << 16) | (pData[nByteIdx + 2] << 8) | pData[nByteIdx + 3] );
- }
- m_nSize = (nSizeInBytes << 3);
- return XN_STATUS_OK;
- }
-
- /** @returns The raw data of this bitset as a buffer of dwords. **/
- const XnUInt32* GetData() const
- {
- return m_array.GetData();
- }
-
- /** @returns The raw data of this bitset as a buffer of dwords. Allows modification of underlying data. **/
- XnUInt32* GetData()
- {
- return m_array.GetData();
- }
-
- /** @returns size in bytes of this bitset. **/
- XnUInt32 GetDataSize() const
- {
- return m_array.GetSize();
- }
-
- /** @returns size in bits of this bitset. **/
- XnUInt32 GetSize() const
- {
- return m_nSize;
- }
-
- /** Clears data in this bitset and sets size to 0. **/
- void Clear()
- {
- m_array.Clear();
- m_nSize = 0;
- }
-
- /** @returns TRUE if this bitset is empty, FALSE otherwise. **/
- XnBool IsEmpty() const
- {
- return m_array.IsEmpty();
- }
-
-private:
- XnArray<XnUInt32> m_array;
- XnUInt32 m_nSize;
-};
-
-#endif // __XNBITSET_H__ \ No newline at end of file
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCallback.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCallback.h
deleted file mode 100644
index 4d2418c8..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCallback.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef __XN_CALLBACK_H__
-#define __XN_CALLBACK_H__
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-/**
-* Holds a pair of function pointer and user cookie to be used as callbacks.
-*/
-struct XnCallback
-{
- XnCallback() : pFuncPtr(NULL), pCookie(NULL) {}
- XnCallback(XnFuncPtr pFuncPtr, void* pCookie) : pFuncPtr(pFuncPtr), pCookie(pCookie) {}
- void Set(XnFuncPtr pFuncPtr, void* pCookie) { this->pFuncPtr = pFuncPtr; this->pCookie = pCookie; }
-
- XnFuncPtr pFuncPtr;
- void* pCookie;
-};
-
-#endif //__XN_CALLBACK_H__
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCodecIDs.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCodecIDs.h
deleted file mode 100644
index f90025d0..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCodecIDs.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef __NICODECIDS_H__
-#define __NICODECIDS_H__
-
-#include "XnTypes.h"
-
-#define XN_CODEC_NULL XN_CODEC_ID(0, 0, 0, 0)
-#define XN_CODEC_UNCOMPRESSED XN_CODEC_ID('N','O','N','E')
-#define XN_CODEC_JPEG XN_CODEC_ID('J','P','E','G')
-#define XN_CODEC_16Z XN_CODEC_ID('1','6','z','P')
-#define XN_CODEC_16Z_EMB_TABLES XN_CODEC_ID('1','6','z','T')
-#define XN_CODEC_8Z XN_CODEC_ID('I','m','8','z')
-
-#endif // __NICODECIDS_H__
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnContext.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnContext.h
deleted file mode 100644
index fb6414c4..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnContext.h
+++ /dev/null
@@ -1,569 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef __XN_CONTEXT_H__
-#define __XN_CONTEXT_H__
-
-/**
- * @ingroup cref
- * @defgroup context Context
- * This page details functions for managing an OpenNI context.
- *
- * @section init Initializing and Deinitializing OpenNI Context
- *
- * Initialization must be performed before using any OpenNI functionality, and similarly you
- * must not call any OpenNI functions after deinitialization.
- *
- * @section trees Enumerating and Creating Production Trees
- *
- * A production tree is composed of a production node, and optionally a list of other
- * production trees needed for this production node. Each production node has a type (one of
- * the types defined by OpenNI spec), a vendor name, and a specific name (unique for this type
- * and vendor), with a version.
- * For example, a User generator may need a Depth generator, which in turn might need a Device node.
- *
- * @subsection results Enumeration Results
- *
- * The results from an enumeration operation is a pointer to the first node of a linked list, representing
- * all the different possibilities to get data of the requested type. A single possibility contains
- * the provider description, an optional instance name (that can be used by the provider as proprietary
- * information, like a device S/N), and the bExists field, which tells if this node already exists in
- * the context (and as such, doesn't need to be created) or not, and a list of needed nodes by this node.
- *
- * @subsection enumex Enumerating Example
- *
- * For example, let's take a look at an application in need of depth maps:
- * @code
-// Enumerate for production trees that can produce depth
-XnNodeInfoList* pNodesList;
-nRetVal = xnEnumerateProductionTrees(pNiteCtx, XN_NODE_TYPE_DEPTH, NULL, &pNodesList);
-CHECK_RC(nRetVal, "Enumerate");
-
-// choose a tree (for simplicity, take first one)
-XnNodeInfoListIterator itChosen = xnNodeInfoListGetFirst(pNodesList);
-XnNodeInfo* pChosen = xnNodeInfoListGetCurrent(itChosen);
-
-// create first one
-XnNodeHandle hDepth;
-nRetVal = xnCreateProductionTree(pNiteCtx, pChosen, &hDepth);
-CHECK_RC(nRetVal, "Create");
-
-// free the list (it is no longer needed)
-xnNodeInfoListFree(pNodesList);
-
-// TODO: use handle for configuration and data extraction
- * @endcode
- *
- * @{
-*/
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <XnTypes.h>
-#include <XnQueries.h>
-#include <XnPrdNodeInfoList.h>
-
-//---------------------------------------------------------------------------
-// Functions
-//---------------------------------------------------------------------------
-
-/** @name Initialization
- * Functions for initializing and shutting down an OpenNI context.
- * @{
- */
-
-/**
- * @brief Initializes the OpenNI library.
- *
- * This function must be called before calling any other OpenNI function (except for @ref xnInitFromXmlFile())
- *
- * @param ppContext [out] Output location for context pointer.
- */
-XN_C_API XnStatus XN_C_DECL xnInit(XnContext** ppContext);
-
-/**
- * @brief Runs an XML script in the given context.
- *
- * @param pContext [in] The context to be configured.
- * @param strFileName [in] The name of the file containing the script. for a full description of the XML structure, see @ref xmlscripts.
- * @param pErrors [in/out] Optional. If provided, will be filled with enumeration errors.
- * @param phScriptNode [out] Handle to a node holding all the nodes created from the script. When no longer
- * needed, the node can be released, causing all those nodes to dec ref.
- */
-XN_C_API XnStatus XN_C_DECL xnContextRunXmlScriptFromFileEx(XnContext* pContext, const XnChar* strFileName, XnEnumerationErrors* pErrors, XnNodeHandle* phScriptNode);
-
-/**
- * @brief Runs an XML script in the given context.
- * NOTE: when using this function, the context will be the owner of the created nodes, so those nodes and
- * the context will only be destroyed if calling @ref xnShutdown(). It is highly suggested to use
- * @ref xnContextRunXmlScriptFromFileEx() instead, which returns a node referencing created nodes, making the caller
- * owner of those nodes.
- *
- * @param pContext [in] The context to be configured.
- * @param strFileName [in] The name of the file containing the script. for a full description of the XML structure, see @ref xmlscripts.
- * @param pErrors [in/out] Optional. If provided, will be filled with enumeration errors.
- */
-XN_C_API XnStatus XN_API_DEPRECATED("Please use xnContextRunXmlScriptFromFileEx() instead") xnContextRunXmlScriptFromFile(XnContext* pContext, const XnChar* strFileName, XnEnumerationErrors* pErrors);
-
-/**
- * @brief Runs an XML script in the given context.
- *
- * @param pContext [in] The context.
- * @param xmlScript [in] A string representation of the XML script. for a full description of the XML structure, see @ref xmlscripts.
- * @param pErrors [in/out] Optional. If provided, will be filled with enumeration errors.
- * @param phScriptNode [out] Handle to a node holding all the nodes created from the script. When no longer
- * needed, the node can be released, causing all those nodes to dec ref.
- */
-XN_C_API XnStatus XN_C_DECL xnContextRunXmlScriptEx(XnContext* pContext, const XnChar* xmlScript, XnEnumerationErrors* pErrors, XnNodeHandle* phScriptNode);
-
-/**
- * @brief Runs an XML script in the given context.
- * NOTE: when using this function, the context will be the owner of the created nodes, so those nodes and
- * the context will only be destroyed if calling @ref xnShutdown(). It is highly suggested to use
- * @ref xnContextRunXmlScriptEx() instead, which returns a node referencing created nodes, making the caller
- * owner of those nodes.
- *
- * @param pContext [in] The context.
- * @param xmlScript [in] A string representation of the XML script. for a full description of the XML structure, see @ref xmlscripts.
- * @param pErrors [in/out] Optional. If provided, will be filled with enumeration errors.
- */
-XN_C_API XnStatus XN_API_DEPRECATED("Please use xnContextRunXmlScriptEx() instead") XN_C_DECL xnContextRunXmlScript(XnContext* pContext, const XnChar* xmlScript, XnEnumerationErrors* pErrors);
-
-/**
- * @brief Initializes OpenNI context, and then configures it using the given file.
- *
- * @param strFileName [in] The name of the file to read configuration from.
- * @param ppContext [out] Output location for context pointer.
- * @param pErrors [in/out] Optional. If provided, will be filled with enumeration errors.
- * @param phScriptNode [out] Handle to a node holding all the nodes created from the script. When no longer
- * needed, the node can be released, causing all those nodes to dec ref.
- */
-XN_C_API XnStatus XN_C_DECL xnInitFromXmlFileEx(const XnChar* strFileName, XnContext** ppContext, XnEnumerationErrors* pErrors, XnNodeHandle* phScriptNode);
-
-/**
- * @brief Initializes OpenNI context, and then configures it using the given file.
- * NOTE: when using this function, the context will be the owner of the created nodes, so those nodes and
- * the context will only be destroyed if calling @ref xnShutdown(). It is highly suggested to use
- * @ref xnInitFromXmlFileEx() instead, which returns a node referencing created nodes, making the caller
- * owner of those nodes.
- *
- * @param strFileName [in] The name of the file to read configuration from.
- * @param ppContext [out] Output location for context pointer.
- * @param pErrors [in/out] Optional. If provided, will be filled with enumeration errors.
- */
-XN_C_API XnStatus XN_API_DEPRECATED("Please use xnInitFromXmlFileEx() instead") XN_C_DECL xnInitFromXmlFile(const XnChar* strFileName, XnContext** ppContext, XnEnumerationErrors* pErrors);
-
-/**
- * @brief Opens a recording file, adding all nodes in it to the context.
- *
- * @param pContext [in] The context.
- * @param strFileName [in] The file to open.
- * @param phPlayerNode [out] The created player node.
- */
-XN_C_API XnStatus XN_C_DECL xnContextOpenFileRecordingEx(XnContext* pContext, const XnChar* strFileName, XnNodeHandle* phPlayerNode);
-
-/**
- * @brief Opens a recording file, adding all nodes in it to the context.
- * NOTE: when using this function, the context will be the owner of the created player node, so this nodes and
- * the context will only be destroyed if calling @ref xnShutdown(). It is highly suggested to use
- * @ref xnContextOpenFileRecordingEx() instead, which returns the player node, making the caller
- * owner of this node.
- *
- * @param pContext [in] The context.
- * @param strFileName [in] The file to open.
- */
-XN_C_API XnStatus XN_API_DEPRECATED("Please use xnContextOpenFileRecordingEx() instead") XN_C_DECL xnContextOpenFileRecording(XnContext* pContext, const XnChar* strFileName);
-
-/**
- * @brief Adds a reference to the context object.
- *
- * @param pContext [in] The context.
- */
-XN_C_API XnStatus XN_C_DECL xnContextAddRef(XnContext* pContext);
-
-/**
- * @brief Releases a context object, decreasing its ref count by 1. If reference count has reached 0,
- * the context will be destroyed.
- *
- * @param pContext [in] The context.
- */
-XN_C_API void XN_C_DECL xnContextRelease(XnContext* pContext);
-
-/**
- * @brief Shuts down an OpenNI context, destroying all its nodes. Do not call any function of this
- * context or any correlated node after calling this method.
- * NOTE: this function destroys the context and all the nodes it holds and so should be used very carefully.
- * Normally you should just call @ref xnContextRelease()
- *
- * @param pContext [in] The context to be destroyed.
- */
-XN_C_API void XN_API_DEPRECATED("Use xnContextRelease() instead") XN_C_DECL xnShutdown(XnContext* pContext);
-
-/**
- * @brief Forces a context to shutdown, destroying all nodes. This function is used for backwards compatibility
- * and should not be called by any client. Please use @ref xnContextRelease() instead.
- *
- * @param pContext [in] The context to be destroyed.
- */
-XN_C_API void XN_C_DECL xnForceShutdown(XnContext* pContext);
-
-/**
- * @brief Registers for context shutting down event. This function is used for backwards compatibility and
- * should not be called by any client.
- */
-XN_C_API XnStatus XN_C_DECL xnContextRegisterForShutdown(XnContext* pContext, XnContextShuttingDownHandler pHandler, void* pCookie, XnCallbackHandle* phCallback);
-
-/**
- * @brief Unregisters from context shutting down event. This function is used for backwards compatibility and
- * should not be called by any client.
- */
-XN_C_API void XN_C_DECL xnContextUnregisterFromShutdown(XnContext* pContext, XnCallbackHandle hCallback);
-
-// @}
-
-/** @name Enumeration
- * Functions for enumeration and creation of nodes.
- * @{
- */
-
-/**
- * @brief Enumerates all available production trees for a specific node type. The trees populated in the
- * list should be freed by calling @ref xnNodeInfoListFree() once not needed.
- *
- * @param pContext [in] OpenNI context.
- * @param Type [in] The requested node type.
- * @param pQuery [in] Optional. A query object that can be used to filter results.
- * @param ppTreesList [out] A list of possible production trees.
- * @param pErrors [in/out] Optional. If provided, will be filled with enumeration errors.
- */
-XN_C_API XnStatus XN_C_DECL xnEnumerateProductionTrees(
- XnContext* pContext,
- XnProductionNodeType Type,
- const XnNodeQuery* pQuery,
- XnNodeInfoList** ppTreesList,
- XnEnumerationErrors* pErrors
- );
-
-/**
- * @brief Creates a production node. If the tree specifies additional needed nodes, and those nodes
- * do not exist, they will be created too, and passed to this node as input.
- *
- * @param pContext [in] OpenNI context.
- * @param pTree [in] A production tree to create.
- * @param phNode [out] A handle to the newly created node.
- */
-XN_C_API XnStatus XN_C_DECL xnCreateProductionTree(
- XnContext* pContext,
- XnNodeInfo* pTree,
- XnNodeHandle* phNode
- );
-
-/**
- * @brief Enumerates for production trees for a specific node type, and creates the first found tree.
- * This function is a shortcut version for using @ref xnEnumerateProductionTrees(), iterating the list,
- * and then calling @ref xnCreateProductionTree().
- *
- * @param pContext [in] OpenNI context.
- * @param type [in] The requested node type.
- * @param pQuery [in] Optional. A query object that can be used to filter results.
- * @param phNode [out] A handle to the newly created node.
- * @param pErrors [in/out] Optional. If provided, will be filled with enumeration errors.
- */
-XN_C_API XnStatus XN_C_DECL xnCreateAnyProductionTree(
- XnContext* pContext,
- XnProductionNodeType type,
- XnNodeQuery* pQuery,
- XnNodeHandle* phNode,
- XnEnumerationErrors* pErrors
- );
-
-/**
- * @brief Creates a production node which is only a mock. This node does not represent an actual node, but only
- * keeps a state and implements an interface above it.
- * Mock nodes are useful when simulating nodes for playing recordings, or for use in tests.
- * See also @ref xnCreateMockNodeBasedOn().
- *
- * @param pContext [in] OpenNI context.
- * @param type [in] The type of the mock to create.
- * @param strName [in] Optional. The name of the node. If NULL is provided, a name will be automatically generated.
- * @param phNode [out] A handle to the newly created node.
- */
-XN_C_API XnStatus XN_C_DECL xnCreateMockNode(
- XnContext* pContext,
- XnProductionNodeType type,
- const XnChar* strName,
- XnNodeHandle* phNode
- );
-
-/**
- * @brief Creates a production node which is only a mock, base on the type and properties of another node.
- * This node does not represent an actual node, but only keeps a state and implements an interface above it.
- * Mock nodes are useful when simulating nodes for playing recordings, or for use in tests.
- * See also @ref xnCreateMockNode().
- *
- * @param pContext [in] OpenNI context.
- * @param hOriginalNode [in] A handle to an existing node on which the mock node will be based on.
- * @param strName [in] The name of the node. If set to NULL, a name will be generated based on the name of hOriginalNode.
- * @param phMockNode [out] A handle to the newly created mock node.
- */
-XN_C_API XnStatus XN_C_DECL xnCreateMockNodeBasedOn(
- XnContext* pContext,
- XnNodeHandle hOriginalNode,
- const XnChar* strName,
- XnNodeHandle* phMockNode
- );
-
-/**
- * @brief References a production node, increasing its reference count by 1.
- *
- * @param hNode [in] A handle to the node.
- */
-XN_C_API XnStatus XN_C_DECL xnProductionNodeAddRef(XnNodeHandle hNode);
-
-/**
- * References a production node, increasing its reference count by 1.
- * Note: this function is deprecated. Please use @ref xnProductionNodeAddRef() instead.
- *
- * @param hNode [in] A handle to the node.
- */
-XN_C_API XnStatus XN_API_DEPRECATED("Please use xnProductionNodeAddRef() instead.") XN_C_DECL xnRefProductionNode(XnNodeHandle hNode);
-
-/**
- * @brief Unreference a production node, decreasing its reference count by 1. If the reference count reaches zero,
- * the node will be destroyed.
- *
- * @param hNode [in] A handle to the node.
- */
-XN_C_API void XN_C_DECL xnProductionNodeRelease(XnNodeHandle hNode);
-
-/**
- * Unreference a production node, decreasing its reference count by 1. If the reference count reaches zero,
- * the node will be destroyed.
- * Note: this function is deprecated. Please use @ref xnProductionNodeAddRef() instead.
- *
- * @param hNode [in] A handle to the node.
- */
-XN_C_API void XN_API_DEPRECATED("Please use xnProductionNodeRelease() instead.") XN_C_DECL xnUnrefProductionNode(XnNodeHandle hNode);
-
-/**
- * @brief Gets a list of all existing node in the context. Each node that was returned increases its ref count.
- * The list must be freed using @ref xnNodeInfoListFree().
- *
- * @param pContext [in] OpenNI context.
- * @param ppList [out] A linked list of current existing nodes
- */
-XN_C_API XnStatus XN_C_DECL xnEnumerateExistingNodes(XnContext* pContext, XnNodeInfoList** ppList);
-
-/**
- * @brief Gets a list of all existing node in the context. Each node that was returned increases its ref count.
- * The list must be freed using @ref xnNodeInfoListFree().
- *
- * @param pContext [in] OpenNI context.
- * @param type [in] Type to look for.
- * @param ppList [out] A linked list of current existing nodes
- */
-XN_C_API XnStatus XN_C_DECL xnEnumerateExistingNodesByType(XnContext* pContext, XnProductionNodeType type, XnNodeInfoList** ppList);
-
-/**
- * @brief Returns the first found existing node of the specified type.
- *
- * @param pContext [in] OpenNI context.
- * @param type [in] Type to look for.
- * @param phNode [out] A handle to the found node.
- */
-XN_C_API XnStatus XN_C_DECL xnFindExistingRefNodeByType(
- XnContext* pContext,
- XnProductionNodeType type,
- XnNodeHandle* phNode
- );
-
-XN_C_API XnStatus XN_API_DEPRECATED("Please use xnFindExistingRefNodeByType() instead") XN_C_DECL xnFindExistingNodeByType(
- XnContext* pContext,
- XnProductionNodeType type,
- XnNodeHandle* phNode
- );
-
-/**
- * @brief Gets a handle to an existing production node instance using that instance name.
- *
- * @param pContext [in] OpenNI context.
- * @param strInstanceName [in] Name of the instance to get.
- * @param phNode [out] A handle to that instance.
- *
- * @return XN_STATUS_BAD_NODE_NAME if node by name of strInstanceName doesn't exist.
- */
-XN_C_API XnStatus XN_C_DECL xnGetRefNodeHandleByName(
- XnContext* pContext,
- const XnChar* strInstanceName,
- XnNodeHandle* phNode
- );
-
-XN_C_API XnStatus XN_API_DEPRECATED("Please use xnGetRefNodeHandleByName() instead") XN_C_DECL xnGetNodeHandleByName(
- XnContext* pContext,
- const XnChar* strInstanceName,
- XnNodeHandle* phNode
- );
-
-// @}
-
-/** @name Multi-Node Handling
- * Functions that affect all the nodes in the context.
- * @{
- */
-
-/**
- * @brief Updates all generators nodes in the context, waiting for all to have new data.
- *
- * @param pContext [in] OpenNI context.
- */
-XN_C_API XnStatus XN_C_DECL xnWaitAndUpdateAll(XnContext* pContext);
-
-/**
- * @brief Updates all generators nodes in the context, waiting for a specific one to have new data.
- *
- * @param pContext [in] OpenNI context.
- * @param hNode [in] The node to wait for.
- */
-XN_C_API XnStatus XN_C_DECL xnWaitOneUpdateAll(XnContext* pContext, XnNodeHandle hNode);
-
-/**
- * @brief Updates all generators nodes in the context, once any of them have new data.
- *
- * @param pContext [in] OpenNI context.
- */
-XN_C_API XnStatus XN_C_DECL xnWaitAnyUpdateAll(XnContext* pContext);
-
-/**
- * @brief Updates all generator nodes in the context, without any waiting. If a node has new data,
- * it will be updated.
- *
- * @param pContext [in] OpenNI context.
- */
-XN_C_API XnStatus XN_C_DECL xnWaitNoneUpdateAll(XnContext* pContext);
-
-/**
- * @brief Make sure all generators are generating data.
- *
- * @param pContext [in] OpenNI context.
- */
-XN_C_API XnStatus XN_C_DECL xnStartGeneratingAll(XnContext* pContext);
-
-/**
- * @brief Stop all generators from generating data.
- *
- * @param pContext [in] OpenNI context.
- */
-XN_C_API XnStatus XN_C_DECL xnStopGeneratingAll(XnContext* pContext);
-
-/**
- * @brief Sets the global mirror flag. This will set all current existing nodes' mirror state, and also
- * affect future created nodes. The default mirror flag is FALSE.
- *
- * @param pContext [in] OpenNI context.
- * @param bMirror [in] New Mirror state.
- */
-XN_C_API XnStatus XN_C_DECL xnSetGlobalMirror(XnContext* pContext, XnBool bMirror);
-
-/**
- * @brief Gets the global mirror flag.
- *
- * @param pContext [in] OpenNI context.
- */
-XN_C_API XnBool XN_C_DECL xnGetGlobalMirror(XnContext* pContext);
-
-/**
- * @brief Gets the global error state of the context. If one of the nodes in the context is in error state,
- * that state will be returned. If more than one node is in error state, XN_STATUS_MULTIPLE_NODES_ERROR
- * is returned. An application can query each node error state by calling @ref xnGetNodeErrorState().
- *
- * @param pContext [in] OpenNI context.
- */
-XN_C_API XnStatus XN_C_DECL xnGetGlobalErrorState(XnContext* pContext);
-
-/**
- * @brief Registers a callback function to global error state changes.
- *
- * @param pContext [in] OpenNI context.
- * @param handler [in] A pointer to a function that will be called when global error state changes.
- * @param pCookie [in] A user cookie that will be passed to the callback function.
- * @param phCallback [out] Optional. Will be filled with a handle to be passed to @ref xnUnregisterFromGlobalErrorStateChange().
- */
-XN_C_API XnStatus XN_C_DECL xnRegisterToGlobalErrorStateChange
- (XnContext* pContext, XnErrorStateChangedHandler handler,
- void* pCookie, XnCallbackHandle* phCallback);
-
-/**
- * @brief Unregisters a callback function which was registered using @ref xnRegisterToGlobalErrorStateChange().
- *
- * @param pContext [in] OpenNI context.
- * @param hCallback [in] The handle to the callback returned from @ref xnRegisterToGlobalErrorStateChange().
- */
-XN_C_API void XN_C_DECL xnUnregisterFromGlobalErrorStateChange
- (XnContext* pContext, XnCallbackHandle hCallback);
-
-/**
-* @brief Registers a callback function to 'Node Creation' event. This event is raised whenever node are created.
-*
-* @param pContext [in] OpenNI context.
-* @param handler [in] A pointer to a function that will be called when a new node is created.
-* @param pCookie [in] A user cookie that will be passed to the callback function.
-* @param phCallback [out] Optional. Will be filled with a handle to be passed to @ref xnUnregisterFromNodeCreation().
-*/
-XN_C_API XnStatus XN_C_DECL xnRegisterToNodeCreation
- (XnContext* pContext, XnNodeCreationHandler handler,
- void* pCookie, XnCallbackHandle* phCallback);
-
-/**
- * @brief Unregisters a callback function which was registered using @ref xnRegisterToNodeCreation().
- *
- * @param pContext [in] OpenNI context.
- * @param hCallback [in] The handle to the callback returned from @ref xnRegisterToNodeCreation().
- */
-XN_C_API void XN_C_DECL xnUnregisterFromNodeCreation
- (XnContext* pContext, XnCallbackHandle hCallback);
-
-/**
-* @brief Registers a callback function to 'Node Destruction' event. This event is raised whenever a node is destroyed.
-*
-* @param pContext [in] OpenNI context.
-* @param handler [in] A pointer to a function that will be called when a node is destroyed.
-* @param pCookie [in] A user cookie that will be passed to the callback function.
-* @param phCallback [out] Optional. Will be filled with a handle to be passed to @ref xnUnregisterFromNodeDestruction().
-*/
-XN_C_API XnStatus XN_C_DECL xnRegisterToNodeDestruction
- (XnContext* pContext, XnNodeDestructionHandler handler,
- void* pCookie, XnCallbackHandle* phCallback);
-
-/**
- * @brief Unregisters a callback function which was registered using @ref xnRegisterToNodeDestruction().
- *
- * @param pContext [in] OpenNI context.
- * @param hCallback [in] The handle to the callback returned from @ref xnRegisterToNodeDestruction().
- */
-XN_C_API void XN_C_DECL xnUnregisterFromNodeDestruction
- (XnContext* pContext, XnCallbackHandle hCallback);
-
-/// @}
-
-/** @} */
-
-#endif // __XN_CONTEXT_H__
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCppWrapper.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCppWrapper.h
deleted file mode 100644
index 1984be3d..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCppWrapper.h
+++ /dev/null
@@ -1,10100 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef __XN_CPP_WRAPPER_H__
-#define __XN_CPP_WRAPPER_H__
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <XnOpenNI.h>
-#include <XnCodecIDs.h>
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-namespace xn
-{
- //---------------------------------------------------------------------------
- // Forward Declarations
- //---------------------------------------------------------------------------
- class ProductionNode;
- class EnumerationErrors;
- class NodeInfo;
- class NodeInfoList;
- class Context;
- class Query;
- class Generator;
-
- /**
- * @ingroup cppref
- * @defgroup cppref_glb_ev_hndlrs Global Event Handlers
- */
-
- /**
- * @ingroup cppref
- * @defgroup cppref_graph_mgmt Managing the Production Graph
- */
-
- /**
- * @ingroup cppref
- * @defgroup cppref_meta_data Meta-Data Objects (Frame Objects)
- */
-
- /**
- * @ingroup cppref
- * @defgroup cppref_prd_func Production Nodes Functionality
- */
-
- /**
- * @ingroup cppref
- * @defgroup cppref_misc Misc
- */
-
- //---------------------------------------------------------------------------
- // Types
- //---------------------------------------------------------------------------
-
- /**
- * @ingroup cppref_glb_ev_hndlrs
- * Type definition to define event handlers for the 'State Change' event.
- *
- * @param [in] node Node issuing the event.
- * @param [in] pCookie User cookie passed on registration.
- *
- * <b>Remarks</b>
- *
- * The 'State Change' event can be invoked by a number of OpenNI objects.
- * For example, this event is invoked by the @ref xn::ErrorStateCapability "ErrorStateCapability"
- * object whenever a node's error state changes. As another example, this event is
- * also invoked by the @ref xn::MirrorCapability "MirrorCapability" object whenever a node's
- * mirror configuration has been changed.
- *
- * <b>Example:</b>
- *
- * The following is an example of a callback method that follows that signature:
- *
- @code
- void XN_CALLBACK_TYPE OnEvent(ProductionNode& node, void* pCookie)
- {
- }
- @endcode
- */
- typedef void (XN_CALLBACK_TYPE* StateChangedHandler)(ProductionNode& node, void* pCookie);
-
- //---------------------------------------------------------------------------
- // Internal stuff
- //---------------------------------------------------------------------------
- typedef XnStatus (*_XnRegisterStateChangeFuncPtr)(XnNodeHandle hNode, XnStateChangedHandler handler, void* pCookie, XnCallbackHandle* phCallback);
- typedef void (*_XnUnregisterStateChangeFuncPtr)(XnNodeHandle hNode, XnCallbackHandle hCallback);
-
- static XnStatus _RegisterToStateChange(_XnRegisterStateChangeFuncPtr xnFunc, XnNodeHandle hNode, StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback);
- static void _UnregisterFromStateChange(_XnUnregisterStateChangeFuncPtr xnFunc, XnNodeHandle hNode, XnCallbackHandle hCallback);
-
- //---------------------------------------------------------------------------
- // Some Utilities
- //---------------------------------------------------------------------------
- /**
- * @ingroup cppref_misc
- * <b>Purpose:</b> The Version class provides functionality for accessing the OpenNI version information.
- */
- class Version
- {
- public:
- Version(const XnVersion& version) : m_version(version) {}
- Version(XnUInt8 nMajor, XnUInt8 nMinor, XnUInt16 nMaintenance, XnUInt32 nBuild)
- {
- m_version.nMajor = nMajor;
- m_version.nMinor = nMinor;
- m_version.nMaintenance = nMaintenance;
- m_version.nBuild = nBuild;
- }
-
- bool operator==(const Version& other) const
- {
- return (xnVersionCompare(&m_version, &other.m_version) == 0);
- }
- bool operator!=(const Version& other) const
- {
- return (xnVersionCompare(&m_version, &other.m_version) != 0);
- }
- bool operator<(const Version& other) const
- {
- return (xnVersionCompare(&m_version, &other.m_version) < 0);
- }
- bool operator<=(const Version& other) const
- {
- return (xnVersionCompare(&m_version, &other.m_version) <= 0);
- }
- bool operator>(const Version& other) const
- {
- return (xnVersionCompare(&m_version, &other.m_version) > 0);
- }
- bool operator>=(const Version& other) const
- {
- return (xnVersionCompare(&m_version, &other.m_version) >= 0);
- }
-
- static Version Current()
- {
- XnVersion version;
- xnGetVersion(&version);
- return Version(version);
- }
-
- XnUInt8 Major() const { return m_version.nMajor; }
- XnUInt8 Minor() const { return m_version.nMinor; }
- XnUInt16 Maintenance() const { return m_version.nMaintenance; }
- XnUInt32 Build() const { return m_version.nBuild; }
-
- XnUInt8& Major() { return m_version.nMajor; }
- XnUInt8& Minor() { return m_version.nMinor; }
- XnUInt16& Maintenance() { return m_version.nMaintenance; }
- XnUInt32& Build() { return m_version.nBuild; }
-
- const XnVersion* GetUnderlying() const { return &m_version; }
- XnVersion* GetUnderlying() { return &m_version; }
-
- private:
- XnVersion m_version;
- };
-
- //---------------------------------------------------------------------------
- // Meta Data
- //---------------------------------------------------------------------------
-
- /**
- * @ingroup cppref_meta_data
- * <b>Purpose:</b> The OutputMetaData class provides functionality for supporting fast
- * cached data access to many types of generator nodes.
- *
- * <b>Remarks:</b>
- *
- * The OutputMetaData class is the most basic OpenNI metadata class, whose main properties
- * include <code>Timestamp</code>, <code>FrameID</code>, and <code>DataSize</code>.
- * This class is never instantiated; it is used a base class to help build the hierarchy.
- *
- * An instance of this class hold a @ref glos_frame_object "frame object".
- * The frame object is a snapshot of the generated data at a certain point in time.
- */
- class OutputMetaData
- {
- public:
- /**
- * Ctor. Intended for use by other MetaData objects.
- *
- * @param [in] ppData A pointer to the data member of the meta data object.
- */
- inline OutputMetaData(const XnUInt8** ppData) : m_ppData(ppData), m_nAllocatedSize(0), m_pAllocatedData(NULL)
- {
- xnOSMemSet(&m_output, 0, sizeof(XnOutputMetaData));
- }
-
- /**
- * Dtor. Frees any allocated data.
- */
- virtual ~OutputMetaData() { Free(); }
-
- /**
- * Returns the timestamp of the @ref glos_frame_object "frame object" saved in this object.
- */
- inline XnUInt64 Timestamp() const { return m_output.nTimestamp; }
-
- /**
- * Returns the timestamp of the @ref glos_frame_object "frame object" saved in this object.
- */
- inline XnUInt64& Timestamp() { return m_output.nTimestamp; }
-
- /**
- * Returns the frame ID of the @ref glos_frame_object "frame object" saved in this object.
- * Frame IDs are sequential unique numbers starting with 1.
- */
- inline XnUInt32 FrameID() const { return m_output.nFrameID; }
-
- /**
- * Returns the frame ID of the @ref glos_frame_object "frame object" saved in this object.
- * Frame IDs are sequential unique numbers starting with 1.
- */
- inline XnUInt32& FrameID() { return m_output.nFrameID; }
-
- /**
- * @brief Returns the size, in bytes, of the data of the @ref glos_frame_object "frame object" saved in this object.
- *
- * <b>Remarks</b>
- *
- * For map metadata, this value equals to
- * @ref xn::MapMetaData::XRes "XRes()" * @ref xn::MapMetaData::YRes "YRes()" * @ref xn::MapMetaData::BytesPerPixel "BytesPerPixel()".
- */
- inline XnUInt32 DataSize() const { return m_output.nDataSize; }
-
- /**
- * @brief Returns the size, in bytes, of the data of the @ref glos_frame_object "frame object" saved in this object.
- *
- * <b>Remarks</b>
- *
- * For map metadata, this value equals to
- * @ref xn::MapMetaData::XRes "XRes()" * @ref xn::MapMetaData::YRes "YRes()" * @ref xn::MapMetaData::BytesPerPixel "BytesPerPixel()".
- */
- inline XnUInt32& DataSize() { return m_output.nDataSize; }
-
- /**
- * Returns whether this node's frame data was updated by the most recent call to
- * any @ref conc_updating_data "'WaitXUpdateAll()'" function, e.g., @ref xn::Context::WaitAnyUpdateAll().
- */
- inline XnBool IsDataNew() const { return m_output.bIsNew; }
-
- /**
- * Returns whether this node's frame data was updated by the most recent call to
- * any @ref conc_updating_data "'WaitXUpdateAll()'" function, e.g., @ref xn::Context::WaitAnyUpdateAll().
- */
- inline XnBool& IsDataNew() { return m_output.bIsNew; }
-
- /**
- * Gets the C object that is wrapped by this object.
- */
- inline const XnOutputMetaData* GetUnderlying() const { return &m_output; }
- /**
- * Gets the C object that is wrapped by this object.
- */
- inline XnOutputMetaData* GetUnderlying() { return &m_output; }
-
- /**
- * Gets a pointer to the data of the @ref glos_frame_object "frame object"
- * saved in this object.
- */
- inline const XnUInt8* Data() const { return *m_ppData; }
- /**
- * Gets a pointer to the data of the @ref glos_frame_object "frame object"
- * saved in this object.
- */
- inline const XnUInt8*& Data() { return *m_ppData; }
-
- /**
- * Gets a pointer to the writable buffer (see @ref conc_meta_data).
- */
- inline XnUInt8* WritableData()
- {
- MakeDataWritable();
- return m_pAllocatedData;
- }
-
- /**
- * @brief Allocates a writable buffer. If a previous buffer was allocated it will
- * be freed (or reused if possible).
- *
- * Also see @ref conc_meta_data.
- *
- * @param [in] nBytes The requested size for the buffer, in bytes.
- */
- XnStatus AllocateData(XnUInt32 nBytes)
- {
- if (nBytes > m_nAllocatedSize)
- {
- // reallocate
- XnUInt8* pData = (XnUInt8*)xnOSMallocAligned(nBytes, XN_DEFAULT_MEM_ALIGN);
- XN_VALIDATE_ALLOC_PTR(pData);
-
- // allocation succeeded, replace
- Free();
- m_pAllocatedData = pData;
- m_nAllocatedSize = nBytes;
- }
-
- DataSize() = nBytes;
- *m_ppData = m_pAllocatedData;
-
- return XN_STATUS_OK;
- }
-
- /**
- * Frees the writable buffer, if one was allocated.
- */
- void Free()
- {
- if (m_nAllocatedSize != 0)
- {
- xnOSFreeAligned(m_pAllocatedData);
- m_pAllocatedData = NULL;
- m_nAllocatedSize = 0;
- }
- }
-
- /**
- * Creates a writable copy of the data, and stores it instead of the original (read-only) data.
- * Also see @ref conc_meta_data.
- */
- XnStatus MakeDataWritable()
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- // check data isn't already writable
- if (Data() != m_pAllocatedData || DataSize() > m_nAllocatedSize)
- {
- const XnUInt8* pOrigData = *m_ppData;
-
- nRetVal = AllocateData(DataSize());
- XN_IS_STATUS_OK(nRetVal);
-
- if (pOrigData != NULL)
- {
- xnOSMemCopy(m_pAllocatedData, pOrigData, DataSize());
- }
- else
- {
- xnOSMemSet(m_pAllocatedData, 0, DataSize());
- }
- }
-
- return (XN_STATUS_OK);
- }
-
- protected:
- XnUInt8* m_pAllocatedData;
-
- private:
- XnOutputMetaData m_output;
-
- const XnUInt8** m_ppData;
- XnUInt32 m_nAllocatedSize;
- };
-
- /**
- * @ingroup cppref_meta_data
- * The MapMetaData class is a base class for providing the fast data access functionality
- * for the @ref glos_frame_object "frame object" saved in metadata. This functionality
- * is applicable to all generator nodes that have an associated metadata object.
- *
- * MapMetaData is the next metadata class in the metadata hierarchy after the OutputMetaData
- * class.
- *
- * The MapMetaData class - like OutputMetaData - is never instantiated;
- * it is a base class of the OpenNI metadata class hierarchy.
- */
- class MapMetaData : public OutputMetaData
- {
- public:
- /**
- * Ctor. Intended for use by inheriting classes.
- *
- * @param [in] format Pixel Format
- * @param [in] ppData A pointer to the data member of the meta data object
- */
- inline MapMetaData(XnPixelFormat format, const XnUInt8** ppData) : OutputMetaData(ppData)
- {
- xnOSMemSet(&m_map, 0, sizeof(XnMapMetaData));
- m_map.pOutput = OutputMetaData::GetUnderlying();
- m_map.PixelFormat = format;
- }
-
- /**
- * Gets the frame X resolution of the @ref glos_frame_object "frame object" saved in this object.
- * The X resolution is the actual number of columns in the frame after any required cropping has
- * been applied.
- */
- inline XnUInt32 XRes() const { return m_map.Res.X; }
- /**
- * Gets the frame X resolution of the @ref glos_frame_object "frame object" saved in this object.
- * The X resolution is the actual number of columns in the frame after any required cropping has
- * been applied.
- */
- inline XnUInt32& XRes() { return m_map.Res.X; }
-
- /**
- * Gets the frame Y resolution of the @ref glos_frame_object "frame object" saved in this object.
- * The Y resolution is the actual number of rows in the frame after any required cropping has
- * been applied.
- */
- inline XnUInt32 YRes() const { return m_map.Res.Y; }
- /**
- * Gets the frame Y resolution of the @ref glos_frame_object "frame object" saved in this object.
- * The Y resolution is the actual number of rows in the frame after any required cropping has
- * been applied.
- */
- inline XnUInt32& YRes() { return m_map.Res.Y; }
-
- /**
- * Gets the cropping area X offset of the @ref glos_frame_object "frame object" saved in this object.
- * This is the horizontal offset, measured in units of pixel columns, of the buffer within the field of view.
- *
- * <b>Remarks</b>
- *
- * The X offset is 0 if cropping is disabled (see @ref XnCropping).
- */
- inline XnUInt32 XOffset() const { return m_map.Offset.X; }
- /**
- * Gets the cropping area X offset of the @ref glos_frame_object "frame object" saved in this object.
- * This is the horizontal offset, measured in units of pixel columns, of the buffer within the field of view.
- *
- * <b>Remarks</b>
- *
- * The X offset is 0 if cropping is disabled (see @ref XnCropping).
- */
- inline XnUInt32& XOffset() { return m_map.Offset.X; }
-
- /**
- * Gets the cropping area Y offset of the @ref glos_frame_object "frame object" saved in this object.
- * This is the vertical offset, measured in units of pixel rows, of the buffer within the field of view.
- *
- * <b>Remarks</b>
- *
- * The Y offset is 0 if cropping is disabled (see @ref XnCropping).
- */
- inline XnUInt32 YOffset() const { return m_map.Offset.Y; }
- /**
- * Gets the cropping area Y offset of the @ref glos_frame_object "frame object" saved in this object.
- * This is the vertical offset, measured in units of pixel rows, of the buffer within the field of view.
- *
- * <b>Remarks</b>
- *
- * The Y offset is 0 if cropping is disabled (see @ref XnCropping).
- */
- inline XnUInt32& YOffset() { return m_map.Offset.Y; }
-
- /**
- * Gets the number of columns in the full frame (entire field-of-view, ignoring
- * cropping).
- */
- inline XnUInt32 FullXRes() const { return m_map.FullRes.X; }
-
-
- /**
- * Gets the number of columns in the full frame (entire field-of-view, ignoring
- * cropping).
- */
- inline XnUInt32& FullXRes() { return m_map.FullRes.X; }
-
- /**
- * Gets the number of rows in the full frame (entire field-of-view, ignoring cropping).
- */
- inline XnUInt32 FullYRes() const { return m_map.FullRes.Y; }
- /**
- * Gets the number of rows in the full frame (entire field-of-view, ignoring cropping).
- */
- inline XnUInt32& FullYRes() { return m_map.FullRes.Y; }
-
- /**
- * Gets the FPS in which frame was generated.
- */
- inline XnUInt32 FPS() const { return m_map.nFPS; }
- /**
- * Gets the FPS in which frame was generated.
- */
- inline XnUInt32& FPS() { return m_map.nFPS; }
-
- /**
- * Gets the pixel format of the pixel-map.
- */
- inline XnPixelFormat PixelFormat() const { return m_map.PixelFormat; }
-
- /**
- * Gets the C object that is wrapped by this object.
- */
- inline const XnMapMetaData* GetUnderlying() const { return &m_map; }
- /**
- * Gets the C object that is wrapped by this object.
- */
- inline XnMapMetaData* GetUnderlying() { return &m_map; }
-
- /**
- * Gets the number of bytes each pixel occupies.
- */
- inline XnUInt32 BytesPerPixel() const
- {
- switch (PixelFormat())
- {
- case XN_PIXEL_FORMAT_RGB24:
- return sizeof(XnRGB24Pixel);
- case XN_PIXEL_FORMAT_YUV422:
- return sizeof(XnYUV422DoublePixel)/2;
- case XN_PIXEL_FORMAT_GRAYSCALE_8_BIT:
- return sizeof(XnGrayscale8Pixel);
- case XN_PIXEL_FORMAT_GRAYSCALE_16_BIT:
- return sizeof(XnGrayscale16Pixel);
- case XN_PIXEL_FORMAT_MJPEG:
- return 2;
- default:
- XN_ASSERT(FALSE);
- return 0;
- }
- }
-
- /**
- * @copybrief xn::OutputMetaData::AllocateData
- *
- * @param [in] nXRes The number of required columns in the map.
- * @param [in] nYRes The number of required rows in the map.
- */
- XnStatus AllocateData(XnUInt32 nXRes, XnUInt32 nYRes)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnUInt32 nSize = nXRes * nYRes * BytesPerPixel();
- nRetVal = OutputMetaData::AllocateData(nSize);
- XN_IS_STATUS_OK(nRetVal);
-
- FullXRes() = XRes() = nXRes;
- FullYRes() = YRes() = nYRes;
- XOffset() = YOffset() = 0;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * Changes dimensions of the pixel-map.
- *
- * @param [in] nXRes Number of columns in the map
- * @param [in] nYRes Number of rows in the map
- * @param [in] pExternalBuffer Optional. An external buffer to be used. If NULL is passed,
- * a buffer will be allocated.
- */
- XnStatus ReAdjust(XnUInt32 nXRes, XnUInt32 nYRes, const XnUInt8* pExternalBuffer)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- if (pExternalBuffer == NULL)
- {
- nRetVal = AllocateData(nXRes, nYRes);
- XN_IS_STATUS_OK(nRetVal);
- }
- else
- {
- FullXRes() = XRes() = nXRes;
- FullYRes() = YRes() = nYRes;
- XOffset() = YOffset() = 0;
- Data() = pExternalBuffer;
- DataSize() = nXRes * nYRes * BytesPerPixel();
- }
-
- return (XN_STATUS_OK);
- }
-
- protected:
- XnPixelFormat& PixelFormatImpl() { return m_map.PixelFormat; }
-
- private:
- // block copy ctor and assignment operator
- MapMetaData& operator=(const MapMetaData&);
- inline MapMetaData(const MapMetaData& other);
-
- // Members
- XnMapMetaData m_map;
- };
-
- /**
- * @ingroup cppref_meta_data
- * The Map Wrapper classes are light wrappers for @ref glos_frame_object maps (from metadata classes). These wrapper classes
- * provide small data-focused objects for simplified data access to frame objects generated by the generator nodes.
- *
- * @tparam _pixelType The data type of a single pixel in this map
- */
- template<class _pixelType>
- class Map
- {
- public:
- inline Map(_pixelType*& pData, XnUInt32& nXRes, XnUInt32 &nYRes) :
- m_pData(pData), m_nXRes(nXRes), m_nYRes(nYRes)
- {}
-
- /**
- * Gets the frame X resolution. The X resolution is the actual number of columns in the frame after any required cropping has been applied.
- *
- * <b>Remarks</b>
- *
- * This is the same as @ref xn::MapMetaData::XRes "MapMetaData::XRes()".
- */
- inline XnUInt32 XRes() const { return m_nXRes; }
- /**
- * Gets the frame Y resolution. The Y resolution is the actual number of rows in the frame after any required cropping has been applied.
- *
- * <b>Remarks</b>
- *
- * This is the same as @ref xn::MapMetaData::YRes "MapMetaData::YRes()".
- */
- inline XnUInt32 YRes() const { return m_nYRes; }
-
- /**
- * Gets a single pixel of the frame map by indexing a map as a one-dimensional array.
- *
- * @param [in] nIndex The position of the pixel in the buffer
- *
- * @returns A pixel of type <code>_pixelType</code>.
- *
- * <b>Remarks</b>
- *
- * Indexing a map in this way can give improved speed in some situations.
- */
- inline const _pixelType& operator[](XnUInt32 nIndex) const
- {
- XN_ASSERT(nIndex < (m_nXRes * m_nYRes));
- return m_pData[nIndex];
- }
- /**
- * Gets a single pixel of the frame map by indexing a map as a one-dimensional array.
- *
- * @param [in] nIndex The position of the pixel in the buffer
- *
- * @returns A pixel of type <code>_pixelType</code>.
- *
- * <b>Remarks</b>
- *
- * Indexing a map in this way can give improved speed in some situations.
- */
- inline _pixelType& operator[](XnUInt32 nIndex)
- {
- XN_ASSERT(nIndex < (m_nXRes *m_nYRes));
- return m_pData[nIndex];
- }
-
- /**
- * Gets a single pixel of the frame map by its X and Y coordinates.
- *
- * @param [in] x The horizontal position of the pixel (from left to right)
- * @param [in] y The vertical position of the pixel in the buffer (from top to bottom)
- *
- * @returns A pixel of type <code>_pixelType</code>.
- */
- inline const _pixelType& operator()(XnUInt32 x, XnUInt32 y) const
- {
- XN_ASSERT(x < m_nXRes && y < m_nYRes);
- return m_pData[y*m_nXRes + x];
- }
- /**
- * Gets a single pixel of the frame map by its X and Y coordinates.
- *
- * @param [in] x The horizontal position of the pixel (from left to right)
- * @param [in] y The vertical position of the pixel in the buffer (from top to bottom)
- *
- * @returns A pixel of type <code>_pixelType</code>.
- */
- inline _pixelType& operator()(XnUInt32 x, XnUInt32 y)
- {
- XN_ASSERT(x < m_nXRes && y < m_nYRes);
- return m_pData[y*m_nXRes + x];
- }
-
- private:
- /* block copy ctor and assignment operator */
- Map(const Map& other);
- Map& operator=(const Map&);
-
- _pixelType*& m_pData;
- XnUInt32& m_nXRes;
- XnUInt32& m_nYRes;
- };
-
- /** @ingroup cppref_meta_data
- * @{
- */
- /** Declares a @ref xn::Map "Map" class with pixel of type XnDepthPixel */
- typedef Map<XnDepthPixel> DepthMap;
- /** Declares a @ref xn::Map "Map" class with pixel of type XnUInt8 */
- typedef Map<XnUInt8> ImageMap;
- /** Declares a @ref xn::Map "Map" class with pixel of type XnRGB24Pixel */
- typedef Map<XnRGB24Pixel> RGB24Map;
- /** Declares a @ref xn::Map "Map" class with pixel of type XnGrayscale16Pixel */
- typedef Map<XnGrayscale16Pixel> Grayscale16Map;
- /** Declares a @ref xn::Map "Map" class with pixel of type XnGrayscale8Pixel */
- typedef Map<XnGrayscale8Pixel> Grayscale8Map;
- /** Declares a @ref xn::Map "Map" class with pixel of type XnIRPixel */
- typedef Map<XnIRPixel> IRMap;
- /** Declares a @ref xn::Map "Map" class with pixel of type XnLabel */
- typedef Map<XnLabel> LabelMap;
- /** @} */
-
- /**
- * @ingroup cppref_meta_data
- *
- * For saving the @ref glos_frame_object "frame object" (data and configuration) from
- * the @ref xn::DepthGenerator "DepthGenerator" node. This @ref glos_frame_object "frame
- * object" is a snapshot of the DepthGenerator's generated depth map and its associated
- * configuration information at a certain point in time. This saved @ref glos_frame_object
- * "frame object" provides fast and easy access to the DepthGenerator node's data and
- * configuration information.
- *
- * It is important to get a good understanding of the purpose and design of the OpenNI
- * metadata objects. For a comprehensive overview of OpenNI metadata objects, see @ref
- * conc_meta_data.
- *
- * The DepthGenerator node generates depth data of the FOV. This is the
- * Z-coordinate of the X-Y-Z coordinate of each point. The Z-axis is the distance, in
- * millimeters from the sensor plane.
- * A smaller depth value indicates a scene point that is a <i>closer</i> to the sensor,
- * and a larger depth value indicates a scene point that is <i>further away</i> from
- * the sensor. A zero depth value indicates that the DepthGenerator node did not succeed
- * in obtaining a valid depth reading.
- *
- * DepthMetaData's @ref xn::DepthMetaData::Data() method provides the actual depth
- * data. This method returns the pointer to the first depth pixel in the map.
- *
- * The pixel format of depth map is XnDepthPixel, i.e. 16-bit values.
- *
- * DepthMetaData provides the <code>ZRes</code> property to contain the depth resolution.
- * This is the maximum value of a pixel (plus one).
- *
- * DepthMetaData is similar to ImageMetaData; they are both metadata for a type of map.
- */
- class DepthMetaData : public MapMetaData
- {
- public:
- /**
- * Ctor.
- */
- inline DepthMetaData() :
- MapMetaData(XN_PIXEL_FORMAT_GRAYSCALE_16_BIT, (const XnUInt8**)&m_depth.pData),
- m_depthMap(const_cast<XnDepthPixel*&>(m_depth.pData), MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y),
- m_writableDepthMap((XnDepthPixel*&)m_pAllocatedData, MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y)
- {
- xnOSMemSet(&m_depth, 0, sizeof(XnDepthMetaData));
- m_depth.pMap = MapMetaData::GetUnderlying();
- }
-
- /**
- * @brief Shallow-Copies a DepthMetaData object.
- *
- * @param [in] other source object.
- *
- * @remarks Note that the data buffer is not copied, and that both object will point to the same buffer.
- */
- inline void InitFrom(const DepthMetaData& other)
- {
- xnCopyDepthMetaData(&m_depth, &other.m_depth);
- }
-
- /**
- * Shallow copies another @ref DepthMetaData object, and then @ref ReAdjust "readjusts
- * it".
- *
- * @param [in] other Source object
- * @param [in] nXRes Requested number of columns in the map
- * @param [in] nYRes Requested number of rows in the map
- * @param [in] pExternalBuffer Optional. An external buffer matching requested resolution.
- * If NULL, A buffer will be allocated.
- */
- inline XnStatus InitFrom(const DepthMetaData& other, XnUInt32 nXRes, XnUInt32 nYRes, const XnDepthPixel* pExternalBuffer)
- {
- InitFrom(other);
- return ReAdjust(nXRes, nYRes, pExternalBuffer);
- }
-
- /**
- * Performs a deep-copy of another metadata object (including duplication of the
- * data buffer).
- *
- * @param [in] other source object
- */
- XnStatus CopyFrom(const DepthMetaData& other)
- {
- // copy props
- InitFrom(other);
- // and make a copy of the data (this will allocate and copy data)
- return MakeDataWritable();
- }
-
- /**
- * @copydoc xn::MapMetaData::ReAdjust
- */
- XnStatus ReAdjust(XnUInt32 nXRes, XnUInt32 nYRes, const XnDepthPixel* pExternalBuffer = NULL)
- {
- return MapMetaData::ReAdjust(nXRes, nYRes, (const XnUInt8*)pExternalBuffer);
- }
-
- /**
- * Gets the maximum depth (depth resolution) that the DepthGenerator node can produce.
- * This is the same as the resolution of the depth axis
- * (i.e., @ref DepthGenerator::GetDeviceMaxDepth() + 1).
- */
- inline XnDepthPixel ZRes() const { return m_depth.nZRes; }
- /**
- * Gets the maximum depth (depth resolution) that the DepthGenerator node can produce.
- * This is the same as the resolution of the depth axis
- * (i.e., @ref DepthGenerator::GetDeviceMaxDepth() + 1).
- */
- inline XnDepthPixel& ZRes() { return m_depth.nZRes; }
-
- /**
- * @brief Returns the depth map.
- *
- * <b>Remarks</b>
- *
- * This method returns a pointer to the first depth pixel in the map. The depth
- * map is implemented as a row-major order compact layout of pixels in the map.
- *
- * The pixel format of the map is XnDepthPixel, i.e. 16-bit integer values.
- *
- * This method is reimplemented from the @ref xn::OutputMetaData class.
- */
- inline const XnDepthPixel* Data() const { return (const XnDepthPixel*)MapMetaData::Data(); }
- /**
- * @brief Returns the depth map.
- *
- * <b>Remarks</b>
- *
- * This method returns a pointer to the first depth pixel in the map. The depth
- * map is implemented as a row-major order compact layout of pixels in the map.
- *
- * The pixel format of the map is XnDepthPixel, i.e. 16-bit integer values.
- *
- * This method is reimplemented from the @ref xn::OutputMetaData class.
- */
- inline const XnDepthPixel*& Data() { return (const XnDepthPixel*&)MapMetaData::Data(); }
-
-
- /**
- * @copydoc xn::OutputMetaData::WritableData
- */
- inline XnDepthPixel* WritableData() { return (XnDepthPixel*)MapMetaData::WritableData(); }
-
- /**
- * Gets a light object wrapping the depth map
- */
- inline const xn::DepthMap& DepthMap() const { return m_depthMap; }
- /**
- * Gets a light object wrapping the writable depth map
- */
- inline xn::DepthMap& WritableDepthMap()
- {
- MakeDataWritable();
- return m_writableDepthMap;
- }
-
- /**
- * Gets the value of a single pixel of the frame map by its index in the array.
- *
- * @param [in] nIndex The index of the pixel in the buffer.
- */
- inline const XnDepthPixel& operator[](XnUInt32 nIndex) const
- {
- XN_ASSERT(nIndex < (XRes()*YRes()));
- return Data()[nIndex];
- }
-
- /**
- * Gets the value of a single pixel of the frame map by its X and Y coordinates.
- *
- * @param [in] x X-coordinate of the pixel in the map
- * @param [in] y Y-coordinate of the pixel in the map
- */
- inline const XnDepthPixel& operator()(XnUInt32 x, XnUInt32 y) const
- {
- XN_ASSERT(x < XRes() && y < YRes());
- return Data()[y*XRes() + x];
- }
-
- /**
- * @copydoc xn::OutputMetaData::GetUnderlying
- */
- inline const XnDepthMetaData* GetUnderlying() const { return &m_depth; }
- /**
- * @copydoc xn::OutputMetaData::GetUnderlying
- */
- inline XnDepthMetaData* GetUnderlying() { return &m_depth; }
-
- private:
- // block copy ctor and assignment operator (because we can't return errors in those)
- DepthMetaData(const DepthMetaData& other);
- DepthMetaData& operator=(const DepthMetaData&);
-
- XnDepthMetaData m_depth;
- const xn::DepthMap m_depthMap;
- xn::DepthMap m_writableDepthMap;
- };
-
- /**
- * @ingroup cppref_meta_data
- *
- * For saving the @ref glos_frame_object "frame object" (data and configuration) from
- * the @ref xn::DepthGenerator "DepthGenerator" node. This @ref glos_frame_object "frame
- * object" is a snapshot of the DepthGenerator's generated depth map and its associated
- * configuration information at a certain point in time. This saved @ref glos_frame_object
- * "frame object" provides fast and easy access to the DepthGenerator node's data and
- * configuration information.
- *
- * It is important to get a good understanding of the purpose and design of the OpenNI
- * metadata objects. For a comprehensive overview of OpenNI metadata objects, see @ref
- * conc_meta_data.
- *
- * The ImageMetaData object provides a number of different methods to get the image
- * as a different format. You must use the 'Get Data' method most appropriate for the
- * data format of the latest available frame. For example, if you requested the ImageGenerator
- * node to generate RGB24 format you must use the @ref RGB24Data() method to get the
- * data.
- *
- * Each of the 'Get Data' methods gets the image as a pointer to the first pixel
- * in the image map. From the address of that first pixel you can access all the pixels.
- *
- * Depending on the format, the pixels are different in size. This means that image
- * maps are a different size.
- */
- class ImageMetaData : public MapMetaData
- {
- public:
- inline ImageMetaData() :
- MapMetaData(XN_PIXEL_FORMAT_RGB24, &m_image.pData),
- m_imageMap(const_cast<XnUInt8*&>(m_image.pData), MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y),
- m_writableImageMap((XnUInt8*&)m_pAllocatedData, MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y),
- m_rgb24Map((XnRGB24Pixel*&)m_image.pData, MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y),
- m_writableRgb24Map((XnRGB24Pixel*&)m_pAllocatedData, MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y),
- m_gray16Map((XnGrayscale16Pixel*&)m_image.pData, MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y),
- m_writableGray16Map((XnGrayscale16Pixel*&)m_pAllocatedData, MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y),
- m_gray8Map((XnGrayscale8Pixel*&)m_image.pData, MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y),
- m_writableGray8Map((XnGrayscale8Pixel*&)m_pAllocatedData, MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y)
- {
- xnOSMemSet(&m_image, 0, sizeof(XnImageMetaData));
- m_image.pMap = MapMetaData::GetUnderlying();
- }
-
- /**
- * @brief Shallow-copies an ImageMetaData object.
- *
- * @param [in] other source object.
- *
- * @remarks Note that the data buffer is not copied, and that both object will point to the same buffer.
- */
- inline void InitFrom(const ImageMetaData& other)
- {
- xnCopyImageMetaData(&m_image, &other.m_image);
- }
-
- /**
- * Shallow copies another @ref ImageMetaData object, and then @ref ReAdjust "readjusts"
- * it.
- *
- * @param [in] other Source object
- * @param [in] nXRes Requested number of columns in the map
- * @param [in] nYRes Requested number of rows in the map
- * @param [in] format Requested pixel format
- * @param [in] pExternalBuffer Optional. An external buffer matching requested resolution.
- * If NULL, A buffer will be allocated.
- */
- inline XnStatus InitFrom(const ImageMetaData& other, XnUInt32 nXRes, XnUInt32 nYRes, XnPixelFormat format, const XnUInt8* pExternalBuffer)
- {
- InitFrom(other);
- XnStatus nRetVal = ReAdjust(nXRes, nYRes, format, pExternalBuffer);
- XN_IS_STATUS_OK(nRetVal);
- PixelFormat() = format;
- return XN_STATUS_OK;
- }
-
- /**
- * @copybrief xn::OutputMetaData::AllocateData
- *
- * @param [in] nXRes Requested number of columns in the map
- * @param [in] nYRes Requested number of rows in the map
- * @param [in] format Requested pixel format
- */
- inline XnStatus AllocateData(XnUInt32 nXRes, XnUInt32 nYRes, XnPixelFormat format)
- {
- XnPixelFormat origFormat = PixelFormat();
- PixelFormat() = format;
- XnStatus nRetVal = MapMetaData::AllocateData(nXRes, nYRes);
- if (nRetVal != XN_STATUS_OK)
- {
- PixelFormat() = origFormat;
- return (nRetVal);
- }
-
- return XN_STATUS_OK;
- }
-
- /**
- * Performs a deep-copy of another metadata object (including duplication of the data buffer)
- *
- * @param [in] other source object
- */
- inline XnStatus CopyFrom(const ImageMetaData& other)
- {
- // copy props
- xnCopyImageMetaData(&m_image, &other.m_image);
- // and make a copy of the data (this will allocate and copy data)
- return MakeDataWritable();
- }
-
- /**
- * @copybrief xn::MapMetaData::ReAdjust
- *
- * @param [in] nXRes Requested number of columns in the map
- * @param [in] nYRes Requested number of rows in the map
- * @param [in] format Requested pixel format
- * @param [in] pExternalBuffer Optional. An external buffer to be used. If NULL
- * is passed, a buffer will be allocated.
- */
- XnStatus ReAdjust(XnUInt32 nXRes, XnUInt32 nYRes, XnPixelFormat format, const XnUInt8* pExternalBuffer = NULL)
- {
- XnPixelFormat origFormat = PixelFormat();
- PixelFormat() = format;
- XnStatus nRetVal = MapMetaData::ReAdjust(nXRes, nYRes, pExternalBuffer);
- if (nRetVal != XN_STATUS_OK)
- {
- PixelFormat() = origFormat;
- return (nRetVal);
- }
-
- return XN_STATUS_OK;
- }
-
- /**
- * @brief Gets the frame's pixel color format used in this image map. This is the
- * format of the @ref glos_frame_object "frame object" saved in this object.
- *
- * <b>Remarks</b>
- *
- * Knowing the pixel format of the image map helps you to enumerate over the map
- * and process its data.
- *
- * Reimplemented from @ref xn::MapMetaData.
- */
- inline XnPixelFormat PixelFormat() const { return MapMetaData::PixelFormat(); }
- /**
- * @brief Gets the frame's pixel color format used in this image map. This is the
- * format of the @ref glos_frame_object "frame object" saved in this object.
- *
- * <b>Remarks</b>
- *
- * Knowing the pixel format of the image map helps you to enumerate over the map
- * and process its data.
- */
- inline XnPixelFormat& PixelFormat() { return MapMetaData::PixelFormatImpl(); }
-
- /**
- * @copydoc MapMetaData::WritableData
- */
- inline XnUInt8* WritableData() { return MapMetaData::WritableData(); }
-
- /**
- * @brief Gets a pointer to the first pixel of the image in @ref xn::XnRGB24Pixel "RGB24" format.
- * RGB24 format represents each pixel as one byte for red, one byte for green, and one byte for blue.
- */
- inline const XnRGB24Pixel* RGB24Data() const { return (const XnRGB24Pixel*)MapMetaData::Data(); }
- /**
- * @brief Gets a pointer to the first pixel of the image in @ref xn::XnRGB24Pixel "RGB24" format.
- * RGB24 format represents each pixel as one byte for red, one byte for green, and one byte for blue.
- */
- inline const XnRGB24Pixel*& RGB24Data() { return (const XnRGB24Pixel*&)MapMetaData::Data(); }
- /**
- * @copydoc MapMetaData::WritableData
- */
- inline XnRGB24Pixel* WritableRGB24Data() { return (XnRGB24Pixel*)MapMetaData::WritableData(); }
-
- /**
- * @brief Gets a pointer to the first pixel of the image in @ref xn::XnYUV422DoublePixel "YUV422" format.
- * YUV422 is a type of compression with a single Y byte followed by a U byte, then another Y byte and then a V byte: YUY'V.
- * These four values represent two pixels: YUV and Y'UV.
- */
- inline const XnYUV422DoublePixel* YUV422Data() const { return (const XnYUV422DoublePixel*)MapMetaData::Data(); }
- /**
- * @brief Gets a pointer to the first pixel of the image in @ref xn::XnYUV422DoublePixel "YUV422" format.
- * YUV422 is a type of compression with a single Y byte followed by a U byte, then another Y byte and then a V byte: YUY'V.
- * These four values represent two pixels: YUV and Y'UV.
- */
- inline const XnYUV422DoublePixel*& YUV422Data() { return (const XnYUV422DoublePixel*&)MapMetaData::Data(); }
- /**
- * @copydoc MapMetaData::WritableData
- */
- inline XnYUV422DoublePixel* WritableYUV422Data() { return (XnYUV422DoublePixel*)MapMetaData::WritableData(); }
-
- /**
- * @brief Gets a pointer to the first pixel of the image in Grayscale8 format.
- * Grayscale8 represents each pixel as an 8-bit (1 byte) gray scale.
- */
- inline const XnGrayscale8Pixel* Grayscale8Data() const { return (const XnGrayscale8Pixel*)MapMetaData::Data(); }
- /**
- * @brief Gets a pointer to the first pixel of the image in Grayscale8 format.
- * Grayscale8 represents each pixel as an 8-bit (1-byte) gray scale.
- */
- inline const XnGrayscale8Pixel*& Grayscale8Data() { return (const XnGrayscale8Pixel*&)MapMetaData::Data(); }
- /**
- * @copydoc MapMetaData::WritableData
- */
- inline XnGrayscale8Pixel* WritableGrayscale8Data() { return (XnGrayscale8Pixel*)MapMetaData::WritableData(); }
-
- /**
- * @brief Gets a pointer to the first pixel of the image in Grayscale16 format.
- * Grayscale16 represents each pixel as a 16-bit (2-byte) gray scale.
- */
- inline const XnGrayscale16Pixel* Grayscale16Data() const { return (const XnGrayscale16Pixel*)MapMetaData::Data(); }
- /**
- * @brief Gets a pointer to the first pixel of the image in Grayscale16 format.
- * Grayscale16 represents each pixel as a 16-bit (2-byte) gray scale.
- */
- inline const XnGrayscale16Pixel*& Grayscale16Data() { return (const XnGrayscale16Pixel*&)MapMetaData::Data(); }
- /**
- * @copydoc MapMetaData::WritableData
- */
- inline XnGrayscale16Pixel* WritableGrayscale16Data() { return (XnGrayscale16Pixel*)MapMetaData::WritableData(); }
-
- /**
- * @brief Gets a light object wrapping the image map.
- */
- inline const xn::ImageMap& ImageMap() const { return m_imageMap; }
- /**
- * Gets a light object wrapping the writable image-map
- */
- inline xn::ImageMap& WritableImageMap() { MakeDataWritable(); return m_writableImageMap; }
-
- /**
- * @brief Gets a light wrapper object for wrapping the image map as RGB24 format.
- * RGB24 format represents each pixel as one byte for red, one byte for green, and
- * one byte for blue.
- */
- inline const xn::RGB24Map& RGB24Map() const { return m_rgb24Map; }
- /**
- * @copydoc xn::ImageMetaData::WritableImageMap
- */
- inline xn::RGB24Map& WritableRGB24Map() { MakeDataWritable(); return m_writableRgb24Map; }
-
- /**
- * @brief Gets a light wrapper object wrapping the image map as Grayscale8 format.
- */
- inline const xn::Grayscale8Map& Grayscale8Map() const { return m_gray8Map; }
- /**
- * @copydoc xn::ImageMetaData::WritableImageMap
- */
- inline xn::Grayscale8Map& WritableGrayscale8Map() { MakeDataWritable(); return m_writableGray8Map; }
-
- /**
- * @brief Gets a light wrapper object wrapping the frame's image map as Grayscale16
- * format.
- */
- inline const xn::Grayscale16Map& Grayscale16Map() const { return m_gray16Map; }
- /**
- * @copydoc xn::ImageMetaData::WritableImageMap
- */
- inline xn::Grayscale16Map& WritableGrayscale16Map() { MakeDataWritable(); return m_writableGray16Map; }
-
- /**
- * @copydoc xn::OutputMetaData::GetUnderlying
- */
- inline const XnImageMetaData* GetUnderlying() const { return &m_image; }
- /**
- * @copydoc xn::OutputMetaData::GetUnderlying
- */
- inline XnImageMetaData* GetUnderlying() { return &m_image; }
-
- private:
- // block copy ctor and assignment operator
- ImageMetaData(const ImageMetaData& other);
- ImageMetaData& operator=(const ImageMetaData&);
-
- XnImageMetaData m_image;
- const xn::ImageMap m_imageMap;
- xn::ImageMap m_writableImageMap;
- const xn::RGB24Map m_rgb24Map;
- xn::RGB24Map m_writableRgb24Map;
- const xn::Grayscale16Map m_gray16Map;
- xn::Grayscale16Map m_writableGray16Map;
- const xn::Grayscale8Map m_gray8Map;
- xn::Grayscale8Map m_writableGray8Map;
- };
-
- /**
- * @ingroup cppref_meta_data
- *
- * <b>Purpose:</b> For saving the @ref glos_frame_object "frame object" (data and configuration)
- * from an xn::IRGenerator node. This @ref glos_frame_object "frame object" is a snapshot
- * of the generated infra-red map data and its associated configuration information
- * at a certain point in time. This saved @ref glos_frame_object "frame object" provides
- * fast and easy access to the IRGenerator node's data and configuration information.
- */
- class IRMetaData : public MapMetaData
- {
- public:
- inline IRMetaData() :
- MapMetaData(XN_PIXEL_FORMAT_GRAYSCALE_16_BIT, (const XnUInt8**)&m_ir.pData),
- m_irMap(const_cast<XnIRPixel*&>(m_ir.pData), MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y),
- m_writableIRMap((XnIRPixel*&)m_pAllocatedData, MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y)
- {
- xnOSMemSet(&m_ir, 0, sizeof(XnIRMetaData));
- m_ir.pMap = MapMetaData::GetUnderlying();
- }
-
- /**
- * @brief Shallow-Copies an IRMetaData object.
- *
- * @param [in] other source object.
- *
- * @remarks Note that the data buffer is not copied, and that both object will point to the same buffer.
- */
- inline void InitFrom(const IRMetaData& other)
- {
- xnCopyIRMetaData(&m_ir, &other.m_ir);
- }
-
- /**
- * Shallow copies another IRMetaData object, and then @ref ReAdjust it.
- *
- * @param [in] other source object
- * @param [in] nXRes requested number of columns in the map
- * @param [in] nYRes requested number of rows in the map
- * @param [in] pExternalBuffer Optional. An external buffer matching requested resolution. If NULL,
- * A buffer will be allocated.
- */
- inline XnStatus InitFrom(const IRMetaData& other, XnUInt32 nXRes, XnUInt32 nYRes, const XnIRPixel* pExternalBuffer)
- {
- InitFrom(other);
- return ReAdjust(nXRes, nYRes, pExternalBuffer);
- }
-
- /**
- * Performs a deep-copy of another metadata object (including duplication of the data buffer)
- *
- * @param [in] other source object
- */
- XnStatus CopyFrom(const IRMetaData& other)
- {
- // copy props
- xnCopyIRMetaData(&m_ir, &other.m_ir);
- // and make a copy of the data (this will allocate and copy data)
- return MakeDataWritable();
- }
-
- /**
- * @copydoc MapMetaData::ReAdjust
- */
- XnStatus ReAdjust(XnUInt32 nXRes, XnUInt32 nYRes, const XnIRPixel* pExternalBuffer = NULL)
- {
- return MapMetaData::ReAdjust(nXRes, nYRes, (const XnUInt8*)pExternalBuffer);
- }
-
- /**
- * @brief Returns the IR map.
- *
- * <b>Remarks</b>
- *
- * This method returns a pointer to the first IR pixel in the map. The IR
- * map is implemented as a row-major order compact layout of pixels in the map.
- *
- * The pixel format of the map is XnIRPixel, i.e. 16-bit integer values.
- *
- * This method is reimplemented from the @ref xn::OutputMetaData class.
- */
- inline const XnIRPixel* Data() const { return (const XnIRPixel*)MapMetaData::Data(); }
- /**
- * @brief Returns the IR map.
- *
- * <b>Remarks</b>
- *
- * This method returns a pointer to the first IR pixel in the map. The IR
- * map is implemented as a row-major order compact layout of pixels in the map.
- *
- * The pixel format of the map is XnIRPixel, i.e. 16-bit integer values.
- *
- * This method is reimplemented from the @ref xn::OutputMetaData class.
- */
- inline const XnIRPixel*& Data() { return (const XnIRPixel*&)MapMetaData::Data(); }
- /**
- * @copydoc OutputMetaData::WritableData
- */
- inline XnIRPixel* WritableData() { return (XnIRPixel*)MapMetaData::WritableData(); }
-
- /**
- * Gets the value of a single pixel of the frame map by its index in the array.
- *
- * @param [in] nIndex The index of the pixel in the buffer.
- */
- inline const XnIRPixel& operator[](XnUInt32 nIndex) const
- {
- XN_ASSERT(nIndex < (XRes()*YRes()));
- return Data()[nIndex];
- }
-
- /**
- * Gets the value of a single pixel of the frame map by its X and Y coordinates.
- *
- * @param [in] x X-coordinate of the pixel in the map
- * @param [in] y Y-coordinate of the pixel in the map
- */
- inline const XnIRPixel& operator()(XnUInt32 x, XnUInt32 y) const
- {
- XN_ASSERT(x < XRes() && y < YRes());
- return Data()[y*XRes() + x];
- }
-
- /**
- * @brief Gets a fast, light object wrapping the IR map.
- * <b>Remarks</b>
- *
- * The Map Wrapper classes are light wrappers for generated maps saved as @ref glos_frame_object
- * "frame objects" in metadata. These wrapper classes provide small data-focused
- * objects for simplified data access to frame objects.
- */
- inline const xn::IRMap& IRMap() const { return m_irMap; }
- /**
- * @brief Gets a fast, light object wrapping the writable IR map.
- * <b>Remarks</b>
- *
- * The Map Wrapper classes are light wrappers for generated maps saved as @ref glos_frame_object
- * "frame objects" in metadata. These wrapper classes provide small data-focused
- * objects for simplified data access to frame objects.
- */
- inline xn::IRMap& WritableIRMap() { MakeDataWritable(); return m_writableIRMap; }
-
- /**
- * @copydoc OutputMetaData::GetUnderlying
- */
- inline const XnIRMetaData* GetUnderlying() const { return &m_ir; }
- /**
- * @copydoc OutputMetaData::GetUnderlying
- */
- inline XnIRMetaData* GetUnderlying() { return &m_ir; }
-
- private:
- // block copy ctor and assignment operator
- IRMetaData(const IRMetaData& other);
- IRMetaData& operator=(const IRMetaData&);
-
- XnIRMetaData m_ir;
- const xn::IRMap m_irMap;
- xn::IRMap m_writableIRMap;
- };
-
- /**
- * @ingroup cppref_meta_data
- * For saving the audio data from the @ref xn::AudioGenerator node.
- * This saved metadata object provides fast and easy access to the AudioGenerator node's
- * data and configuration information.
- */
- class AudioMetaData : public OutputMetaData
- {
- public:
- XN_PRAGMA_START_DISABLED_WARNING_SECTION(XN_UNALIGNED_ADDRESS_WARNING_ID);
- inline AudioMetaData() : OutputMetaData(&m_audio.pData)
- {
- xnOSMemSet(&m_audio, 0, sizeof(XnAudioMetaData));
- m_audio.pOutput = OutputMetaData::GetUnderlying();
- }
-
- XN_PRAGMA_STOP_DISABLED_WARNING_SECTION;
-
- /**
- * @brief Shallow-Copies an AudioMetaData object.
- *
- * @param [in] other source object.
- *
- * @remarks Note that the data buffer is not copied, and that both object will point to the same buffer.
- */
- inline void InitFrom(const AudioMetaData& other)
- {
- xnCopyAudioMetaData(&m_audio, &other.m_audio);
- }
-
- /**
- * @brief Gets the number of channels in each sample. This is a packet configuration setting associated with the saved audio metadata object.
- */
- inline XnUInt8 NumberOfChannels() const { return m_audio.Wave.nChannels; }
- /**
- * @brief Gets the number of channels in each sample. This is a packet configuration setting associated with the saved audio metadata object.
- */
- inline XnUInt8& NumberOfChannels() { return m_audio.Wave.nChannels; }
-
- /**
- * @brief Gets the rate at which the audio interface was sampled. This is a packet configuration setting associated with the saved audio metadata object.
- */
- inline XnUInt32 SampleRate() const { return m_audio.Wave.nSampleRate; }
- /**
- * @brief Gets the rate at which the audio interface was sampled. This is a packet configuration setting associated with the saved audio metadata object.
- */
- inline XnUInt32& SampleRate() { return m_audio.Wave.nSampleRate; }
-
- /**
- * @brief Gets the number of bits per channel in a sample. This is a packet configuration setting associated with the saved audio metadata object.
- */
- inline XnUInt16 BitsPerSample() const { return m_audio.Wave.nBitsPerSample; }
- /**
- * @brief Gets the number of bits per channel in a sample. This is a packet configuration setting associated with the saved audio metadata object.
- */
- inline XnUInt16& BitsPerSample() { return m_audio.Wave.nBitsPerSample; }
-
- /**
- * @copydoc OutputMetaData::GetUnderlying
- */
- inline const XnAudioMetaData* GetUnderlying() const { return &m_audio; }
- /**
- * @copydoc OutputMetaData::GetUnderlying
- */
- inline XnAudioMetaData* GetUnderlying() { return &m_audio; }
-
- private:
- // block copy ctor and assignment operator
- AudioMetaData(const AudioMetaData& other);
- AudioMetaData& operator=(const AudioMetaData&);
-
- XnAudioMetaData m_audio;
- };
-
- /**
- * @ingroup cppref_meta_data
- * Saves the @ref glos_frame_object "frame object" (data and configuration)
- * from the @ref xn::SceneAnalyzer node. This @ref glos_frame_object "frame object"
- * is a snapshot of the generated scene data and its associated configuration information
- * at a certain point in time. This metadata provides fast and easy access to the SceneAnalyzer
- * node's saved frame object.
- */
- class SceneMetaData : public MapMetaData
- {
- public:
- inline SceneMetaData() :
- MapMetaData(XN_PIXEL_FORMAT_GRAYSCALE_16_BIT, (const XnUInt8**)&m_scene.pData),
- m_labelMap(const_cast<XnLabel*&>(m_scene.pData), MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y),
- m_writableLabelMap((XnLabel*&)m_pAllocatedData, MapMetaData::GetUnderlying()->Res.X, MapMetaData::GetUnderlying()->Res.Y)
- {
- xnOSMemSet(&m_scene, 0, sizeof(XnSceneMetaData));
- m_scene.pMap = MapMetaData::GetUnderlying();
- }
-
- /**
- * @brief Shallow-Copies an SceneMetaData object.
- *
- * @param [in] other source object.
- *
- * @remarks Note that the data buffer is not copied, and that both object will point to the same buffer.
- */
- inline void InitFrom(const SceneMetaData& other)
- {
- xnCopySceneMetaData(&m_scene, &other.m_scene);
- }
-
- /**
- * Shallow copies another SceneMetaData object, and then @ref ReAdjust it.
- *
- * @param [in] other source object
- * @param [in] nXRes requested number of columns in the map
- * @param [in] nYRes requested number of rows in the map
- * @param [in] pExternalBuffer Optional. An external buffer matching requested resolution. If NULL,
- * A buffer will be allocated.
- */
- inline XnStatus InitFrom(const SceneMetaData& other, XnUInt32 nXRes, XnUInt32 nYRes, const XnLabel* pExternalBuffer)
- {
- InitFrom(other);
- return ReAdjust(nXRes, nYRes, pExternalBuffer);
- }
-
- /**
- * Performs a deep-copy of another metadata object (including duplication of the data buffer)
- *
- * @param [in] other source object
- */
- XnStatus CopyFrom(const SceneMetaData& other)
- {
- // copy props
- xnCopySceneMetaData(&m_scene, &other.m_scene);
- // and make a copy of the data (this will allocate and copy data)
- return MakeDataWritable();
- }
-
- /**
- * @copydoc DepthMetaData::ReAdjust
- */
- XnStatus ReAdjust(XnUInt32 nXRes, XnUInt32 nYRes, const XnLabel* pExternalBuffer = NULL)
- {
- return MapMetaData::ReAdjust(nXRes, nYRes, (const XnUInt8*)pExternalBuffer);
- }
-
- /**
- * @brief Returns the scene map.
- *
- * <b>Remarks</b>
- *
- * This method returns a pointer to the first scene pixel in the map. The scene
- * map is implemented as a row-major order compact layout of pixels in the map.
- *
- * The pixel format of the map is XnLabel, i.e. 16-bit integer values, where every
- * user has a distinct label.
- *
- * This method is reimplemented from the @ref xn::OutputMetaData class.
- */
- inline const XnLabel* Data() const { return (const XnLabel*)MapMetaData::Data(); }
- /**
- * @brief Returns the scene map.
- *
- * <b>Remarks</b>
- *
- * This method returns a pointer to the first scene pixel in the map. The scene
- * map is implemented as a row-major order compact layout of pixels in the map.
- *
- * The pixel format of the map is XnLabel, i.e. 16-bit integer values, where every
- * user has a distinct label.
- *
- * This method is reimplemented from the @ref xn::OutputMetaData class.
- */
- inline const XnLabel*& Data() { return (const XnLabel*&)MapMetaData::Data(); }
-
- /**
- * @copydoc OutputMetaData::WritableData
- */
- inline XnLabel* WritableData() { return (XnLabel*)MapMetaData::WritableData(); }
-
- /**
- * Gets a light object wrapping the label map
- */
- inline const xn::LabelMap& LabelMap() const { return m_labelMap; }
- /**
- * Gets a light object wrapping the writable label map
- */
- inline xn::LabelMap& WritableLabelMap() { MakeDataWritable(); return m_writableLabelMap; }
-
- /**
- * Gets the label of a single pixel of the frame map by its index in the array.
- *
- * @param [in] nIndex The index of the pixel in the buffer.
- *
- * <b>Remarks</b>
- *
- * The values are of type @ref XnLabel. Each pixel's value labels it according to
- * user.
- */
- inline const XnLabel& operator[](XnUInt32 nIndex) const
- {
- XN_ASSERT(nIndex < (XRes()*YRes()));
- return Data()[nIndex];
- }
-
- /**
- * Gets the label of a single pixel of the frame map by its X and Y positions.
- *
- * @param [in] x X-coordinate of the pixel in the map
- * @param [in] y Y-coordinate of the pixel in the map
- *
- * <b>Remarks</b>
- *
- * The values are of type @ref XnLabel. Each pixel's value labels it according to
- * user.
- */
- inline const XnLabel& operator()(XnUInt32 x, XnUInt32 y) const
- {
- XN_ASSERT(x < XRes() && y < YRes());
- return (*this)[y*XRes() + x];
- }
-
- /**
- * @copydoc OutputMetaData::GetUnderlying
- */
- inline const XnSceneMetaData* GetUnderlying() const { return &m_scene; }
- /**
- * @copydoc OutputMetaData::GetUnderlying
- */
- inline XnSceneMetaData* GetUnderlying() { return &m_scene; }
-
- private:
- // block copy ctor and assignment operator
- SceneMetaData(const SceneMetaData& other);
- SceneMetaData& operator=(const SceneMetaData&);
-
- XnSceneMetaData m_scene;
- const xn::LabelMap m_labelMap;
- xn::LabelMap m_writableLabelMap;
- };
-
- //---------------------------------------------------------------------------
- // NodeWrapper
- //---------------------------------------------------------------------------
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> The NodeWrapper class is the base class for all OpenNI production
- * node classes in C++, for example, the @ref xn::ProductionNode class and the @ref
- * xn::Generator class.
- *
- * The NodeWrapper class is the C++ API wrapper around the OpenNI C XnNodeHandle API.
- *
- * <b>Remarks:</b>
- *
- * A fundamental OpenNI concept that is critical to understand about nodes and node
- * creation is that all C++ objects are "smart pointers" to the actual nodes. The reason
- * why OpenNI is designed this way is so that the same node can be used to produce data
- * (or provide information) for more than just one (dependant) node or for more than
- * just one software component.
- *
- * When instantiating an object of this class, it doesn't point to any actual node. In order
- * to create an actual node, use one of the <code>Create()</code> methods (e.g. @ref DepthGenerator::Create()).
- */
- class NodeWrapper
- {
- public:
- friend class Context;
-
- /**
- * Ctor
- *
- * @param [in] hNode A node handle.
- */
- inline NodeWrapper(XnNodeHandle hNode) : m_hNode(NULL), m_hShuttingDownCallback(NULL)
- {
- SetHandle(hNode);
- }
-
- inline NodeWrapper(const NodeWrapper& other) : m_hNode(NULL), m_hShuttingDownCallback(NULL)
- {
- SetHandle(other.GetHandle());
- }
-
- inline NodeWrapper& operator=(const NodeWrapper& other)
- {
- SetHandle(other.GetHandle());
- return *this;
- }
-
- inline ~NodeWrapper()
- {
- SetHandle(NULL);
- }
-
- inline operator XnNodeHandle() const { return GetHandle(); }
-
- /**
- * Gets the underlying C handle.
- */
- inline XnNodeHandle GetHandle() const { return m_hNode; }
-
- /**
- * Checks if two node references point to the same actual node
- *
- * @param [in] other Another object
- */
- inline XnBool operator==(const NodeWrapper& other)
- {
- return (GetHandle() == other.GetHandle());
- }
-
- /**
- * Checks if two node references do <i>not</i> point to the same actual node.
- *
- * @param [in] other Another object
- */
- inline XnBool operator!=(const NodeWrapper& other)
- {
- return (GetHandle() != other.GetHandle());
- }
-
- /** @brief
- * This method checks that this object points to an <i>actual</i> node (that has
- * been 'created') and does not point to NULL.
- *
- * Returns TRUE if the object points to a node, i.e., the node has been 'created';
- * FALSE otherwise.
- *
- * <b>Remarks</b>
- *
- * This method is a very important for managing nodes in the production graph. This
- * check is concerned with the stage before actually creating the node, i.e., before
- * invoking the node's <code>Create()</code> method.
- */
- inline XnBool IsValid() const { return (GetHandle() != NULL); }
-
- /*
- * @brief Gets the instance name of a node. Unless the application made a specific
- * request for a specific name, the name will be of the form: "Depth1", "Image2", etc.
- */
- const XnChar* GetName() const {return xnGetNodeName(GetHandle()); }
-
- /**
- * @copybrief xnProductionNodeAddRef
- * For full details and usage, see @ref xnProductionNodeAddRef
- */
- inline XnStatus AddRef() { return xnProductionNodeAddRef(GetHandle()); }
-
- /**
- * Unreference a production node, decreasing its reference count by 1. If the reference count reaches
- * zero, the node will be destroyed.
- */
- inline void Release()
- {
- SetHandle(NULL);
- }
-
-
- /**
- * Replaces the object being pointed.
- */
- inline void SetHandle(XnNodeHandle hNode)
- {
- if (m_hNode == hNode)
- {
- // Optimization: do nothing
- return;
- }
-
- // check currently held node. If we're holding a node, release it
- if (m_hNode != NULL)
- {
- XnContext* pContext = xnGetRefContextFromNodeHandle(m_hNode);
- xnContextUnregisterFromShutdown(pContext, m_hShuttingDownCallback);
- xnContextRelease(pContext);
- xnProductionNodeRelease(m_hNode);
- }
-
- // check new node handle, if it points to a node, add ref to it
- if (hNode != NULL)
- {
- XnStatus nRetVal = xnProductionNodeAddRef(hNode);
- XN_ASSERT(nRetVal == XN_STATUS_OK);
- XN_REFERENCE_VARIABLE(nRetVal);
-
- XnContext* pContext = xnGetRefContextFromNodeHandle(hNode);
-
- nRetVal = xnContextRegisterForShutdown(pContext, ContextShuttingDownCallback, this, &m_hShuttingDownCallback);
- XN_ASSERT(nRetVal == XN_STATUS_OK);
-
- xnContextRelease(pContext);
- }
-
- m_hNode = hNode;
- }
-
- inline void TakeOwnership(XnNodeHandle hNode)
- {
- SetHandle(hNode);
-
- if (hNode != NULL)
- {
- xnProductionNodeRelease(hNode);
- }
- }
-
- /** @cond */
- inline XnStatus XN_API_DEPRECATED("Please use AddRef() instead.") Ref() { return AddRef(); }
- inline void XN_API_DEPRECATED("Please use Release() instead.") Unref() { Release(); }
- /** @endcond */
-
- private:
- XnNodeHandle m_hNode;
- XnCallbackHandle m_hShuttingDownCallback;
-
- static void XN_CALLBACK_TYPE ContextShuttingDownCallback(XnContext* /*pContext*/, void* pCookie)
- {
- NodeWrapper* pThis = (NodeWrapper*)pCookie;
- pThis->m_hNode = NULL;
- }
- };
-
- //---------------------------------------------------------------------------
- // Node Info
- //---------------------------------------------------------------------------
-
- /**
- * @ingroup cppref_graph_mgmt
- * <b>Purpose:</b> This class provides functionality for getting information about a
- * @ref node_alternative "node alternative". A @ref node_alternative is either an existing
- * node, or a not-yet instantiated alternative.
- *
- * <b>Remarks:</b>
- *
- * Each instantiated node has a NodeInfo object and it can be accessed through the @ref
- * xn::ProductionNode::GetInfo() method.
- */
- class NodeInfo
- {
- public:
- /**
- * Ctor
- *
- * @param [in] pInfo The C object to wrap
- */
- NodeInfo(XnNodeInfo* pInfo) : m_pNeededNodes(NULL), m_bOwnerOfNode(FALSE)
- {
- SetUnderlyingObject(pInfo);
- }
-
- /**
- * Copy Ctor
- *
- * @param [in] other An object to copy from.
- */
- NodeInfo(const NodeInfo& other) : m_pNeededNodes(NULL), m_bOwnerOfNode(FALSE)
- {
- SetUnderlyingObject(other.m_pInfo);
- }
-
- /**
- * Dtor
- */
- ~NodeInfo()
- {
- SetUnderlyingObject(NULL);
- }
-
- /**
- * Assignment operator
- *
- * @param [in] other another object
- */
- inline NodeInfo& operator=(const NodeInfo& other)
- {
- SetUnderlyingObject(other.m_pInfo);
- return *this;
- }
-
- /**
- * Gets the underlying C object
- */
- inline operator XnNodeInfo*()
- {
- return m_pInfo;
- }
-
- /**
- * @brief Sets the instance name of the NodeInfo object. The name can only be set <i>before the instance is created</i>.
- *
- * @param [in] strName Name to give to this instance.
- */
- inline XnStatus SetInstanceName(const XnChar* strName)
- {
- return xnNodeInfoSetInstanceName(m_pInfo, strName);
- }
-
- /**
- * @brief Gets the description of a node alternative.
- *
- * <b>Remarks</b>
- *
- * When you instantiate a production node object -- for example a DepthGenerator
- * -- you cannot access it's NodeInfo object until after <code>Create()</code>
- * has been called.
- *
- * However - you can also get NodeInfo objects by enumeration, for example, from
- * the @ref xn::Context::EnumerateProductionTrees() "EnumerateProductionTrees()"
- * method.
- */
- inline const XnProductionNodeDescription& GetDescription() const
- {
- return *xnNodeInfoGetDescription(m_pInfo);
- }
-
- /**
- * @brief Gets the instance name of a node alternative.
- *
- * <b>Remarks</b>
- *
- * When you instantiate a DepthGenerator object, for example, you cannot access
- * it's NodeInfo object until after its <code>Create()</code> method has been called.
- *
- * However - you can also get NodeInfo objects by enumeration, for example, from
- * the EnumerateProductionTrees() method.
- */
- inline const XnChar* GetInstanceName() const
- {
- return xnNodeInfoGetInstanceName(m_pInfo);
- }
-
- /**
- * @brief Gets the creation information of the node alternative.
- *
- * <b>Remarks</b>
- *
- * A node's creation information is a way for a node implementation to have two
- * distinct instances of the same node class, that is two nodes.
- * For example, a Device node implementation can use this field for the name of
- * the device it represents, so that if two sensors are connected, each will have
- * a different value here.
- */
- inline const XnChar* GetCreationInfo() const
- {
- return xnNodeInfoGetCreationInfo(m_pInfo);
- }
-
- /*
- * @brief Gets the list of dependant nodes for this node alternative.
- * These are any other node alternatives that the node is dependant on.
- */
- inline NodeInfoList& GetNeededNodes() const;
-
- /**
- * Gets a reference to the node instance represented by this node alternative.
- *
- * @param node [in/out] The production node to be pointing to the node.
- *
- * @returns an error if this node info object does not point to an actual node.
- */
- inline XnStatus GetInstance(ProductionNode& node) const;
-
- /**
- * @copybrief xnNodeInfoGetAdditionalData
- * For full details and usage, see @ref xnNodeInfoGetAdditionalData
- */
- inline const void* GetAdditionalData() const
- {
- return xnNodeInfoGetAdditionalData(m_pInfo);
- }
-
- /**
- * @copybrief xnNodeInfoGetTreeStringRepresentation
- * For full details and usage, see @ref xnNodeInfoGetTreeStringRepresentation
- */
- inline XnStatus GetTreeStringRepresentation(XnChar* csResultBuffer, XnUInt32 nBufferSize) const
- {
- return xnNodeInfoGetTreeStringRepresentation(m_pInfo, csResultBuffer, nBufferSize);
- }
-
- private:
- inline void SetUnderlyingObject(XnNodeInfo* pInfo);
-
- XnNodeInfo* m_pInfo;
- mutable NodeInfoList* m_pNeededNodes;
- XnBool m_bOwnerOfNode; // backwards compatibility
- friend class Context;
- };
-
- //---------------------------------------------------------------------------
- // Query
- //---------------------------------------------------------------------------
-
- /**
- * @ingroup cppref_graph_mgmt
- *
- * <b>Purpose:</b> Represents a query, containing filters regarding node info objects.
- * Note that the relation between the filters is an AND relation.
- *
- * <b>Usage: </b> Instantiate a Query object and then use the provided methods to set
- * up the filter conditions.
- *
- * <b>Remarks:</b>
- * The Query class provides a mechanism for searching and returning NodeInfo objects
- * from a list while filtering them according to a filter argument. The relation between
- * the filters is an AND relationship.
- *
- * The mechanism works by instantiating a Query object and then using the provided methods
- * to set up the filter conditions. The Query object is then used by a number of methods
- * that search for nodes, e.g., the Create() method.
- */
- class Query
- {
- public:
- inline Query() : m_bAllocated(TRUE)
- {
- xnNodeQueryAllocate(&m_pQuery);
- }
-
- inline Query(XnNodeQuery* pNodeQuery) : m_bAllocated(FALSE), m_pQuery(pNodeQuery)
- {
- }
-
- ~Query()
- {
- if (m_bAllocated)
- {
- xnNodeQueryFree(m_pQuery);
- }
- }
-
- /**
- * Gets the underlying C object
- */
- inline const XnNodeQuery* GetUnderlyingObject() const { return m_pQuery; }
- inline XnNodeQuery* GetUnderlyingObject() { return m_pQuery; }
-
- /**
- * @brief Sets in the Query object the vendor name to search for.
- * @param [in] strVendor Vendor Name.
- */
- inline XnStatus SetVendor(const XnChar* strVendor)
- {
- return xnNodeQuerySetVendor(m_pQuery, strVendor);
- }
-
- /**
- * @brief Sets in the Query object the implementation name to search for.
- * The same vendor might have more than one implementation, for example,
- * two @ref xn::DepthGenerator "DepthGenerators" "SensorV2" and "EEDepthGenerator".
- * This is not the same as the instance name.
- *
- * @param [in] strName Implementation name.
- */
- inline XnStatus SetName(const XnChar* strName)
- {
- return xnNodeQuerySetName(m_pQuery, strName);
- }
-
- /**
- * @brief Sets in the Query object the minimum required version allowed for the @ref node_alternative.
- */
- inline XnStatus SetMinVersion(const XnVersion& minVersion)
- {
- return xnNodeQuerySetMinVersion(m_pQuery, &minVersion);
- }
-
- /**
- * @brief Sets in the Query object the minimum required version allowed for the @ref node_alternative.
- */
- inline XnStatus SetMinVersion(const Version& minVersion)
- {
- return xnNodeQuerySetMinVersion(m_pQuery, minVersion.GetUnderlying());
- }
-
- /**
- * @brief Sets in the Query object the maximum required version allowed for the node alternative.
- */
- inline XnStatus SetMaxVersion(const XnVersion& maxVersion)
- {
- return xnNodeQuerySetMaxVersion(m_pQuery, &maxVersion);
- }
-
- /**
- * @brief Sets in the Query object the maximum required version allowed for the node alternative.
- */
- inline XnStatus SetMaxVersion(const Version& maxVersion)
- {
- return xnNodeQuerySetMaxVersion(m_pQuery, maxVersion.GetUnderlying());
- }
-
- /**
- * @brief Sets in the Query object a capability that the @ref node_alternative must support.
- *
- * @param [in] strNeededCapability Name of the capability that the @ref node_alternative
- * must support.
- *
- * <b>Remarks</b>
- *
- * Note that for checking if a capability is supported, the node must be created
- * if it's not an already existing node. This operation might take a bit longer
- * than usual.
- */
- inline XnStatus AddSupportedCapability(const XnChar* strNeededCapability)
- {
- return xnNodeQueryAddSupportedCapability(m_pQuery, strNeededCapability);
- }
-
- /**
- * @brief Sets in the Query object a MapOutput mode that the @ref node_alternative must support.
- *
- * @param [in] MapOutputMode Map output mode. Each field of the mode can be set to
- * (-1), meaning results will not be filtered by this field.
- *
- * @remark Note that for checking if a capability is supported, the node must be created
- * if it's not an already existing node. This operation might take a bit longer
- * than usual.
- */
- inline XnStatus AddSupportedMapOutputMode(const XnMapOutputMode& MapOutputMode)
- {
- return xnNodeQueryAddSupportedMapOutputMode(m_pQuery, &MapOutputMode);
- }
-
- /**
- * @copybrief xnNodeQuerySetSupportedMinUserPositions
- * For full details and usage, see @ref xnNodeQuerySetSupportedMinUserPositions
- */
- inline XnStatus SetSupportedMinUserPositions(const XnUInt32 nCount)
- {
- return xnNodeQuerySetSupportedMinUserPositions(m_pQuery, nCount);
- }
-
- /**
- * @brief Sets in the Query object that the query will return only existing nodes,
- * i.e., nodes that have been created, in other words their <code>Create()</code> method has been called.
- *
- * @param [in] bExistingNode TRUE to return only existing nodes, FALSE otherwise.
- *
- * <b>Remarks</b>
- *
- * Note that there are many ways to create nodes, not just by their @ref create_method
- * "Create() method".
- */
- inline XnStatus SetExistingNodeOnly(XnBool bExistingNode)
- {
- return xnNodeQuerySetExistingNodeOnly(m_pQuery, bExistingNode);
- }
-
- /**
- * @brief Sets in the Query object that a specified node must be a dependant of the named node type.
- * @param [in] strInstanceName Name of the needed node.
- */
- inline XnStatus AddNeededNode(const XnChar* strInstanceName)
- {
- return xnNodeQueryAddNeededNode(m_pQuery, strInstanceName);
- }
-
- /**
- * @brief Sets the creation information field of the Query object. This relates to the creation information of the @ref xn::NodeInfo class.
- * @param [in] strCreationInfo Creation information to set in the Query object.
- */
- inline XnStatus SetCreationInfo(const XnChar* strCreationInfo)
- {
- return xnNodeQuerySetCreationInfo(m_pQuery, strCreationInfo);
- }
-
- private:
- XnNodeQuery* m_pQuery;
- XnBool m_bAllocated;
- };
-
- //---------------------------------------------------------------------------
- // Node Info List
- //---------------------------------------------------------------------------
-
- /**
- * @ingroup cppref_graph_mgmt
- * A NodeInfoList object contains a list of @ref NodeInfo objects.
- */
- class NodeInfoList
- {
- public:
- /**
- * Represents an iterator over a @ref NodeInfoList list.
- */
- class Iterator
- {
- public:
- friend class NodeInfoList;
-
- /**
- * Returns whether the iterator points to the same location as another iterator.
- *
- * @param [in] other Another iterator
- *
- * <b>Remarks</b>
- *
- * This method can be used for checking if the two iterators are pointing to
- * the same NodeInfo object.
- *
- * Note that the two iterators can also both point to NULL.
- */
- XnBool operator==(const Iterator& other) const
- {
- return m_it.pCurrent == other.m_it.pCurrent;
- }
-
- /**
- * Returns whether the iterator points to a different location than another
- * iterator.
- *
- * @param [in] other Another iterator
- */
- XnBool operator!=(const Iterator& other) const
- {
- return m_it.pCurrent != other.m_it.pCurrent;
- }
-
- /**
- * Moves the iterator to the next object. If the end of the list was reached,
- * the iterator will now be equal to @ref NodeInfoList::End().
- */
- inline Iterator& operator++()
- {
- UpdateInternalObject(xnNodeInfoListGetNext(m_it));
- return *this;
- }
-
- /**
- * Returns an iterator pointing at the next object. If the end of the list was
- * reached, that iterator will now be equal to @ref NodeInfoList::End().
- */
- inline Iterator operator++(int)
- {
- XnNodeInfoListIterator curr = m_it;
- UpdateInternalObject(xnNodeInfoListGetNext(m_it));
- return Iterator(curr);
- }
-
- /**
- * Moves the iterator to the previous object.
- */
- inline Iterator& operator--()
- {
- UpdateInternalObject(xnNodeInfoListGetPrevious(m_it));
- return *this;
- }
-
- /**
- * Returns an iterator pointing at the previous object.
- */
- inline Iterator operator--(int)
- {
- XnNodeInfoListIterator curr = m_it;
- UpdateInternalObject(xnNodeInfoListGetPrevious(m_it));
- return Iterator(curr);
- }
-
- /**
- * Gets the @ref NodeInfo object pointed by the iterator.
- */
- inline NodeInfo operator*()
- {
- return m_Info;
- }
-
- private:
- inline Iterator(XnNodeInfoListIterator it) : m_Info(NULL)
- {
- UpdateInternalObject(it);
- }
-
- inline void UpdateInternalObject(XnNodeInfoListIterator it)
- {
- m_it = it;
- if (xnNodeInfoListIteratorIsValid(it))
- {
- XnNodeInfo* pInfo = xnNodeInfoListGetCurrent(it);
- m_Info = NodeInfo(pInfo);
- }
- else
- {
- m_Info = NodeInfo(NULL);
- }
- }
-
- NodeInfo m_Info;
- XnNodeInfoListIterator m_it;
- };
-
- /**
- * Creates a new @ref NodeInfoList object.
- */
- inline NodeInfoList()
- {
- xnNodeInfoListAllocate(&m_pList);
- m_bAllocated = TRUE;
- }
-
- /**
- * Creates a new @ref NodeInfoList object by wrapping a C @ref XnNodeInfoList object.
- * Note that this list will not be freed upon destruction.
- *
- * @param [in] pList The list to wrap.
- */
- inline NodeInfoList(XnNodeInfoList* pList) : m_pList(pList), m_bAllocated(FALSE) {}
-
- inline ~NodeInfoList()
- {
- FreeImpl();
- }
-
- /**
- * Gets the underlying C object.
- */
- inline XnNodeInfoList* GetUnderlyingObject() const { return m_pList; }
-
- /**
- * Replaces the underlying object, taking ownership of the object (meaning, it
- * will be freed upon destruction).
- *
- * @param [in] pList The list to wrap.
- */
- inline void ReplaceUnderlyingObject(XnNodeInfoList* pList)
- {
- FreeImpl();
- m_pList = pList;
- m_bAllocated = TRUE;
- }
-
- /**
- * @copybrief xnNodeInfoListAdd
- * For full details and usage, see @ref xnNodeInfoListAdd
- */
- inline XnStatus Add(XnProductionNodeDescription& description, const XnChar* strCreationInfo, NodeInfoList* pNeededNodes)
- {
- XnNodeInfoList* pList = (pNeededNodes == NULL) ? NULL : pNeededNodes->GetUnderlyingObject();
- return xnNodeInfoListAdd(m_pList, &description, strCreationInfo, pList);
- }
-
- /**
- * @copybrief xnNodeInfoListAddEx
- * For full details and usage, see @ref xnNodeInfoListAddEx
- */
- inline XnStatus AddEx(XnProductionNodeDescription& description, const XnChar* strCreationInfo, NodeInfoList* pNeededNodes, const void* pAdditionalData, XnFreeHandler pFreeHandler)
- {
- XnNodeInfoList* pList = (pNeededNodes == NULL) ? NULL : pNeededNodes->GetUnderlyingObject();
- return xnNodeInfoListAddEx(m_pList, &description, strCreationInfo, pList, pAdditionalData, pFreeHandler);
- }
-
- /**
- * @copybrief xnNodeInfoListAddNode
- * For full details and usage, see @ref xnNodeInfoListAddNode
- */
- inline XnStatus AddNode(NodeInfo& info)
- {
- return xnNodeInfoListAddNode(m_pList, info);
- }
-
- /**
- * @copybrief xnNodeInfoListAddNodeFromList
- * For full details and usage, see @ref xnNodeInfoListAddNodeFromList
- */
- inline XnStatus AddNodeFromAnotherList(Iterator& it)
- {
- return xnNodeInfoListAddNodeFromList(m_pList, it.m_it);
- }
-
- /**
- * Returns an iterator to the beginning of the list. If the list
- * is empty, that iterator will be equal to @ref NodeInfoList::End().
- */
- inline Iterator Begin() const
- {
- return Iterator(xnNodeInfoListGetFirst(m_pList));
- }
-
- /**
- * Returns an iterator marking the end of the list.
- * This iterator does not point to a valid item.
- */
- inline Iterator End() const
- {
- XnNodeInfoListIterator it = { NULL };
- return Iterator(it);
- }
-
- /**
- * Returns an iterator to the reverse beginning of the list. If the list
- * is empty, that iterator will be equal to @ref NodeInfoList::REnd().
- */
- inline Iterator RBegin() const
- {
- return Iterator(xnNodeInfoListGetLast(m_pList));
- }
-
- /**
- * Returns an iterator marking the reverse end of the list.
- * This iterator does not point to a valid item.
- */
- inline Iterator REnd() const
- {
- XnNodeInfoListIterator it = { NULL };
- return Iterator(it);
- }
-
- /**
- * @copybrief xnNodeInfoListRemove
- * For full details and usage, see @ref xnNodeInfoListRemove
- */
- inline XnStatus Remove(Iterator& it)
- {
- return xnNodeInfoListRemove(m_pList, it.m_it);
- }
-
- /**
- * @copybrief xnNodeInfoListClear
- * For full details and usage, see @ref xnNodeInfoListClear
- */
- inline XnStatus Clear()
- {
- return xnNodeInfoListClear(m_pList);
- }
-
- /**
- * @copybrief xnNodeInfoListAppend
- * For full details and usage, see @ref xnNodeInfoListAppend
- */
- inline XnStatus Append(NodeInfoList& other)
- {
- return xnNodeInfoListAppend(m_pList, other.GetUnderlyingObject());
- }
-
- /**
- * @brief Checks if the list NodeInfoList object is empty.
- */
- inline XnBool IsEmpty()
- {
- return xnNodeInfoListIsEmpty(m_pList);
- }
-
- /**
- * @copybrief xnNodeQueryFilterList
- * For full details and usage, see @ref xnNodeQueryFilterList
- */
- inline XnStatus FilterList(Context& context, Query& query);
-
- private:
- inline void FreeImpl()
- {
- if (m_bAllocated)
- {
- xnNodeInfoListFree(m_pList);
- m_bAllocated = FALSE;
- m_pList = NULL;
- }
- }
-
- XnNodeInfoList* m_pList;
- XnBool m_bAllocated;
- };
-
- //---------------------------------------------------------------------------
- // Production Nodes Functionality
- //---------------------------------------------------------------------------
-
- /**
- * @ingroup cppref_prd_func
- * Base class for all capabilities.
- */
- class Capability : public NodeWrapper
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode The node handle
- */
- Capability(XnNodeHandle hNode) : NodeWrapper(hNode) {}
- Capability(const NodeWrapper& node) : NodeWrapper(node) {}
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> The Error State capability lets a node report that it has entered
- * an error state, and so might not function correctly.
- *
- * <b>Usage:</b> Do not instantiate directly. Instead, use @ref ProductionNode::GetErrorStateCap()
- * to obtain an instance.
- *
- * <b>Remarks:</b>
- *
- * An application can use the @ref GetErrorState() method to get the error state of
- * a node at any time, and it can also register a callback function to be called whenever
- * the error state changes.
- *
- * The error state of a node is represented using @ref XnStatus. A value of @ref XN_STATUS_OK
- * means the node is OK. Any other value represents some sort of error situation in
- * the node.
- *
- * <b>Event: 'Error State Change'</b>
- *
- * Signals that the @ref holder_node "holder node"'s error state has changed.
- *
- * This is the same value that can be obtained by the @ref GetErrorState() method.
- *
- * This event can be used by the application to get a signal as soon as any error occurs
- * in the @ref holder_node "holder node". By handling all the error states of all nodes,
- * the application can use this event to respond immediately to any error situation.
- *
- * Use @ref RegisterToErrorStateChange() and @ref UnregisterFromErrorStateChange() for using this event.
- *
- * Instead of registering to the error state callback of all the nodes in the context,
- * an application may register to the 'Global Error State Change' event - see @ref context_global_error_event.
- */
- class ErrorStateCapability : public Capability
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- ErrorStateCapability(XnNodeHandle hNode) : Capability(hNode) {}
- ErrorStateCapability(const NodeWrapper& node) : Capability(node) {}
-
- /**
- * @brief Gets the current error state of the holding node.
- */
- inline XnStatus GetErrorState() const
- {
- return xnGetNodeErrorState(GetHandle());
- }
-
- /**
- * @brief Registers an event handler for the 'Error State Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback. To be used for unregistering the callback.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToErrorStateChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToNodeErrorStateChange, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters the event handler for the 'Error State Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromErrorStateChange(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromNodeErrorStateChange, GetHandle(), hCallback);
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * Allows access to general integer capabilities functions - see @ref general_int for
- * additional details.
- */
- class GeneralIntCapability : public Capability
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- * @param [in] strCap Name of the capability
- */
- GeneralIntCapability(XnNodeHandle hNode, const XnChar* strCap) : Capability(hNode), m_strCap(strCap) {}
- GeneralIntCapability(const NodeWrapper& node, const XnChar* strCap) : Capability(node), m_strCap(strCap) {}
-
- /**
- * @copybrief xnGetGeneralIntRange
- * For full details and usage, see @ref xnGetGeneralIntRange
- */
- inline void GetRange(XnInt32& nMin, XnInt32& nMax, XnInt32& nStep, XnInt32& nDefault, XnBool& bIsAutoSupported) const
- {
- xnGetGeneralIntRange(GetHandle(), m_strCap, &nMin, &nMax, &nStep, &nDefault, &bIsAutoSupported);
- }
-
- /**
- * @copybrief xnGetGeneralIntValue
- * For full details and usage, see @ref xnGetGeneralIntValue
- */
- inline XnInt32 Get()
- {
- XnInt32 nValue;
- xnGetGeneralIntValue(GetHandle(), m_strCap, &nValue);
- return nValue;
- }
-
- /**
- * @copybrief xnSetGeneralIntValue
- * For full details and usage, see @ref xnSetGeneralIntValue
- */
- inline XnStatus Set(XnInt32 nValue)
- {
- return xnSetGeneralIntValue(GetHandle(), m_strCap, nValue);
- }
-
- /**
- * @brief Registers an event handler for the 'Value Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- XnStatus RegisterToValueChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback);
-
- /**
- * @brief Unregisters the event handler for the 'Value Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- void UnregisterFromValueChange(XnCallbackHandle hCallback);
-
- private:
- const XnChar* m_strCap;
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> The ProductionNode class is a base class for all production nodes
- * and generator nodes. As such, the ProductionNode class is the fundamental base class
- * of the entire OpenNI interface for building and accessing the production graph.
- *
- * <b>Usage:</b> Base class for all production nodes; not usually instantiated.
- *
- * <b>Class Overview:</b>
- *
- * The OpenNI Production Graph is comprised entirely of production nodes of one type
- * or another. The ProductionNode class itself exposes a very limited functionality
- * set. This is the most basic and common functionality set of all the nodes in the
- * graph.
- *
- * All types of core generator nodes are derived from this ProductionNode class, for
- * example, the @ref xn::DepthGenerator node and the @ref xn::Device node. Each node
- * type has its own set of methods that it supports.
- *
- * Two of the most important methods provided by the ProductionNode class are @ref IsCapabilitySupported()
- * and @ref GetContext(), both described further below.
- *
- * <b>Capabilities Mechanism:</b>
- *
- * In addition to being the base class for all core generator nodes, the ProductionNode
- * class also provides key support for the OpenNI capabilities mechanism. OpenNI defines
- * core functionality which is always supported by all node implementations of a specific node
- * type. Additional optional functionality is also defined by OpenNI and exposed
- * as "capabilities".
- * The ProductionNode class provides the @ref IsCapabilitySupported() method to check
- * if this specific implementation supports a certain capability.
- *
- * For a comprehensive overview to the Capabilities mechanism see @ref conc_capabilities
- * "Capabilities Mechanism".
- */
- class ProductionNode : public NodeWrapper
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline ProductionNode(XnNodeHandle hNode = NULL) : NodeWrapper(hNode) {}
- inline ProductionNode(const NodeWrapper& other) : NodeWrapper(other) {}
-
- /**
- * @brief Gets information about the node.
- *
- * <b>Remarks</b>
- *
- * This method returns a @ref xn::NodeInfo object containing information such as
- * the node description and the identities of dependent nodes.
- */
- inline NodeInfo GetInfo() const { return NodeInfo(xnGetNodeInfo(GetHandle())); }
-
- /**
- * @copybrief xnAddNeededNode
- * For full details and usage, see @ref xnAddNeededNode
- */
- inline XnStatus AddNeededNode(ProductionNode& needed)
- {
- return xnAddNeededNode(GetHandle(), needed.GetHandle());
- }
-
- /**
- * @copybrief xnRemoveNeededNode
- * For full details and usage, see @ref xnRemoveNeededNode
- */
- inline XnStatus RemoveNeededNode(ProductionNode& needed)
- {
- return xnRemoveNeededNode(GetHandle(), needed.GetHandle());
- }
-
- /**
- * @brief Gets the node's context.
- *
- * @param [out] context The node's context.
- *
- * <b>Remarks</b>
- *
- * This method is useful for applications that have to take into account the
- * possibility of multiple contexts. Using this method, the application can access
- * all other nodes and other resources within the same context.
- */
- inline void GetContext(Context& context) const;
-
- /**
- * @brief Gets the node's context
- *
- * <b>Remarks</b>
- *
- * This method is useful for applications that have to take into account the
- * possibility of multiple contexts. Using this method, the application can access
- * all other nodes and other resources within the same context.
- */
- inline Context GetContext() const;
-
- /**
- * @brief Returns whether a production node supports a specific capability.
- *
- * @param [in] strCapabilityName The capability name to check.
- *
- * <b>Remarks</b>
- *
- * The application specifies the capability by supplying the capability's name in
- * the <i>strCapabilityName</i> parameter. Before attempting to access any capability
- * this method should be used to check that this node actually supports this capability.
- */
- inline XnBool IsCapabilitySupported(const XnChar* strCapabilityName) const
- {
- return xnIsCapabilitySupported(GetHandle(), strCapabilityName);
- }
-
- /**
- * @copybrief xnSetIntProperty
- * For full details and usage, see @ref xnSetIntProperty
- */
- inline XnStatus SetIntProperty(const XnChar* strName, XnUInt64 nValue)
- {
- return xnSetIntProperty(GetHandle(), strName, nValue);
- }
-
- /**
- * @copybrief xnSetRealProperty
- * For full details and usage, see @ref xnSetRealProperty
- */
- inline XnStatus SetRealProperty(const XnChar* strName, XnDouble dValue)
- {
- return xnSetRealProperty(GetHandle(), strName, dValue);
- }
-
- /**
- * @copybrief xnSetStringProperty
- * For full details and usage, see @ref xnSetStringProperty
- */
- inline XnStatus SetStringProperty(const XnChar* strName, const XnChar* strValue)
- {
- return xnSetStringProperty(GetHandle(), strName, strValue);
- }
-
- /**
- * @copybrief xnSetGeneralProperty
- * For full details and usage, see @ref xnSetGeneralProperty
- */
- inline XnStatus SetGeneralProperty(const XnChar* strName, XnUInt32 nBufferSize, const void* pBuffer)
- {
- return xnSetGeneralProperty(GetHandle(), strName, nBufferSize, pBuffer);
- }
-
- /**
- * @copybrief xnGetIntProperty
- * For full details and usage, see @ref xnGetIntProperty
- */
- inline XnStatus GetIntProperty(const XnChar* strName, XnUInt64& nValue) const
- {
- return xnGetIntProperty(GetHandle(), strName, &nValue);
- }
-
- /**
- * @copybrief xnGetRealProperty
- * For full details and usage, see @ref xnGetRealProperty
- */
- inline XnStatus GetRealProperty(const XnChar* strName, XnDouble &dValue) const
- {
- return xnGetRealProperty(GetHandle(), strName, &dValue);
- }
-
- /**
- * @copybrief xnGetStringProperty
- * For full details and usage, see @ref xnGetStringProperty
- */
- inline XnStatus GetStringProperty(const XnChar* strName, XnChar* csValue, XnUInt32 nBufSize) const
- {
- return xnGetStringProperty(GetHandle(), strName, csValue, nBufSize);
- }
-
- /**
- * @copybrief xnGetGeneralProperty
- * For full details and usage, see @ref xnGetGeneralProperty
- */
- inline XnStatus GetGeneralProperty(const XnChar* strName, XnUInt32 nBufferSize, void* pBuffer) const
- {
- return xnGetGeneralProperty(GetHandle(), strName, nBufferSize, pBuffer);
- }
-
- /**
- * @copybrief xnLockNodeForChanges
- * For full details and usage, see @ref xnLockNodeForChanges
- */
- inline XnStatus LockForChanges(XnLockHandle* phLock)
- {
- return xnLockNodeForChanges(GetHandle(), phLock);
- }
-
- /**
- * @copybrief xnUnlockNodeForChanges
- * For full details and usage, see @ref xnUnlockNodeForChanges
- */
- inline void UnlockForChanges(XnLockHandle hLock)
- {
- xnUnlockNodeForChanges(GetHandle(), hLock);
- }
-
- /**
- * @copybrief xnLockedNodeStartChanges
- * For full details and usage, see @ref xnLockedNodeStartChanges
- */
- inline XnStatus LockedNodeStartChanges(XnLockHandle hLock)
- {
- return xnLockedNodeStartChanges(GetHandle(), hLock);
- }
-
- /**
- * @copybrief xnLockedNodeEndChanges
- * For full details and usage, see @ref xnLockedNodeEndChanges
- */
- inline void LockedNodeEndChanges(XnLockHandle hLock)
- {
- xnLockedNodeEndChanges(GetHandle(), hLock);
- }
-
- /**
- * @brief Gets an @ref xn::ErrorStateCapability object for accessing the functionality
- * of the Error State capability.
- *
- * <b>Remarks:</b>
- * The application is responsible for first checking if @ref XN_CAPABILITY_ERROR_STATE
- * is supported by calling @ref xn::ProductionNode::IsCapabilitySupported().
- */
- inline const ErrorStateCapability GetErrorStateCap() const
- {
- return ErrorStateCapability(GetHandle());
- }
-
- /**
- * @brief Gets an @ref xn::ErrorStateCapability object for accessing the functionality
- * of the Error State capability.
- *
- * <b>Remarks:</b>
- * The application is responsible for first checking if @ref XN_CAPABILITY_ERROR_STATE
- * is supported by calling @ref xn::ProductionNode::IsCapabilitySupported()
- */
- inline ErrorStateCapability GetErrorStateCap()
- {
- return ErrorStateCapability(GetHandle());
- }
-
- /**
- * @brief Gets an @ref GeneralIntCapability object for accessing the capability
- * functionality.
- *
- * <b>Remarks:</b>
- *
- * It is the application responsibility to check first if the capability is supported
- * by calling @ref IsCapabilitySupported().
- *
- * @param [in] strCapability Name of the capability to get
- */
- inline GeneralIntCapability GetGeneralIntCap(const XnChar* strCapability)
- {
- return GeneralIntCapability(GetHandle(), strCapability);
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> The DeviceIdentificationCapability object allows an application to
- * receive some device-specific information about a hardware device, like its serial
- * number and its model name.
- *
- * <b>Usage:</b> Do not instantiate directly. Instead, use @ref Device::GetIdentificationCap()
- * to obtain an instance.
- */
- class DeviceIdentificationCapability : public Capability
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- DeviceIdentificationCapability(XnNodeHandle hNode) : Capability(hNode) {}
- DeviceIdentificationCapability(const NodeWrapper& node) : Capability(node) {}
-
- /**
- * @brief Gets the name of the device holding this capability object.
- *
- * @param [in] strBuffer Buffer to accept the device information.
- * @param [in,out] nBufferSize Size of the buffer.
- *
- * @retval XN_STATUS_OK Operation succeeded.
- * @retval XN_STATUS_OUTPUT_BUFFER_OVERFLOW The size of the buffer is not sufficient.
- */
- inline XnStatus GetDeviceName(XnChar* strBuffer, XnUInt32 nBufferSize)
- {
- return xnGetDeviceName(GetHandle(), strBuffer, &nBufferSize);
- }
-
- /**
- * @brief Gets the vendor-specific name of the device holding this capability object.
- *
- * @param [in] strBuffer Buffer to accept the device information.
- * @param [in,out] nBufferSize Size of the buffer.
- *
- * @retval XN_STATUS_OK Operation succeeded.
- * @retval XN_STATUS_OUTPUT_BUFFER_OVERFLOW The size of the buffer is not sufficient.
- */
- inline XnStatus GetVendorSpecificData(XnChar* strBuffer, XnUInt32 nBufferSize)
- {
- return xnGetVendorSpecificData(GetHandle(), strBuffer, &nBufferSize);
- }
-
- /**
- * @brief Gets the vendor-specific name of the device holding this capability object.
- *
- * @param [in] strBuffer Buffer to accept the serial number
- * @param [in,out] nBufferSize Size of the buffer.
- *
- * @retval XN_STATUS_OK Operation succeeded.
- * @retval XN_STATUS_OUTPUT_BUFFER_OVERFLOW The size of the buffer is not sufficient.
- */
- inline XnStatus GetSerialNumber(XnChar* strBuffer, XnUInt32 nBufferSize)
- {
- return xnGetSerialNumber(GetHandle(), strBuffer, &nBufferSize);
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> A smart pointer to a device node in the
- * production graph of a context.
- *
- * The device node represents a physical hardware device
- * currently connected in the system and used for generating data.
- * The Device node represents the hardware device by providing, for example,
- * the device's model name, serial number, and some vendor-specific data.
- * The Device node itself does not generate data.
- *
- * <b>Capabilities:</b> @ref DeviceIdentificationCapability
- */
- class Device : public ProductionNode
- {
- public:
- inline Device(XnNodeHandle hNode = NULL) : ProductionNode(hNode) {}
- inline Device(const NodeWrapper& other) : ProductionNode(other) {}
-
- /**
- * @brief Creates a Device node from available @ref node_alternative "production node alternatives".
- *
- * <b>Remarks</b>
- *
- * See @ref create_method "Concepts: the Create() Method" for a detailed description
- * of the operation of this method.
- */
- inline XnStatus Create(Context& context, Query* pQuery = NULL, EnumerationErrors* pErrors = NULL);
-
- /**
- * Gets a @ref DeviceIdentificationCapability object for accessing device identification
- * functionality.
- *
- * <b>Remarks</b>
- *
- * If this node supports this method then the node can identify which device is
- * being used right now, for example, its name, serial number, and specific
- * vendors can place specific data.
- *
- * It is the application's responsibility to check first if @ref XN_CAPABILITY_DEVICE_IDENTIFICATION
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline DeviceIdentificationCapability GetIdentificationCap()
- {
- return DeviceIdentificationCapability(GetHandle());
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- *
- * <b>Purpose:</b> Applying the MirrorCapability to a node allows enabling the Mirroring
- * mode on a per node basis. Compare this with enabling the Global Mirror, which applies
- * mirroring to any node supporting the Mirroring capability. To understand mirroring
- * see the Overview below.
- *
- * <b>Usage:</b> Do not instantiate directly. Instead, use @ref Generator::GetMirrorCap()
- * to obtain an instance.
- *
- * <b>Remarks:</b>
- *
- * When you stand facing the sensor device, and the image is processed directly,
- * the sensor "sees" your left hand at your right-hand side, and your right hand
- * at your left-hand side.
- *
- * If your movements are used to control an avatar, and that avatar is facing you then
- * the avatar on the screen is opposite: your right hand is facing the left of the avatar
- * on the screen, and your left hand is facing the right of the avatar.
- *
- * The effect of applying and enabling the Mirroring capability on a node makes all
- * the data replace right with left, and left with right.
- *
- * Thus, if mirroring is <i>disabled</i> (default), then when you raise your right hand,
- * the avatar on the screen opposite you correspondingly also raises its own right hand,
- * this being to the left of yourself.
- *
- * If mirroring is <i>enabled</i>, when you raise your right hand on the screen the
- * avatar opposite you mirrors you by raising its hand on your right, which is the avatar's
- * <i>left</i> hand.
- *
- * Enabling mirroring is useful when the avatar is facing the player. Disabling mirroring
- * is useful when the player sees the avatar from behind (for example in third person
- * shooters or to see yourself kicking a football).
- *
- * Changing the GlobalMirror flag affects mirroring in all existing nodes and in all
- * nodes to be created in the future - see @ref Context::SetGlobalMirror().
- *
- * <b>Event: 'Mirror Change'</b>
- *
- * Signals that the @ref holder_node "holder node"'s mirror configuration has been changed (also see @ref event_cmn_conf).
- *
- * Use @ref RegisterToMirrorChange() and @ref UnregisterFromMirrorChange() for using this event.
- *
- * Calling the @ref SetMirror() method raises this event.
- */
- class MirrorCapability : public Capability
- {
- public:
- inline MirrorCapability(XnNodeHandle hNode) : Capability(hNode) {}
- MirrorCapability(const NodeWrapper& node) : Capability(node) {}
-
- /**
- * @brief Sets the current mirror configuration of the @ref holder_node "holder node",
- * enabling or disabling mirroring. This configuration is used for generating the next frame.
- *
- * @param [in] bMirror TRUE for mirroring output, FALSE otherwise.
- */
- inline XnStatus SetMirror(XnBool bMirror)
- {
- return xnSetMirror(GetHandle(), bMirror);
- }
-
- /**
- * @brief Gets the current mirroring configuration of the @ref holder_node "holder node". This configuration is used for generating the next frame.
- */
- inline XnBool IsMirrored() const
- {
- return xnIsMirrored(GetHandle());
- }
-
- /**
- * @brief Registers an event handler for the 'Mirror Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToMirrorChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToMirrorChange, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters the event handler for the 'Mirror Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromMirrorChange(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromMirrorChange, GetHandle(), hCallback);
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- *
- * <b>Purpose:</b> The AlternativeViewPoint capability enables any type of map generator
- * (depth, image, or IR) to transform its data to appear as if the sensor is placed
- * in another location. The other location is represented by a second production node,
- * usually representing another sensor.
- *
- * <b>Usage:</b> Do not instantiate directly. Instead, use @ref Generator::GetAlternativeViewPointCap()
- * to obtain an instance.
- *
- * <b>Remarks:</b>
- *
- * This capability provides a solution for the situation where you want to impose
- * color over depth, but there is then the problem that the two sensing media (transducers)
- * are looking in slightly different directions. This capability superimposes the two
- * sensing media of one sensor.
- *
- * Other uses are also possible.
- *
- * @note The AlternativeViewPoint capability has nothing to do with the actual physical
- * position of a sensor. You could move the location of the sensor itself, but this
- * will not change the current viewpoint.
- *
- * <b>Event: 'Viewpoint Change' </b>
- *
- * Signals that the @ref holder_node "holder node"'s viewpoint has changed (also see @ref event_cmn_conf).
- *
- * Use @ref RegisterToViewPointChange() and @ref UnregisterFromViewPointChange() for using this event.
- *
- * Calling the @ref SetViewPoint() or @ref ResetViewPoint() methods raises this event.
- */
- class AlternativeViewPointCapability : public Capability
- {
- public:
- inline AlternativeViewPointCapability(XnNodeHandle hNode) : Capability(hNode) {}
- AlternativeViewPointCapability(const NodeWrapper& node) : Capability(node) {}
-
- /**
- * @brief Checks if the generator node holding this capability can change its output to appear
- * as if the sensor was placed at the viewpoint of another specific @ref xn::ProductionNode
- * "production node".
- *
- * @param [in] otherNode Other production node, whose viewpoint against which this
- * node's viewpoint is being checked.
- *
- * <b>Remarks</b>
- *
- * This is not the same as @ref xn::ProductionNode::IsCapabilitySupported(). Although
- * the node implementation supports this capability, it may nevertheless support only
- * the viewpoints of nodes of some specific sensors and not of other specific sensors.
- */
- inline XnBool IsViewPointSupported(ProductionNode& otherNode) const
- {
- return xnIsViewPointSupported(GetHandle(), otherNode.GetHandle());
- }
-
- /**
- * @brief Sets the current viewpoint of the holding generator node to look as if it
- * is placed at a different generator location. All further generated output will appear
- * as if the sensor was placed at the different location.
- *
- * @param [in] otherNode Viewpoint to be set.
- */
- inline XnStatus SetViewPoint(ProductionNode& otherNode)
- {
- return xnSetViewPoint(GetHandle(), otherNode.GetHandle());
- }
-
- /**
- * @brief Sets the viewpoint of the holding generator node to its normal viewpoint.
- */
- inline XnStatus ResetViewPoint()
- {
- return xnResetViewPoint(GetHandle());
- }
-
- /**
- * @brief Returns whether the @ref holder_node "holder node"'s viewpoint is the same
- * viewpoint as that of another specified node. Thus, this method is somewhat of an equality operator.
- *
- * @param [in] otherNode Other node, whose viewpoint is used for comparison with
- * the viewpoint of this node.
- */
- inline XnBool IsViewPointAs(ProductionNode& otherNode) const
- {
- return xnIsViewPointAs(GetHandle(), otherNode.GetHandle());
- }
-
- /**
- * @brief Registers a handler for the 'Viewpoint Change' event (see the above overview to this class).
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToViewPointChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToViewPointChange, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters the event handler for the the 'Viewpoint Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromViewPointChange(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromViewPointChange, GetHandle(), hCallback);
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> The Frame Sync capability allows frame synchronization between two
- * @ref xn::Generator "generator" nodes producing frame data. This lets the two sensors
- * output their frames at the same time. This allows smaller latency between two maps
- * of the same scene, for example, a depth map and an image map.
- *
- * <b>Usage:</b> Do not instantiate directly. Instead, use @ref Generator::GetFrameSyncCap()
- * to obtain an instance.
- *
- * <b>Event: 'Frame Sync Change'</b>
- *
- * Signals that the @ref holder_node "holder node"'s frame synchronization setting has
- * been changed. That is, this setting has changed from activated to deactivated, or
- * from deactivated to activated, or the frame synchronization has been changed and
- * is now synchronized with a different 'other node'.
- *
- * Use @ref RegisterToFrameSyncChange() and @ref UnregisterFromFrameSyncChange() for using this event.
- *
- * Calling the @ref FrameSyncWith() or @ref StopFrameSyncWith() methods raises this event.
- */
- class FrameSyncCapability : public Capability
- {
- public:
- inline FrameSyncCapability(XnNodeHandle hNode) : Capability(hNode) {}
- FrameSyncCapability(const NodeWrapper& node) : Capability(node) {}
-
- /**
- * @brief Returns whether the generator node holding this capability can
- * synchronize frames with the other specified node.
- *
- * @param [in] other Specifies the other node to be checked whether it can
- * frame-sync with the node holding this capability.
- * @returns TRUE if frame-sync to the other node is supported; FALSE otherwise.
- */
- inline XnBool CanFrameSyncWith(Generator& other) const;
-
- /**
- * @brief Activates frame synchronization with the other generator node.
- *
- * @param [in] other Specifies the other node to be frame sync-ed with the node
- * holding this capability.
- */
- inline XnStatus FrameSyncWith(Generator& other);
-
- /**
- * @brief Removes the frame sync between the node holding this capability and the specified other node.
- * @param [in] other Specifies the other node from which to remove the frame sync.
- */
- inline XnStatus StopFrameSyncWith(Generator& other);
-
- /**
- * @brief Returns whether a frame sync has been applied between the node holding this capability and
- * another specified node.
- * @param [in] other Specifies the other node for checking whether frame sync has
- * been applied.
- */
- inline XnBool IsFrameSyncedWith(Generator& other) const;
-
- /**
- * @brief Registers an event handler for the 'Frame Sync Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToFrameSyncChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToFrameSyncChange, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters the 'Frame Sync Change' event handler.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromFrameSyncChange(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromFrameSyncChange, GetHandle(), hCallback);
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> A generator node produces some type of data. This is in addition
- * to the node's basic characteristic, as a derivative of the @ref xn::ProductionNode
- * class, i.e., that it represents a logical entity in the OpenNI @ref prod_graph "Production
- * Graph".
- *
- * <b>Usage summary</b>: Immediate base class for all generator types. It itself is
- * not usually instantiated.
- *
- * <b>Class Overview:</b>
- *
- * Each generator can be in Generating state or Non-Generating state. The application makes
- * the node enter Generating state by calling the @ref xn::Generator::StartGenerating()
- * method.
- *
- * When a generator node is created, by default it is in Non-Generating state, so it
- * does not generate data.
- *
- * Generators have a default configuration (for example the FOV resolution) and an application
- * can change the default configuration before actual data generation starts.
- *
- * Once the application has completed configuring the generator node, the application
- * can cause the node to start generating data.
- *
- * Typically, the application will configure the generator only in the configuration
- * stage, i.e., in Non-Generating state. The application can usually also configure
- * the node while generating data, however configuration might then take longer and
- * the application could also lose some frames of data. For example, if the application
- * changes the resolution while in the Configuration stage (Non-Generating state), the
- * resolution change occurs immediately; but if the application changes the configuration
- * while the generator is generating data, the resolution change can take up to a few
- * seconds to occur.
- *
- * <b>Data Storage:</b>
- *
- * Each call to an @ref conc_updating_data "'Update Data'" method updates the generator
- * node's application buffer, making the latest data available for applications to access.
- * After a call to an @ref conc_updating_data "'Update Data'" method, all subsequent
- * calls to @ref GetData() will return exactly the same data until you call @ref conc_updating_data
- * "'Update Data'" again. The @ref conc_updating_data "'Update Data'" method can be
- * the generator node's own @ref WaitAndUpdateData() method or one of the Context's
- * @ref conc_updating_data "'WaitXUpdateAll'" methods.
- *
- * <b>Getting the Generated Data:</b>
- *
- * Generator nodes will not output data to make it available for getting, until the
- * application calls the node's WaitAndUpdateData() method (see below) or one of the
- * context's @ref conc_updating_data "'WaitXUpdateAll'" methods.
- *
- * @ref conc_updating_data__sample_code_cmn
- */
- class Generator : public ProductionNode
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline Generator(XnNodeHandle hNode = NULL) : ProductionNode(hNode) {}
- inline Generator(const NodeWrapper& other) : ProductionNode(other) {}
-
- /**
- * @brief Enters the node into Generating state.
- *
- * Enters the node into Generating state. In this state the node generates new frames.
- *
- * After the application has called this method it can call an @ref conc_updating_data
- * "'Update Data'" method, e.g., @ref xn::Generator::WaitAndUpdateData(), to make
- * a new frame available for getting. The application can then get the data (for
- * example, using a metadata GetData() method, or some other mechanism depending
- * on the type of node).
- *
- * <b>Remarks:</b>
- *
- * On entering the node into Generating state, OpenNI enters also all dependent
- * nodes into Generating state. For example, if a UserGenerator node depends on
- * data input from a DepthGenerator node, and the UserGenerator node is entered
- * into Generating state, then OpenNI will enter also the DepthGenerator node into
- * Generating state.
- */
- inline XnStatus StartGenerating()
- {
- return xnStartGenerating(GetHandle());
- }
-
- /**
- * @brief Returns whether the node is currently in Generating state.
- */
- inline XnBool IsGenerating() const
- {
- return xnIsGenerating(GetHandle());
- }
-
- /**
- * @brief Makes the node leave Generating state (enters Non-Generating state).
- *
- * <b>Remarks:</b>
- *
- * If the node has metadata, after calling this method the data is still available
- * as a saved @ref glos_frame_object "frame object" in the metadata object.
- */
- inline XnStatus StopGenerating()
- {
- return xnStopGenerating(GetHandle());
- }
-
- /**
- * @brief Registers an event handler for the 'Generation State Change' event.
- *
- * Registers a callback function to be called when generation starts or
- * stops, i.e., when the generation state toggles between generating and not
- * generating.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToGenerationRunningChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle &hCallback)
- {
- return _RegisterToStateChange(xnRegisterToGenerationRunningChange, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters the 'Generation State Change' event handler.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromGenerationRunningChange(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromGenerationRunningChange, GetHandle(), hCallback);
- }
-
- /**
- * @brief Registers an event handler for the 'New Data Available' event.
- *
- * The 'New Data Available' event is raised whenever a generator node has new data available. The new
- * data is available for updating, but can not yet be accessed by the application. The application
- * needs to call @ref conc_updating_data "'Update Data'" to gain access to that new data.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToNewDataAvailable(StateChangedHandler handler, void* pCookie, XnCallbackHandle &hCallback)
- {
- return _RegisterToStateChange(xnRegisterToNewDataAvailable, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters the event handler for the 'New Data Available' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromNewDataAvailable(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromNewDataAvailable, GetHandle(), hCallback);
- }
-
- /**
- * @brief Returns whether the node has new data available.
- * The new data is available for updating, but can not yet be accessed by the application. The application
- * needs to call @ref conc_updating_data "'Update Data'" to gain access to that new data.
- *
- * @param [out] pnTimestamp [Optional] If new data is available (TRUE is returned from the method),
- * this param will hold the timestamp of that new data.
- */
- inline XnBool IsNewDataAvailable(XnUInt64* pnTimestamp = NULL) const
- {
- return xnIsNewDataAvailable(GetHandle(), pnTimestamp);
- }
-
- /**
- * @brief Updates the generator node to the latest available data, first waiting for the node to have new data available.
- *
- * <b>Remarks:</b>
- *
- * This method requests from OpenNI to cause the node to update its application buffers
- * with new data, if it has new data available.
- *
- * At this stage the generator node has "generated" new data. This method returns a
- * success status. The application can now read the newly generated data.
- *
- * An error situation is defined as: after a preset timeout, the node has not yet notified
- * OpenNI it has new data available. On error, the method stops waiting and returns
- * an error status.
- *
- * @retval XN_STATUS_INVALID_OPERATION This production node is not a generator.
- * @retval XN_STATUS_WAIT_DATA_TIMEOUT No new data available within 2 seconds.
- */
- inline XnStatus WaitAndUpdateData()
- {
- return xnWaitAndUpdateData(GetHandle());
- }
-
- /**
- * Returns whether this node's frame data was updated by the most recent call to
- * any @ref conc_updating_data "'WaitXUpdateAll()'" function, e.g., @ref xn::Context::WaitAnyUpdateAll().
- */
- inline XnBool IsDataNew() const
- {
- return xnIsDataNew(GetHandle());
- }
-
- /**
- * @brief Gets the @ref frame_data "frame data" from the generator node. This is
- * the latest data that the generator node has generated.
- *
- * <b>Remarks:</b>
- *
- * This method gets the data directly from the Generator node; not from the metadata
- * object.
- *
- * Compare this method with the Data() method of the @ref xn::OutputMetaData object,
- * where the latter gets the data from the metadata object.
- * GetData() returns the same data as the GetMetaData().Data() method. However,
- * using the GetData() method is slightly more costly.
- *
- * The application usually should not use this method, but call each generator own
- * data access methods, e.g. DepthGenerator::GetDepthMap().
- */
- inline const void* GetData()
- {
- return xnGetData(GetHandle());
- }
-
- /**
- * @brief Gets the data size of the @ref frame_data "frame data".
- * This method gets the data size directly from the Generator node.
- *
- * <b>Remarks:</b>
- *
- * The size of the data is returned as a number of bytes.
- *
- * Compare this method with the DataSize() method of the @ref xn::OutputMetaData
- * object, where the latter gets the data from the metadata object.
- * GetDataSize() returns the same data as the GetMetaData().DataSize() method. However,
- * using the GetDataSize() method is slightly more costly.
- */
- inline XnUInt32 GetDataSize() const
- {
- return xnGetDataSize(GetHandle());
- }
-
- /**
- * @brief Gets the frame timestamp from the <b>Generator</b> node
- * This method gets the timestamp directly from the Generator node.
- *
- * <b>Remarks:</b>
- *
- * The time is returned in microseconds.
- *
- * Compare this method with the <b>GetTimestamp()</b> method of the @ref xn::OutputMetaData
- * object, where the latter gets the data from the metadata object.
- * <b>GetTimestamp()</b> returns the same data as the GetMetaData().GetTimestamp()
- * method. However, using the <b>GetTimestamp()</b> method is slightly more costly.
- */
- inline XnUInt64 GetTimestamp() const
- {
- return xnGetTimestamp(GetHandle());
- }
-
- /**
- * @brief Gets the frame ID of the current frame data from the Generator node.
- *
- * <b>Remarks:</b>
- *
- * This method gets the frame ID directly from the Generator node.
- *
- * Compare this method with the <b>GetFrameID()</b> method of the @ref xn::OutputMetaData
- * object, where the latter gets the data from the metadata object.
- * <b>GetFrameID()</b> returns the same data as the GetMetaData().GetFrameID() method.
- * However, using the <b>GetFrameID()</b> method is slightly more costly.
- */
- inline XnUInt32 GetFrameID() const
- {
- return xnGetFrameID(GetHandle());
- }
-
- /**
- * @brief Gets a @ref MirrorCapability object for accessing Mirror functionality.
- *
- * <b>Remarks:</b>
- *
- * It is the application's responsibility to check first if @ref XN_CAPABILITY_MIRROR
- * is supported by calling @ref xn::ProductionNode::IsCapabilitySupported().
- */
- inline const MirrorCapability GetMirrorCap() const
- {
- return MirrorCapability(GetHandle());
- }
-
- /**
- * @brief Gets a @ref MirrorCapability object for accessing Mirror functionality.
- *
- * <b>Remarks:</b>
- *
- * It is the application's responsibility to check first if @ref XN_CAPABILITY_MIRROR
- * is supported by calling @ref xn::ProductionNode::IsCapabilitySupported().
- */
- inline MirrorCapability GetMirrorCap()
- {
- return MirrorCapability(GetHandle());
- }
-
- /**
- * Gets an @ref AlternativeViewPointCapability object for accessing Alternative
- * Viewpoint functionality.
- *
- * <b>Remarks:</b>
- *
- * It is the application's responsibility to check first if
- * @ref XN_CAPABILITY_ALTERNATIVE_VIEW_POINT is supported
- * by calling @ref xn::Generator::IsCapabilitySupported().
- */
- inline const AlternativeViewPointCapability GetAlternativeViewPointCap() const
- {
- return AlternativeViewPointCapability(GetHandle());
- }
-
- /**
- * Gets an @ref AlternativeViewPointCapability object for accessing Alternative
- * Viewpoint functionality.
- *
- * <b>Remarks:</b>
- *
- * It is the application's responsibility to check first if
- * @ref XN_CAPABILITY_ALTERNATIVE_VIEW_POINT is supported
- * by calling @ref xn::Generator::IsCapabilitySupported().
- */
- inline AlternativeViewPointCapability GetAlternativeViewPointCap()
- {
- return AlternativeViewPointCapability(GetHandle());
- }
-
- /**
- * Gets an @ref FrameSyncCapability object for accessing Frame Sync functionality.
- *
- * <b>Remarks:</b>
- *
- * It is the application's responsibility to check first if
- * @ref XN_CAPABILITY_FRAME_SYNC is supported
- * by calling @ref xn::Generator::IsCapabilitySupported().
- */
- inline const FrameSyncCapability GetFrameSyncCap() const
- {
- return FrameSyncCapability(GetHandle());
- }
-
- /**
- * Gets an @ref FrameSyncCapability object for accessing Frame Sync functionality.
- *
- * <b>Remarks:</b>
- *
- * It is the application's responsibility to check first if
- * @ref XN_CAPABILITY_FRAME_SYNC is supported
- * by calling @ref xn::Generator::IsCapabilitySupported().
- */
- inline FrameSyncCapability GetFrameSyncCap()
- {
- return FrameSyncCapability(GetHandle());
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> To create and manage a Recorder node.
- *
- * <b>Usage: </b> Instatiate and create a Recorder node.
- *
- * <b>Data output:</b> Records to a specified destination medium the frames of data
- * from each node that was added to the Recorder node.
- *
- * <b>Remarks:</b>
- *
- * Recordings are a powerful debug tool. A recording enables a full capture of data
- * generation and the ability to later play it back by 'regeneration' so that applications
- * can simulate an exact replica of the situation to be debugged.
- *
- * OpenNI supports recordings of the production nodes in the production graph, both
- * the entire configuration of each node, and all data streamed from a node.
- *
- * OpenNI has a framework for recording data and for playing it back (using mock nodes).
- * It also comes with the nimRecorder module, which defines a new file format (".ONI")
- * - and implements a Recorder node and a Player node for this format.
- *
- * If a recorder exists while generating, the @ref conc_updating_data "'WaitXUpdateAll'"
- * functions automatically record the data from all nodes added to this recorder.
- *
- * To record, an application creates a Recorder node, and set its destination - the
- * file name to which it should write. The application must add to the Recorder node
- * every production node that it wants to record. When adding a node to the recorder,
- * the Recorder stores its configuration. It also registers to every possible event
- * of the node, so that when any configuration change takes place, it is also recorded.
- *
- * Once all required nodes are added, the application can read data from the nodes and
- * record it. Recording of data can be achieved either by explicitly calling the @ref
- * xn::Recorder::Record() function, or by using one of the @ref conc_updating_data "'Update
- * All'" functions.
- *
- * Applications that initialize OpenNI using an XML file can easily record their session
- * without any change to the code. All that is required is that they create an additional
- * node in the XML file for the recorder, add nodes to it, and when the application
- * calls one of the 'WaitXUpdateAll' functions, recording will occur. see @ref xmlscripts
- * for explanation on how to do that.
- *
- * Recordings are played back by using the services of the Player class.
- */
- class Recorder : public ProductionNode
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode A node handle
- */
- inline Recorder(XnNodeHandle hNode = NULL) : ProductionNode(hNode) {}
- inline Recorder(const NodeWrapper& other) : ProductionNode(other) {}
-
- /**
- * @brief Creates a Recorder node.
- *
- * @param [in] context The context in which to create the Recorder node.
- * @param [in] strFormatName Optional. The name of the format the recorded file
- * will be in. If NULL, file will be in ONI format.
- */
- inline XnStatus Create(Context& context, const XnChar* strFormatName = NULL);
-
- /**
- * @brief Specifies to where the recorder must send its recording. Typically this is a disk file of a particular file type.
- *
- * @param [in] destType The type of medium to record to. Currently only XN_RECORD_MEDIUM_FILE
- * is supported.
- * @param [in] strDest Recording destination. If destType is XN_RECORD_MEDIUM_FILE,
- * this specifies a file name.
- */
- inline XnStatus SetDestination(XnRecordMedium destType, const XnChar* strDest)
- {
- return xnSetRecorderDestination(GetHandle(), destType, strDest);
- }
-
- /**
- * @brief Gets the destination medium for the Recorder node to record to.
- *
- * @param [out] destType The type of medium to record to. Currently only XN_RECORD_MEDIUM_FILE
- * is supported.
- * @param [out] strDest Recording destination. If destType is XN_RECORD_MEDIUM_FILE,
- * this specifies a file name.
- * @param [in] nBufSize Destination buffer size.
- */
- inline XnStatus GetDestination(XnRecordMedium& destType, XnChar* strDest, XnUInt32 nBufSize)
- {
- return xnGetRecorderDestination(GetHandle(), &destType, strDest, nBufSize);
- }
-
- /**
- * @brief Adds a node to the recording setup, and starts recording data what the node generates.
- * This method must be called for each node to be recorded with this recorder.
- *
- * @param [in] Node Node to add to the recording.
- * @param [in] compression Type of compression that will be used to encode the node's
- * data (see @ref XnCodecIDs.h). If @ref XN_CODEC_NULL
- * is specified, a default compression will be chosen according to the node type.
- */
- inline XnStatus AddNodeToRecording(ProductionNode& Node, XnCodecID compression = XN_CODEC_NULL)
- {
- return xnAddNodeToRecording(GetHandle(), Node.GetHandle(), compression);
- }
-
- /**
- * @brief Removes a node from the Recorder node and stops recording the node output.
- * This function is called on a node that was added to recording with @ref AddNodeToRecording.
- *
- * @param [in] Node The node to remove from recording.
- */
- inline XnStatus RemoveNodeFromRecording(ProductionNode& Node)
- {
- return xnRemoveNodeFromRecording(GetHandle(), Node.GetHandle());
- }
-
- /**
- * @brief Records one frame of data from each node that was added to the recorder with AddNodeToRecording().
- *
- * <b>Remarks</b>
- *
- * To record continually, the recorder node must be called repeatedly for each frame.
- *
- * It is highly recommended that an application use the 'WaitXUpdateAll' methods,
- * and not call Generator::WaitAndUpdateData() for each generator. When working
- * with the 'WaitXUpdateAll' methods, OpenNI will automatically call @ref Record(),
- * and there is no need for the application to call this method.
- */
- inline XnStatus Record()
- {
- return xnRecord(GetHandle());
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- *
- * <b>Purpose:</b> The Player class is used for creating and managing a Player node.
- * This node plays a saved recording of an OpenNI data generation session.
- *
- * <b>Remarks:</b>
- *
- * To play a file recording, use the @ref xn::Context::OpenFileRecording() function.
- * OpenNI will open the file, create a mock node for each node in the file, and populate
- * it with the recorded configuration.
- *
- * An application may take the nodes it needs by calling the @ref xn::Context::FindExistingNode()
- * method, and use them normally.
- *
- * @note Nodes created by the player are locked, and cannot be changed, as the
- * configuration must remain according to the recorded configuration.
- *
- * Applications that initialize OpenNI using an XML file can easily replace their input.
- * This means that instead of reading from a physical device, which generates data in
- * real-time, they read from a recording by replacing the nodes in the XML file with
- * a recording element (see @ref xmlscripts).
- *
- * @note It is not the Player node itself that is generating data. (Accordingly, the
- * Player node does not provide a GetData() method.) The Player node reads data from
- * the file, and "pushes" it into the mock nodes.
- */
- class Player : public ProductionNode
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Player node handle
- */
- inline Player(XnNodeHandle hNode = NULL) : ProductionNode(hNode) {}
- inline Player(const NodeWrapper& other) : ProductionNode(other) {}
-
- /**
- * @brief Creates a player node.
- *
- * <b>Remarks</b>
- *
- * See @ref create_method "Concepts: the Create() Method" for a detailed description
- * about the operation of this method.
- */
- inline XnStatus Create(Context& context, const XnChar* strFormatName);
-
-
- /**
- * @brief Specifies whether the player will automatically rewind to the beginning
- * of the recording after reaching the end of the recording.
- *
- * @param [in] bRepeat Determines whether the player will repeat or not.
- *
- * If bRepeat is set to TRUE, the player will automatically
- * rewind when reaching the end.
- *
- * If bRepeat is set to FALSE, the player will stop playing
- * when reaching the end, and will raise the 'End-Of-File Reached'
- * event. In this state, @ref IsEOF() returns TRUE, and
- * calls to @ref ReadNext() will fail.
- */
- inline XnStatus SetRepeat(XnBool bRepeat)
- {
- return xnSetPlayerRepeat(GetHandle(), bRepeat);
- }
-
- /**
- * @copybrief xnSetPlayerSource
- * For full details and usage, see @ref xnSetPlayerSource
- */
- inline XnStatus SetSource(XnRecordMedium sourceType, const XnChar* strSource)
- {
- return xnSetPlayerSource(GetHandle(), sourceType, strSource);
- }
-
- /**
- * @brief Gets the player's source, that is, the type and name of the medium
- * that the recording is played back from.
- *
- * @param [out] sourceType Player's source type.
- * @param [in] strSource Player's source.
- * @param [in] nBufSize Size of the buffer specified by @c strSource.
- */
- inline XnStatus GetSource(XnRecordMedium &sourceType, XnChar* strSource, XnUInt32 nBufSize) const
- {
- return xnGetPlayerSource(GetHandle(), &sourceType, strSource, nBufSize);
- }
-
- /**
- * @copybrief xnPlayerReadNext
- * For full details and usage, see @ref xnPlayerReadNext
- */
- inline XnStatus ReadNext()
- {
- return xnPlayerReadNext(GetHandle());
- }
-
- /**
- * @brief Moves the player to a specific time, so that playback will continue from that point onwards.
- *
- * @param [in] nTimeOffset Offset to move, relative to the specified origin. <br>
- * Units in microseconds. <br> See the remark below.
- * @param [in] origin Origin to seek from. See the remarks below.
- *
- * The meaning of the @c nTimeOffset parameter changes according to the origin parameter:
- *
- * <b>XN_PLAYER_SEEK_SET:</b> @c nTimeOffset specifies the total time passed since
- * the beginning of the recording. This must be a positive value.
- *
- * <b>XN_PLAYER_SEEK_CUR:</b> @c nTimeOffset specifies a period of time to move, relative
- * to the current player position. A positive value means to move forward, and a
- * negative value means to move backwards.
- *
- * <b>XN_PLAYER_SEEK_END:</b> @c nTimeOffset specifies a period of time to move, relative
- * to the end of the recording. This must be a negative value.
- *
- * <b>Remarks</b>
- *
- * For the built-in ONI player, this function is not currently supported and always
- * returns XN_STATUS_NOT_IMPLEMENTED.
- */
- inline XnStatus SeekToTimeStamp(XnInt64 nTimeOffset, XnPlayerSeekOrigin origin)
- {
- return xnSeekPlayerToTimeStamp(GetHandle(), nTimeOffset, origin);
- }
-
- /**
- * @brief Moves the player to a specific frame of a specific played node, e.g., an
- * ImageGenerator node, so that playing will continue from that frame onwards.
- *
- * @param [in] strNodeName Name of the node.
- * @param [in] nFrameOffset Number of frames to move, relative to the specified
- * origin. See remarks below.
- * @param [in] origin Origin to seek from. See remarks below.
- *
- * The meaning of the @c nFrameOffset parameter changes according to the origin parameter:
- *
- * <b>XN_PLAYER_SEEK_SET:</b> @c nFrameOffset specifies the total number of frames
- * since the beginning of the node's recording. This must be a positive value.
- *
- * <b>XN_PLAYER_SEEK_CUR:</b> @c nFrameOffset specifies the number of frames to move,
- * relative to the current frame of the specified node. A positive value means to
- * move forward, and a negative value means to move backwards.
- *
- * <b>XN_PLAYER_SEEK_END:</b> @c nFrameOffset specifies the number of frames to move,
- * relative to the end of the node's recording. This must be a negative value.
- *
- * You can get different results using this function for different values of strNodeName,
- * because the frame numbers of different nodes are not necessarily in sync.
- */
- inline XnStatus SeekToFrame(const XnChar* strNodeName, XnInt32 nFrameOffset, XnPlayerSeekOrigin origin)
- {
- return xnSeekPlayerToFrame(GetHandle(), strNodeName, nFrameOffset, origin);
- }
-
- /**
- * @brief Gets the current time of a player, i.e., the time passed since the beginning of the recording.
- *
- * @param [out] nTimestamp Retrieved timestamp. Units are in microseconds.
- */
- inline XnStatus TellTimestamp(XnUInt64& nTimestamp) const
- {
- return xnTellPlayerTimestamp(GetHandle(), &nTimestamp);
- }
-
- /**
- * @brief Gets the current frame number of a specific node played by a player,
- * i.e., the number of frames passed since the beginning of the recording
- *
- * @param [in] strNodeName Name of the node.
- * @param [out] nFrame Retrieved frame number.
- *
- * <b>Remarks</b>
- *
- * Different nodes that belong to the player can have different frame numbers, because
- * the nodes are not necessarily in synchronization.
- */
- inline XnStatus TellFrame(const XnChar* strNodeName, XnUInt32& nFrame) const
- {
- return xnTellPlayerFrame(GetHandle(), strNodeName, &nFrame);
- }
-
- /**
- * @brief Gets the total number of frames a specific node has in the recording.
- *
- * @param [in] strNodeName Name of the node for which to retrieve the number of frames.
- * @param [out] nFrames Retrieved number of frames.
- *
- */
- inline XnStatus GetNumFrames(const XnChar* strNodeName, XnUInt32& nFrames) const
- {
- return xnGetPlayerNumFrames(GetHandle(), strNodeName, &nFrames);
- }
-
- /**
- * @copybrief xnGetPlayerSupportedFormat
- * For full details and usage, see @ref xnGetPlayerSupportedFormat
- */
- inline const XnChar* GetSupportedFormat() const
- {
- return xnGetPlayerSupportedFormat(GetHandle());
- }
-
- /**
- * @copybrief xnEnumeratePlayerNodes
- * For full details and usage, see @ref xnEnumeratePlayerNodes
- */
- inline XnStatus EnumerateNodes(NodeInfoList& list) const
- {
- XnNodeInfoList* pList;
- XnStatus nRetVal = xnEnumeratePlayerNodes(GetHandle(), &pList);
- XN_IS_STATUS_OK(nRetVal);
-
- list.ReplaceUnderlyingObject(pList);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Returns whether the player is at the end-of-file marker.
- *
- * <b>Remarks</b>
- *
- * When Repeat mode is on, this function never returns TRUE.
- * However, the 'End of File Reached' event will be raised during rewind.
- */
- inline XnBool IsEOF() const
- {
- return xnIsPlayerAtEOF(GetHandle());
- }
-
- /**
- * @brief Registers an event handler for the 'End-Of-File Reached' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToEndOfFileReached(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToEndOfFileReached, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters the event handler for the 'End-Of-File Reached' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromEndOfFileReached(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromEndOfFileReached, GetHandle(), hCallback);
- }
-
- /**
- * @brief Sets the player's playback speed, as a ratio of the rate that the recording was made at.
- *
- * @param [in] dSpeed The speed ratio.
- *
- * <b>Values: </b>
- *
- * @c dSpeed = 1.0 - Player will try to output frames at the same rate they were recorded
- * (according to their timestamps).
- *
- * @c dSpeed > 1.0 - Fast-forward
- *
- * 0 < @c dSpeed < 1.0 - Slow-motion.
- *
- * @c dSpeed = XN_PLAYBACK_SPEED_FASTEST (0.0) - There will be no delay, and frames
- * will be returned immediately on demand.
- *
- */
- inline XnStatus SetPlaybackSpeed(XnDouble dSpeed)
- {
- return xnSetPlaybackSpeed(GetHandle(), dSpeed);
- }
-
- /**
- * @brief Gets the playback speed.
- * @returns Speed ratio, or -1.0 if this node is not a player.
- */
- inline XnDouble GetPlaybackSpeed() const
- {
- return xnGetPlaybackSpeed(GetHandle());
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- *
- * <b>Purpose:</b> Provides Cropping capability for @ref MapGenerator "map generator nodes".
- * Cropping capability restricts the size of the data frames to be generated by the
- * MapGenerator node to a selected (cropped) area of the full field-of-view.
- *
- * <b>Usage:</b> Do not instantiate directly. Instead, use @ref MapGenerator::GetCroppingCap()
- * to obtain an instance.
- *
- * <b>Remarks:</b>
- *
- * When cropping is enabled, the size of the generated map is reduced to fit a lower
- * resolution (smaller FOV dimensions). For example, if the map generator is working
- * in VGA resolution (640x480) and the application chooses to crop at 300x200, the next
- * pixel row will begin after 300 pixels. Pixels outside the cropping area are not returned
- * in the buffer - they are not blacked out; they are not returned at all. Thus, cropping
- * is very useful for providing a performance boost.
- *
- * <b>Event: 'Cropping Change'</b>
- *
- * Signals that the @ref holder_node "holder node"'s cropping area has been changed.
- *
- * Use @ref RegisterToCroppingChange() and @ref UnregisterFromCroppingChange() for using this event.
- *
- * Calling the @ref SetCropping() method raises this event.
- */
- class CroppingCapability : public Capability
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline CroppingCapability(XnNodeHandle hNode) : Capability(hNode) {}
- CroppingCapability(const NodeWrapper& node) : Capability(node) {}
-
- /**
- * @brief Sets the @ref holder_node "holder node"'s current cropping
- * configuration. This configuration is used for generating the next frame.
- *
- * @param [in] Cropping Cropping configuration to be set.
- *
- * @retval XN_STATUS_INVALID_OPERATION The @ref MapGenerator node does not support
- * the Cropping capability.
- */
- inline XnStatus SetCropping(const XnCropping& Cropping)
- {
- return xnSetCropping(GetHandle(), &Cropping);
- }
-
- /**
- * @brief Gets the current cropping configuration of the @ref holder_node "holder node".
- * This configuration is that set by @ref SetCropping(). This configuration is used
- * for generating the next frame.
- *
- * @param [out] Cropping Retreived cropping configuration.
- *
- * @retval XN_STATUS_INVALID_OPERATION The @ref MapGenerator node does not
- * support the Cropping capability.
- */
- inline XnStatus GetCropping(XnCropping& Cropping) const
- {
- return xnGetCropping(GetHandle(), &Cropping);
- }
-
- /**
- * @brief Registers an event handler for the 'Cropping Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToCroppingChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToCroppingChange, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters the event handler for the 'Cropping Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromCroppingChange(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromCroppingChange, GetHandle(), hCallback);
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * Allows access to <b>Anti Flicker</b> capability functions. see @ref anti_flicker
- * for additional details.
- *
- * <b>Usage:</b> Do not instantiate directly. Instead, use @ref MapGenerator::GetAntiFlickerCap()
- * to obtain an instance.
- */
- class AntiFlickerCapability : public Capability
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline AntiFlickerCapability(XnNodeHandle hNode) : Capability(hNode) {}
- AntiFlickerCapability(const NodeWrapper& node) : Capability(node) {}
-
- /**
- * @copybrief xnSetPowerLineFrequency
- * For full details and usage, see @ref xnSetPowerLineFrequency
- */
- inline XnStatus SetPowerLineFrequency(XnPowerLineFrequency nFrequency)
- {
- return xnSetPowerLineFrequency(GetHandle(), nFrequency);
- }
-
- /**
- * @copybrief xnGetPowerLineFrequency
- * For full details and usage, see @ref xnGetPowerLineFrequency
- */
- inline XnPowerLineFrequency GetPowerLineFrequency()
- {
- return xnGetPowerLineFrequency(GetHandle());
- }
-
- /**
- * @brief Registers an event handler for the 'Power Line Frequency Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToPowerLineFrequencyChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToPowerLineFrequencyChange, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters the event handler for the 'Power Line Frequency Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromPowerLineFrequencyChange(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromPowerLineFrequencyChange, GetHandle(), hCallback);
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- *
- * <b>Purpose:</b> The MapGenerator class is the base class for every generator node
- * that produces 2D map data, for example, depth maps, color image maps, IR maps, and
- * scene analysis maps.
- *
- * <b>Usage: </b> This class might be instantiated to reference any kind of map generator
- * node (i.e., a node that derives from the MapGenerator class), however it is not intended
- * to ever be instantiated to create any node of MapGenerator type itself.
- *
- * <b>Remarks:</b>
- *
- * Since the MapGenerator class is the base class for generator nodes that produce image
- * maps, it provides the data structures common to all map generators: the current frame's
- * X and Y dimensions and its frame rate.
- *
- * MapGenerator's two principle functions are GetMapOutputMode() and SetMapOutputMode()
- * for controlling and checking the node's map output mode. The map output mode is the
- * combination of the node's scene resolution and frame rate. Correspondingly, these
- * functions read and write an @ref xn::XnMapOutputMode structure, comprising three
- * parameters: the X and Y resolutions and the frame rate.
- */
- class MapGenerator : public Generator
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline MapGenerator(XnNodeHandle hNode = NULL) : Generator(hNode) {}
- inline MapGenerator(const NodeWrapper& other) : Generator(other) {}
-
- /**
- * @brief Gets the number of output modes that the generator node supports.
- *
- * <b>Remarks</b>
- *
- * This is useful for allocating an array that will be passed to GetSupportedMapOutputModes().
- */
- inline XnUInt32 GetSupportedMapOutputModesCount() const
- {
- return xnGetSupportedMapOutputModesCount(GetHandle());
- }
-
- /**
- * @brief Gets a list of all the output modes that the generator node supports.
- *
- * <b>Remarks</b>
- *
- * Each supported map output mode is represented by a @ref XnMapOutputMode structure
- * comprising resolution (@c nXRes and @c nYRes) and frames rate (@c nFPS). The application
- * then chooses one of the output modes. The size of the array that should be passed
- * can be obtained by calling GetSupportedMapOutputModesCount().
- */
- inline XnStatus GetSupportedMapOutputModes(XnMapOutputMode* aModes, XnUInt32& nCount) const
- {
- return xnGetSupportedMapOutputModes(GetHandle(), aModes, &nCount);
- }
-
- /**
- * @brief Sets the current map output mode of the generator node.
- *
- * <b>Remarks</b>
- *
- * A map output mode is contained in a @ref xn::XnMapOutputMode structure comprising
- * the frame rate (in frames per second), and the X and Y dimensions (the number
- * of elements in each of the X- and Y- axes).
- *
- * It is the application programmer's responsibility to check first if the output
- * mode is supported by calling the @ref xn::MapGenerator::GetSupportedMapOutputModes()
- * "GetSupportedMapOutputModes()" method.
- */
- inline XnStatus SetMapOutputMode(const XnMapOutputMode& OutputMode)
- {
- return xnSetMapOutputMode(GetHandle(), &OutputMode);
- }
-
- /**
- * @brief Gets the current map output mode of the generator node. This is the
- * map output mode that the generator node will use to generate the next data frame.
- *
- * <b>Remarks</b>
- *
- * A map output mode is the combination of the scene resolution and frame rate.
- * It is contained in an @ref xn::XnMapOutputMode structure comprising the frame
- * rate (in frames per second), and the X and Y dimensions (the number of elements
- * in each of the X- and Y- axes).
- *
- * For the map output mode of the most recent data frame available in the node's
- * metadata object, see the @ref xn::MapMetaData class (MapMetaData::Xres(), MapMetaData::YRes(),
- * and MapMetaData::FPS() methods).
- *
- * This map output mode is the mode set by @ref SetMapOutputMode().
- */
- inline XnStatus GetMapOutputMode(XnMapOutputMode &OutputMode) const
- {
- return xnGetMapOutputMode(GetHandle(), &OutputMode);
- }
-
- /**
- * @brief Gets the number of bytes per pixel for the node's map data. This mode
- * is set by SetPixelFormat() for the next frame that the generator node generates.
- *
- * <b>Remarks</b>
- *
- * In ImageGenerator this can be set. In other generators, it's pre-defined.
- */
- inline XnUInt32 GetBytesPerPixel() const
- {
- return xnGetBytesPerPixel(GetHandle());
- }
-
- /**
- * @brief Registers an event handler for the 'Map Output Mode Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToMapOutputModeChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToMapOutputModeChange, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters the event handler for the 'Map Output Mode Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromMapOutputModeChange(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromMapOutputModeChange, GetHandle(), hCallback);
- }
-
- /**
- * @brief Gets a @ref CroppingCapability object for accessing Cropping functionality.
- *
- * <b>Remarks</b>
- *
- * It is the application's responsibility to check first if @ref XN_CAPABILITY_CROPPING
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline const CroppingCapability GetCroppingCap() const
- {
- return CroppingCapability(GetHandle());
- }
-
- /**
- * @brief Gets a @ref CroppingCapability object for accessing Cropping functionality.
- *
- * <b>Remarks</b>
- *
- * It is the application's responsibility to check first if @ref XN_CAPABILITY_CROPPING
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline CroppingCapability GetCroppingCap()
- {
- return CroppingCapability(GetHandle());
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Brightness functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_BRIGHTNESS
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetBrightnessCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_BRIGHTNESS);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Contrast functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_CONTRAST
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetContrastCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_CONTRAST);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Hue functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_HUE
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetHueCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_HUE);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Saturation functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_SATURATION
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetSaturationCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_SATURATION);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Sharpness functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_SHARPNESS
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetSharpnessCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_SHARPNESS);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Gamma functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_GAMMA
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetGammaCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_GAMMA);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing WhiteBalance functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_COLOR_TEMPERATURE
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetWhiteBalanceCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_COLOR_TEMPERATURE);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing BacklightCompensation functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_BACKLIGHT_COMPENSATION
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetBacklightCompensationCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_BACKLIGHT_COMPENSATION);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Gain functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_GAIN
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetGainCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_GAIN);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Pan functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_PAN
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetPanCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_PAN);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Tilt functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_TILT
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetTiltCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_TILT);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Roll functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_ROLL
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetRollCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_ROLL);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Zoom functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_ZOOM
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetZoomCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_ZOOM);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Exposure functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_EXPOSURE
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetExposureCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_EXPOSURE);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Iris functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_IRIS
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetIrisCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_IRIS);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Focus functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_FOCUS
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetFocusCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_FOCUS);
- }
-
- /**
- * Gets an @ref GeneralIntCapability object for accessing Low Light Compensation functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_LOW_LIGHT_COMPENSATION
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline GeneralIntCapability GetLowLightCompensationCap()
- {
- return GeneralIntCapability(GetHandle(), XN_CAPABILITY_LOW_LIGHT_COMPENSATION);
- }
-
- /**
- * Gets an @ref AntiFlickerCapability object for accessing Anti Flicker functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_ANTI_FLICKER
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline AntiFlickerCapability GetAntiFlickerCap()
- {
- return AntiFlickerCapability(GetHandle());
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * Allows access to <b>User Position</b> capability functions. see @ref userpos for
- * additional details.
- *
- * <b>Usage:</b> Do not instantiate directly. Instead, use @ref DepthGenerator::GetUserPositionCap()
- * to obtain an instance.
- */
- class UserPositionCapability : public Capability
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline UserPositionCapability(XnNodeHandle hNode = NULL) : Capability(hNode) {}
- UserPositionCapability(const NodeWrapper& node) : Capability(node) {}
-
- /**
- * @copybrief xnGetSupportedUserPositionsCount
- * For full details and usage, see @ref xnGetSupportedUserPositionsCount
- */
- inline XnUInt32 GetSupportedUserPositionsCount() const
- {
- return xnGetSupportedUserPositionsCount(GetHandle());
- }
-
- /**
- * @copybrief xnSetUserPosition
- * For full details and usage, see @ref xnSetUserPosition
- */
- inline XnStatus SetUserPosition(XnUInt32 nIndex, const XnBoundingBox3D& Position)
- {
- return xnSetUserPosition(GetHandle(), nIndex, &Position);
- }
-
- /**
- * @copybrief xnGetUserPosition
- * For full details and usage, see @ref xnGetUserPosition
- */
- inline XnStatus GetUserPosition(XnUInt32 nIndex, XnBoundingBox3D& Position) const
- {
- return xnGetUserPosition(GetHandle(), nIndex, &Position);
- }
-
- /**
- * @brief Registers an event handler for the 'User Position Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToUserPositionChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToUserPositionChange, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters the event handler for the 'User Position Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromUserPositionChange(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromUserPositionChange, GetHandle(), hCallback);
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> A DepthGenerator node generates depth maps. Each pixel value of
- * a depth map represents a distance from the sensor's plane in millimeters.
- *
- * <b>Usage:</b> Instantiate the class and call Create() to create a DepthGenerator
- * node.
- *
- * This class is at the first level of classes in the OpenNI class hierarchy that is
- * typically instantiated to create an actual node. (Examples of other classes at the
- * first level are @ref xn::ImageGenerator and @ref xn::SceneAnalyzer).
- *
- * <b>Data output:</b> Depth maps and associated configuration data. Access via the node's
- * @ref xn::DepthMetaData object.
- *
- * <b>Overview:</b>
- *
- * A DepthGenerator node generates a depth map as an array of pixels, where each pixel
- * is a depth value representing a distance from the sensor's plane in millimeters. This is
- * the Z-coordinate of the X-Y-Z coordinate of each user pixel. A smaller depth value
- * indicates a scene point that is <i>closer</i> to the hardware sensor device; and
- * a larger depth value indicates a scene point that is a <i>further away</i> from the
- * sensor. A zero depth value indicates that the DepthGenerator node did not succeed
- * in obtaining a valid depth reading.
- *
- * Typically, the process of generating 3D data begins by using a sensor device that
- * produces raw output data. Dedicated middleware is then used to process this raw output,
- * and produce a higher-level output, which can then be understood and used by the application.
- *
- * In a typical OpenNI production graph, a DepthGenerator node takes input directly
- * from a sensor device and generates a depth map. Other generator nodes further along
- * the production graph (dependant on the DepthGenerator node) take input from the DepthGenerator
- * node's output. However, alternative dependency configurations are also possible.
- *
- * The DepthGenerator node's data and associated configuration are accessed through
- * its @ref glos_frame_object "frame object" (i.e., its @ref xn::DepthMetaData object).
- *
- * Summary of Main Features:
- * - Depth map: Provides the data of the depth map
- * - Sensor device's maximum depth: Provides the maximum distance available for this
- * depth generator
- * - Field of View: Provides the sensor's maximum horizontal and vertical angles
- * - User Position capability (optional)
- */
- class DepthGenerator : public MapGenerator
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline DepthGenerator(XnNodeHandle hNode = NULL) : MapGenerator(hNode) {}
- inline DepthGenerator(const NodeWrapper& other) : MapGenerator(other) {}
-
- /**
- * @brief Creates a DepthGenerator node from available @ref node_alternative "production node alternatives".
- *
- * <b>Remarks:</b>
- *
- * For full details and usage, see @ref create_method.
- */
- inline XnStatus Create(Context& context, Query* pQuery = NULL, EnumerationErrors* pErrors = NULL);
-
- /**
- * @brief Gets the depth generator node's latest @ref glos_frame_object "frame object", saving
- * it in the @ref xn::DepthMetaData object. This @ref glos_frame_object "frame object" is a
- * snapshot of the generated depth map data and its associated configuration information at a
- * certain point in time. This saved @ref glos_frame_object "frame object" provides fast
- * and easy access to the depth generator node's data and configuration information.
- *
- * @param [out] metaData Structure to be filled with the frame object.
- *
- * <b>Remarks:</b>
- *
- * This method is central in the use of the DepthGenerator node. Once the DepthGenerator
- * node is generating data, after each @ref conc_updating_data "'Update Data'" call,
- * the application calls this method to get the node's frame object, which contains
- * the data and all its associated properties.
- */
- inline void GetMetaData(DepthMetaData& metaData) const
- {
- xnGetDepthMetaData(GetHandle(), metaData.GetUnderlying());
- }
-
- /**
- * @copybrief xnGetDepthMap
- * For full details and usage, see @ref xnGetDepthMap
- */
- inline const XnDepthPixel* GetDepthMap() const
- {
- return xnGetDepthMap(GetHandle());
- }
-
- /**
- * @brief Gets the maximum depth value that the DepthGenerator node can generate.
- * The maximum depth value is a hardware specification of the sensor.
- *
- * <b>Remarks:</b>
- *
- * A typical maximum depth supports up to 10 meters of depth. Units are in millimeters,
- * so the maximum depth value for 10 meters of depth would range from 0 to 10,000.
- */
- inline XnDepthPixel GetDeviceMaxDepth() const
- {
- return xnGetDeviceMaxDepth(GetHandle());
- }
-
- /**
- * @brief Gets the dimensions of the field of view (FOV) of the hardware sensor.
- *
- * @param [out] FOV A struct to be filled with the field of view of the hardware sensor.
- *
- * <b>Remarks:</b>
- *
- * This method gets the dimensions of the field of view in radians. Radians are
- * used for the output form since they are a spherical measurement and the FOV is
- * defined in terms of the angle of width and height that the sensor sees, e.g.,
- * 0.524 radians (30 degrees) above and below, and 1.047 radians (60 degrees) left
- * and right.
- *
- * This method is useful for developers building algorithms to convert between real
- * world and productive coordinate systems. Although OpenNI offers its own functionality
- * for converting real-world and productive coordinate systems, some developers
- * may wish to build their own conversion functions for reasons of optimization.
- */
- inline XnStatus GetFieldOfView(XnFieldOfView& FOV) const
- {
- return xnGetDepthFieldOfView(GetHandle(), &FOV);
- }
-
- /**
- * @brief Registers an event handler for the 'Field-Of-View Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToFieldOfViewChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToDepthFieldOfViewChange, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters the event handler for the 'Field-Of-View Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromFieldOfViewChange(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromDepthFieldOfViewChange, GetHandle(), hCallback);
- }
-
- /**
- * @brief Converts a list of points from projective coordinates to real world coordinates.
- *
- * @param [in] nCount Number of points to convert.
- * @param [in] aProjective Array of projective point coordinates.
- * @param [in,out] aRealWorld Array to be filled with real-world point coordinates.
- *
- * See @ref conc_coord for futher information.
- */
- inline XnStatus ConvertProjectiveToRealWorld(XnUInt32 nCount, const XnPoint3D aProjective[], XnPoint3D aRealWorld[]) const
- {
- return xnConvertProjectiveToRealWorld(GetHandle(), nCount, aProjective, aRealWorld);
- }
-
- /**
- * @brief Converts a list of points from real world coordinates to projective coordinates.
- *
- * @param [in] nCount Number of points to convert.
- * @param [in] aRealWorld Array of projective point coordinates.
- * @param [in,out] aProjective Array to be filled with real-world point coordinates.
- *
- * See @ref conc_coord for futher information.
- */
- inline XnStatus ConvertRealWorldToProjective(XnUInt32 nCount, const XnPoint3D aRealWorld[], XnPoint3D aProjective[]) const
- {
- return xnConvertRealWorldToProjective(GetHandle(), nCount, aRealWorld, aProjective);
- }
-
- /**
- * Gets an @ref UserPositionCapability object for accessing User Position functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_USER_POSITION
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline const UserPositionCapability GetUserPositionCap() const
- {
- return UserPositionCapability(GetHandle());
- }
-
- /**
- * Gets an @ref UserPositionCapability object for accessing User Position functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_USER_POSITION
- * is supported by calling @ref IsCapabilitySupported().
- */
- inline UserPositionCapability GetUserPositionCap()
- {
- return UserPositionCapability(GetHandle());
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * Represents a mock depth generator
- */
- class MockDepthGenerator : public DepthGenerator
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline MockDepthGenerator(XnNodeHandle hNode = NULL) : DepthGenerator(hNode) {}
- inline MockDepthGenerator(const NodeWrapper& other) : DepthGenerator(other) {}
-
- /**
- * Creates a mock depth generator
- *
- * @param [in] context The context in which the node should be generated
- * @param [in] strName Optional. The name of the new node.
- */
- XnStatus Create(Context& context, const XnChar* strName = NULL);
-
- /**
- * Creates a mock depth generator, copying the initial state from another depth
- * generator.
- *
- * @param [in] other The depth generator to copy state from
- * @param [in] strName Optional. The name of the new node.
- */
- XnStatus CreateBasedOn(DepthGenerator& other, const XnChar* strName = NULL);
-
- /**
- * @copybrief xnMockDepthSetData
- * For full details and usage, see @ref xnMockDepthSetData
- */
- inline XnStatus SetData(XnUInt32 nFrameID, XnUInt64 nTimestamp, XnUInt32 nDataSize, const XnDepthPixel* pDepthMap)
- {
- return xnMockDepthSetData(GetHandle(), nFrameID, nTimestamp, nDataSize, pDepthMap);
- }
-
- /**
- * Sets the data of the mock node from a meta data object, overriding frame ID and
- * timestamp
- *
- * @param [in] depthMD Object to take data from
- * @param [in] nFrameID Frame ID
- * @param [in] nTimestamp Timestamp
- */
- inline XnStatus SetData(const DepthMetaData& depthMD, XnUInt32 nFrameID, XnUInt64 nTimestamp)
- {
- return SetData(nFrameID, nTimestamp, depthMD.DataSize(), depthMD.Data());
- }
-
- /**
- * Sets the data of the mock node from a metadata object.
- *
- * @param [in] depthMD Object to take data from
- */
- inline XnStatus SetData(const DepthMetaData& depthMD)
- {
- return SetData(depthMD, depthMD.FrameID(), depthMD.Timestamp());
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> The ImageGenerator node generates color image maps of various formats.
- *
- * <b>Usage:</b> Instantiate the class and create an image generator node
- *
- * <b>Data output:</b> Image maps
- *
- * <b>Overview:</b>
- *
- * The ImageGenerator node generates color image maps of various formats, such as the
- * RGB24 image format. Call its SetPixelFormat() method to set the image format to be
- * generated.
- *
- * The other important function here is GetMetaData(), which, as in other generator
- * nodes, gets the image frame object, through which you can access all the properties
- * and the actual data of the saved frame.
- */
- class ImageGenerator : public MapGenerator
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline ImageGenerator(XnNodeHandle hNode = NULL) : MapGenerator(hNode) {}
- inline ImageGenerator(const NodeWrapper& other) : MapGenerator(other) {}
-
- /**
- * @brief Creates and initializes an ImageGenerator node from available @ref node_alternative "production node alternatives".
- *
- * For full details and usage, see @ref create_method.
- */
- inline XnStatus Create(Context& context, Query* pQuery = NULL, EnumerationErrors* pErrors = NULL);
-
- /**
- * @brief Gets the image generator node's latest @ref glos_frame_object "frame object", saving
- * it in the @ref xn::ImageMetaData object. This @ref glos_frame_object "frame object" is a
- * snapshot of the generated image map data and its associated configuration information at a
- * certain point in time. This saved @ref glos_frame_object "frame object" provides fast
- * and easy access to the image generator node's data and configuration information.
- *
- * @param [out] metaData Structure to be filled with the frame object.
- *
- * <b>Remarks:</b>
- *
- * This method is central in the use of the ImageGenerator node. Once the ImageGenerator
- * node is generating data, after each @ref conc_updating_data "'Update Data'" call,
- * the application calls this method to get the node's frame object, which contains
- * the data and all its associated properties.
- */
- inline void GetMetaData(ImageMetaData& metaData) const
- {
- xnGetImageMetaData(GetHandle(), metaData.GetUnderlying());
- }
-
- /**
- * @copybrief xnGetRGB24ImageMap
- * For full details and usage, see @ref xnGetRGB24ImageMap
- */
- inline const XnRGB24Pixel* GetRGB24ImageMap() const
- {
- return xnGetRGB24ImageMap(GetHandle());
- }
-
- /**
- * @copybrief xnGetYUV422ImageMap
- * For full details and usage, see @ref xnGetYUV422ImageMap
- */
- inline const XnYUV422DoublePixel* GetYUV422ImageMap() const
- {
- return xnGetYUV422ImageMap(GetHandle());
- }
-
- /**
- * @copybrief xnGetGrayscale8ImageMap
- * For full details and usage, see @ref xnGetGrayscale8ImageMap
- */
- inline const XnGrayscale8Pixel* GetGrayscale8ImageMap() const
- {
- return xnGetGrayscale8ImageMap(GetHandle());
- }
-
- /**
- * @copybrief xnGetGrayscale16ImageMap
- * For full details and usage, see @ref xnGetGrayscale16ImageMap
- */
- inline const XnGrayscale16Pixel* GetGrayscale16ImageMap() const
- {
- return xnGetGrayscale16ImageMap(GetHandle());
- }
-
- /**
- * @copybrief xnGetImageMap()
- * For full details, see @ref xnGetImageMap().
- */
- inline const XnUInt8* GetImageMap() const
- {
- return xnGetImageMap(GetHandle());
- }
-
- /**
- * @brief Returns whether the ImageGenerator node supports a specific
- * pixel color format for the image map.
- *
- * @param [in] Format The format to check for.
- *
- * <b>Remarks</b>
- *
- * Use this method before setting the pixel format for the next frame to be generated.
- */
- inline XnBool IsPixelFormatSupported(XnPixelFormat Format) const
- {
- return xnIsPixelFormatSupported(GetHandle(), Format);
- }
-
- /**
- * @brief Sets the ImageGenerator node's current 'pixel color' format.
- * This format is used for generating the next frame.
- *
- * @param [in] Format The format to set.
- *
- * <b>Remarks</b>
- *
- * As an example of a pixel color format, the RGB24 image format has one byte for
- * red, one byte for green, and one byte for blue.
- *
- * When reading the generated data you must use the appropriate 'get' function,
- * e.g., call RGB24Data() to read data generated as the RGB24Data format.
- *
- * It is the user responsibility to check first if the pixel format is supported
- * by calling @ref xn::ImageGenerator::IsPixelFormatSupported().
- */
- inline XnStatus SetPixelFormat(XnPixelFormat Format)
- {
- return xnSetPixelFormat(GetHandle(), Format);
- }
-
- /**
- * @brief Gets the current pixel color format. This is the format set
- * using @ref xn::ImageGenerator node::SetPixelFormat().
- *
- * <b>Remarks</b>
- *
- * To get the pixel format of the saved frame - in the @ref glos_frame_object "frame
- * object" - use the appropriate method of the node's associated @ref xn::ImageMetaData
- * object.
- */
- inline XnPixelFormat GetPixelFormat() const
- {
- return xnGetPixelFormat(GetHandle());
- }
-
- /**
- * @brief Registers an event handler for the 'Pixel Format Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToPixelFormatChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToPixelFormatChange, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters the event handler for the 'Pixel Format Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromPixelFormatChange(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromPixelFormatChange, GetHandle(), hCallback);
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * Represents a mock image generator
- */
- class MockImageGenerator : public ImageGenerator
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline MockImageGenerator(XnNodeHandle hNode = NULL) : ImageGenerator(hNode) {}
- inline MockImageGenerator(const NodeWrapper& other) : ImageGenerator(other) {}
-
- /**
- * Creates a mock image generator
- *
- * @param [in] context The context in which the node should be generated
- * @param [in] strName Optional. The name of the new node.
- */
- XnStatus Create(Context& context, const XnChar* strName = NULL);
-
- /**
- * Creates a mock image generator, copying the initial state from another image
- * generator.
- *
- * @param [in] other The image generator to copy state from
- * @param [in] strName Optional. The name of the new node.
- */
- XnStatus CreateBasedOn(ImageGenerator& other, const XnChar* strName = NULL);
-
- /**
- * @copybrief xnMockImageSetData
- * For full details and usage, see @ref xnMockImageSetData
- */
- inline XnStatus SetData(XnUInt32 nFrameID, XnUInt64 nTimestamp, XnUInt32 nDataSize, const XnUInt8* pImageMap)
- {
- return xnMockImageSetData(GetHandle(), nFrameID, nTimestamp, nDataSize, pImageMap);
- }
-
- /**
- * Sets the data of the mock node from a meta data object, overriding frame ID and
- * timestamp
- *
- * @param [in] imageMD Object to take data from
- * @param [in] nFrameID Frame ID
- * @param [in] nTimestamp Timestamp
- */
- inline XnStatus SetData(const ImageMetaData& imageMD, XnUInt32 nFrameID, XnUInt64 nTimestamp)
- {
- return SetData(nFrameID, nTimestamp, imageMD.DataSize(), imageMD.Data());
- }
-
- /**
- * Sets the data of the mock node from a meta data object.
- *
- * @param [in] imageMD Object to take data from
- */
- inline XnStatus SetData(const ImageMetaData& imageMD)
- {
- return SetData(imageMD, imageMD.FrameID(), imageMD.Timestamp());
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> An IRGenerator node is a map generator that outputs infra-red maps.
- *
- * <b>Usage:</b> Instantiate and create an IR generator node
- *
- * <b>Data output:</b> IR maps
- */
- class IRGenerator : public MapGenerator
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline IRGenerator(XnNodeHandle hNode = NULL) : MapGenerator(hNode) {}
- inline IRGenerator(const NodeWrapper& other) : MapGenerator(other) {}
-
- /**
- * @brief Creates an IRGenerator node from available @ref node_alternative "production node alternatives".
- *
- * See @ref create_method for a detailed description
- * about the operation of this method.
- */
- inline XnStatus Create(Context& context, Query* pQuery = NULL, EnumerationErrors* pErrors = NULL);
-
- /**
- * @brief Gets the IR generator node's latest @ref glos_frame_object "frame object", saving
- * it in the @ref xn::IRMetaData object. This @ref glos_frame_object "frame object" is a
- * snapshot of the generated IR map data and its associated configuration information at a
- * certain point in time. This saved @ref glos_frame_object "frame object" provides fast
- * and easy access to the IR generator node's data and configuration information.
- *
- * @param [out] metaData Structure to be filled with the frame object.
- *
- * <b>Remarks:</b>
- *
- * This method is central in the use of the IRGenerator node. Once the IRGenerator
- * node is generating data, after each @ref conc_updating_data "'Update Data'" call,
- * the application calls this method to get the node's frame object, which contains
- * the data and all its associated properties.
- */
- inline void GetMetaData(IRMetaData& metaData) const
- {
- xnGetIRMetaData(GetHandle(), metaData.GetUnderlying());
- }
-
- /**
- * @brief Gets a pointer to the latest IR map.
- */
- inline const XnIRPixel* GetIRMap() const
- {
- return xnGetIRMap(GetHandle());
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * Represents a mock IR generator
- */
- class MockIRGenerator : public IRGenerator
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline MockIRGenerator(XnNodeHandle hNode = NULL) : IRGenerator(hNode) {}
- inline MockIRGenerator(const NodeWrapper& other) : IRGenerator(other) {}
-
- /**
- * Creates a mock IR generator
- *
- * @param [in] context The context in which the node should be generated
- * @param [in] strName Optional. The name of the new node.
- */
- XnStatus Create(Context& context, const XnChar* strName = NULL);
- /**
- * Creates a mock IR generator, copying the initial state from another IR generator.
- *
- * @param [in] other The IR generator to copy state from
- * @param [in] strName Optional. The name of the new node.
- */
- XnStatus CreateBasedOn(IRGenerator& other, const XnChar* strName = NULL);
-
- /**
- * @copybrief xnMockIRSetData
- * For full details and usage, see @ref xnMockIRSetData
- */
- inline XnStatus SetData(XnUInt32 nFrameID, XnUInt64 nTimestamp, XnUInt32 nDataSize, const XnIRPixel* pIRMap)
- {
- return xnMockIRSetData(GetHandle(), nFrameID, nTimestamp, nDataSize, pIRMap);
- }
-
- /**
- * Sets the data of the mock node from a meta data object, overriding frame ID and
- * timestamp
- *
- * @param [in] irMD Object to take data from
- * @param [in] nFrameID Frame ID
- * @param [in] nTimestamp Timestamp
- */
- inline XnStatus SetData(const IRMetaData& irMD, XnUInt32 nFrameID, XnUInt64 nTimestamp)
- {
- return SetData(nFrameID, nTimestamp, irMD.DataSize(), irMD.Data());
- }
-
- /**
- * Sets the data of the mock node from a meta data object.
- *
- * @param [in] irMD Object to take data from
- */
- inline XnStatus SetData(const IRMetaData& irMD)
- {
- return SetData(irMD, irMD.FrameID(), irMD.Timestamp());
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b>A GesturesGenerator node recognizes certain hand gestures and raise
- * corresponding events accordingly.
- *
- * A gesture is a specific hand movement. The gesture generator node scans the FOV to
- * detect gestures and generates the gesture data.
- *
- * <b>Usage:</b> Instantiate to create a gesture generator node.
- *
- * An example of a gesture is a specific hand movement. For example, the developer who builds
- * a gesture generator node can decide that waving a hand can be a gesture; pushing can be a gesture.
- * The developer can build an OpenNI gesture generator to support any number of gestures.
- *
- * <b>Overview with Sample of a Usage Scenario:</b>
- *
- * @note Everything in this introduction is just an @e example of usage; there
- * is no obligation to use the gesture generator node in the particular way described
- * here.
- *
- * An application might want to know who is the person they should interact with. For example,
- * if currently there are three people in the room, which hand should be tracked?
- *
- * The application can use a specific gesture (such as waving to the camera) as a focus gesture,
- * meaning the person who performs this gesture will be the one interacting with the application.
- *
- * To do that, the application can use a GestureGenerator to detect that specific gesture and then
- * use the position of that gesture to initialize the HandsGenerator, asking it to track the hand
- * located at that position. (There is no inherent connection between the GestureGenerator and the
- * HandsGenerator. Detecting a gesture and using that position to initialize the HandsGenerator is
- * just an example of how applications can use the two).
- *
- * <b>Sample Process: Setting up a Gesture Generator</b>
- *
- * <b>1. Creating a Gesture Generator </b>
- *
- * Assuming there is a gesture generator module (plug-in) installed on the computer, the application
- * can create a gesture generator node and configure it to recognize gestures. As for many other
- * types of generator nodes, use the @ref Create() method of the GestureGenerator class to create a
- * gesture generator node.
- *
- * <b>2. Enumerating generators</b>
- *
- * Now, once the application has created a gesture generator node, the application can
- * find out which gestures are supported by enumerating all its gestures. The gestures
- * are identified by their names, e.g., "Wave" and "Click".
- *
- * The gesture generator node maintains a list of active gestures. An active gesture
- * is a gesture for which the gesture generator is scanning the FOV in an attempt
- * to recognize the gesture. Thus, to cause the gesture generator node to start scanning
- * for a gesture, the application must add it to its list of active gestures.
- *
- * In a typical application, the application detects one gesture - the focus gesture -
- * and can then send its location to the hand generator node. The application typically
- * will then not want to recognize further gestures and so it must remove the gesture from
- * the list; further gestures in the FOV may cause confusion. For example, if one particular
- * human user started to control the TV, that user would not want someone else "taking the control".
- *
- * <b>3. Recognizing Gestures </b>
- *
- * Every gesture has an identification point (the position where the gesture was identified - perhaps
- * in retrospect) and an end point (the position in which the hand currently is), although in most cases,
- * both points will be the same. The application must know the position of the end of the gesture
- * movement; because that's where the hand really is at the time the application gets the 'Gesture Recognized'
- * event. The gesture generator sends both positions with the 'Gesture Recognized' event to the application.
- * The application can then pass the end position to the hand generator for tracking that hand.
- */
- class GestureGenerator : public Generator
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline GestureGenerator(XnNodeHandle hNode = NULL) : Generator(hNode) {}
- inline GestureGenerator(const NodeWrapper& other) : Generator(other) {}
-
- /**
- * @brief Creates a gesture generator node from available @ref node_alternative "production node alternatives".
- *
- * <b>Remarks</b>
- *
- * The application then uses the @ref AddGesture() method in order to activate the
- * gesture.
- *
- * Typical gestures are focus gestures. Examples of focus gestures are 'Wave' and
- * 'Click'.
- *
- * See @ref create_method for a detailed description of this method.
- */
- inline XnStatus Create(Context& context, Query* pQuery = NULL, EnumerationErrors* pErrors = NULL);
-
- /**
- * @brief Activates the GestureGenerator node to start looking for the named gesture in the FOV.
- * It does this by adding the gesture's name to the list of gestures that the GestureGenerator node
- * actively scans for in the FOV. If an area is supplied, the gesture will only be recognized if
- * it is detected in that area.
- *
- * @param [in] strGesture Name of the gesture to look for
- * @param [in] pArea Area in which to look for the gesture (in real-world coordinates)
- *
- * <b>Remarks</b>
- *
- * This gesture must be one of the built-in gestures of the GestureGenerator node.
- */
- inline XnStatus AddGesture(const XnChar* strGesture, XnBoundingBox3D* pArea)
- {
- return xnAddGesture(GetHandle(), strGesture, pArea);
- }
-
- /**
- * @brief Disables the GestureGenerator from looking for the named gesture in the FOV.
- * It does this by removing the gesture's name from the list of gestures that the
- * GestureGenerator node actively scans for in the FOV.
- *
- * @param [in] strGesture The name of the gesture to not look for anymore.
- */
- inline XnStatus RemoveGesture(const XnChar* strGesture)
- {
- return xnRemoveGesture(GetHandle(), strGesture);
- }
-
- /**
- * @brief Get the names of all gestures that are currently active in this generator node.
- *
- * @param [out] astrGestures Preallocated memory, for the gesture names
- * @param [in] nNameLength Memory size for each gesture name
- * @param [in,out] nGestures Inputs the total size of the preallocated memory.
- * Outputs the total number of gestures in the list.
- */
- inline XnStatus GetAllActiveGestures(XnChar** astrGestures, XnUInt32 nNameLength, XnUInt16& nGestures) const
- {
- return xnGetAllActiveGestures(GetHandle(), astrGestures, nNameLength, &nGestures);
- }
-
- /**
- * @copybrief xnGetNumberOfAvailableGestures
- * For full details and usage, see @ref xnGetNumberOfAvailableGestures
- */
- inline XnUInt16 GetNumberOfAvailableGestures() const
- {
- return xnGetNumberOfAvailableGestures(GetHandle());
- }
-
- /**
- * @brief Gets the names of all active gestures in this generator node.
- *
- * @param [out] astrGestures Preallocated memory, for the gesture names
- * @param [in] nNameLength Memory size for each gesture name
- * @param [in,out] nGestures The size of the preallocated memory. Changed to number
- * of gestures
- */
- inline XnStatus EnumerateAllGestures(XnChar** astrGestures, XnUInt32 nNameLength, XnUInt16& nGestures) const
- {
- return xnEnumerateAllGestures(GetHandle(), astrGestures, nNameLength, &nGestures);
- }
-
- /**
- * @brief Returns whether a specific gesture is available in this generator node.
- * @param [in] strGesture Name of the gesture to check
- *
- */
- inline XnBool IsGestureAvailable(const XnChar* strGesture) const
- {
- return xnIsGestureAvailable(GetHandle(), strGesture);
- }
-
- /**
- * @copybrief xnIsGestureProgressSupported
- * For full details and usage, see @ref xnIsGestureProgressSupported
- */
- inline XnBool IsGestureProgressSupported(const XnChar* strGesture) const
- {
- return xnIsGestureProgressSupported(GetHandle(), strGesture);
- }
-
- /**
- * Callback for the recognition of a gesture.
- * Signals that the GestureGenerator node has recognized the named gesture in the scene.
-
- * Example of a callback header to handle the event:
- @code
- void XN_CALLBACK_TYPE GestureRecognized (GestureGenerator &generator, const XnChar *strGesture,
- const XnPoint3D *pIDPosition, const XnPoint3D *pEndPosition,
- void *pCookie)
- @endcode
- *
- * @param [in] generator Node that raised the event.
- * @param [in] strGesture Name of the gesture that was recognized.
- * @param [in] pIDPosition X-Y-Z location coordinates of the hand point position in which the gesture was identified.
- * @param [in] pEndPosition Position of the hand at the end of the gesture. This is the hand that performed the gesture.
- * @param [in] pCookie User-provided cookie that was given when registering to this event.
-
- <b>Remarks</b>
-
- This event returns the identification point (the position where the gesture was identified - perhaps in retrospect) and an end point (the position in which the hand currently is), although in most cases, both points will be the same. The end position of the gesture movement is where the hand is located at the time the GestureGenerator recognized a complete gesture and raised the event.
- */
- typedef void (XN_CALLBACK_TYPE* GestureRecognized)(GestureGenerator& generator, const XnChar* strGesture, const XnPoint3D* pIDPosition, const XnPoint3D* pEndPosition, void* pCookie);
-
- /**
- * Callback for indication that a certain gesture is in progress.
- *
- * Signals to the application that a gesture is expected to soon be recognized,
- * that is, a gesture is in progress.
- *
- * Example of a callback header to handle the event: @code
- void XN_CALLBACK_TYPE GestureProgress (GestureGenerator &generator, const XnChar *strGesture,
- const XnPoint3D *pPosition, XnFloat fProgress,
- void *pCookie)
- @endcode
- *
- * @param [in] generator The node that raised the event.
- * @param [in] strGesture The gesture that is on its way to being recognized.
- * @param [in] pPosition The current position of the hand that is performing the gesture.
- * @param [in] fProgress The percentage of the gesture that was already performed.
- * @param [in] pCookie A user-provided cookie that was given when registering to this event.
- *
- * Gesture progress varies between different types of gestures. For the 'Click'
- * gesture, for example, the click gesture's first step is the 'Push' movement (assuming
- * the click gesture is defined as 'Push' and then 'Pull'). When the hand in the
- * FOV completes the 'Push' the GestureGenerator node raises this event.
- *
- * After the hand in the FOV completes the pull motion, the node sends the 'Gesture
- * Recognized' event, as described above.
- */
- typedef void (XN_CALLBACK_TYPE* GestureProgress)(GestureGenerator& generator, const XnChar* strGesture, const XnPoint3D* pPosition, XnFloat fProgress, void* pCookie);
-
- /**
- * @brief Registers event handlers for the 'Gesture Recognized' and 'Gesture Progress' events.
- * Pass NULL for any event the application does not need to receive.
- *
- * @param [in] RecognizedCB [Optional] Callback function to be invoked when the 'Gesture Recognized' event is raised.
- * @param [in] ProgressCB [Optional] Callback function to be invoked when the 'Gesture Progress' event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- XnStatus RegisterGestureCallbacks(GestureRecognized RecognizedCB, GestureProgress ProgressCB, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- GestureCookie* pGestureCookie;
- XN_VALIDATE_ALLOC(pGestureCookie, GestureCookie);
- pGestureCookie->recognizedHandler = RecognizedCB;
- pGestureCookie->progressHandler = ProgressCB;
- pGestureCookie->pUserCookie = pCookie;
-
- nRetVal = xnRegisterGestureCallbacks(GetHandle(), GestureRecognizedCallback, GestureProgressCallback, pGestureCookie, &pGestureCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pGestureCookie);
- return (nRetVal);
- }
-
- hCallback = pGestureCookie;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Unregisters the event handlers for the 'Gesture Recognized' and 'Gesture Progress' events.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterGestureCallbacks(XnCallbackHandle hCallback)
- {
- GestureCookie* pGestureCookie = (GestureCookie*)hCallback;
- xnUnregisterGestureCallbacks(GetHandle(), pGestureCookie->hCallback);
- xnOSFree(pGestureCookie);
- }
-
- /**
- * @brief Registers an event handler for the 'Gesture Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToGestureChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToGestureChange, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters an event handler for the 'Gesture Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromGestureChange(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromGestureChange, GetHandle(), hCallback);
- }
-
- /**
- * Callback for indication that an intermediate stage of a gesture has been completed.
- *
- * Example of a callback function to handle the event:
- @code
- void XN_CALLBACK_TYPE GestureIntermediateStageCompleted(GestureGenerator& generator, const XnChar *strGesture,
- const XnPoint3D *pPosition, void *pCookie)
- @endcode
- *
- * @param [in] generator The node that raised the event.
- * @param [in] strGesture The gesture that is on its way to being recognized.
- * @param [in] pPosition The current position of the hand that is performing the gesture.
- * @param [in] pCookie A user-provided cookie that was given when registering to this event.
- *
- * <b>Remarks</b>
- *
- * For different types of gestures there is a different point at which the GestureGenerator
- * node can recognize that a gesture is in progress. For the 'Click' gesture, for
- * example, the first step is the 'Push' movement (assuming the click gesture is
- * defined as 'Push' and then 'Pull'). When the hand in the FOV completes the 'Push'
- * the GestureGenerator node raises this event.
- *
- * The difference between the 'Gesture Intermediate Stage Completed' event and the
- * 'Gesture Progress' event is that the 'Gesture Intermediate Stage Completed' event
- * does not refer to how much of the gesture is complete. It deals with breaking
- * the gesture into smaller intermediate stages, and informing about them.
- */
- typedef void (XN_CALLBACK_TYPE* GestureIntermediateStageCompleted)(GestureGenerator& generator, const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie);
-
- /**
- * @brief Registers an event handler for the 'Gesture Intermediate Stage Completed' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- XnStatus RegisterToGestureIntermediateStageCompleted(GestureIntermediateStageCompleted handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- GestureIntermediateStageCompletedCookie* pGestureCookie;
- XN_VALIDATE_ALLOC(pGestureCookie, GestureIntermediateStageCompletedCookie);
- pGestureCookie->handler = handler;
- pGestureCookie->pUserCookie = pCookie;
-
- nRetVal = xnRegisterToGestureIntermediateStageCompleted(GetHandle(), GestureIntermediateStageCompletedCallback, pGestureCookie, &pGestureCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pGestureCookie);
- return (nRetVal);
- }
-
- hCallback = pGestureCookie;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Unregisters an event handler for the 'Gesture Intermediate Stage Completed' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromGestureIntermediateStageCompleted(XnCallbackHandle hCallback)
- {
- GestureIntermediateStageCompletedCookie* pGestureCookie = (GestureIntermediateStageCompletedCookie*)hCallback;
- xnUnregisterFromGestureIntermediateStageCompleted(GetHandle(), pGestureCookie->hCallback);
- xnOSFree(pGestureCookie);
- }
-
- /**
- * Callback for indication that the GestureGenerator node recognizes it is ready
- * for the next intermediate stage. The next stage is specific to the gesture.
- *
- * Example of a callback function to handle the event: @code
- void XN_CALLBACK_TYPE GestureReadyForNextIntermediateStage(GestureGenerator &generator, const XnChar *strGesture,
- const XnPoint3D *pPosition, void *pCookie)
- @endcode
- *
- * <b>Remarks</b>
- *
- * The number of intermediate stages that there can be is implementation-dependent.
- *
- * @param [in] generator The node that raised the event.
- * @param [in] strGesture The gesture that is on its way to being recognized.
- * @param [in] pPosition The current position of the hand that is performing the gesture.
- * @param [in] pCookie A user-provided cookie that was given when registering to this event.
- */
- typedef void (XN_CALLBACK_TYPE* GestureReadyForNextIntermediateStage)(GestureGenerator& generator, const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie);
-
- /**
- * @brief Registers an event handler for the 'Gesture Ready For Next Intermediate Stage' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- XnStatus RegisterToGestureReadyForNextIntermediateStage(GestureReadyForNextIntermediateStage handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- GestureReadyForNextIntermediateStageCookie* pGestureCookie;
- XN_VALIDATE_ALLOC(pGestureCookie, GestureReadyForNextIntermediateStageCookie);
- pGestureCookie->handler = handler;
- pGestureCookie->pUserCookie = pCookie;
-
- nRetVal = xnRegisterToGestureReadyForNextIntermediateStage(GetHandle(), GestureReadyForNextIntermediateStageCallback, pGestureCookie, &pGestureCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pGestureCookie);
- return (nRetVal);
- }
-
- hCallback = pGestureCookie;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Unregisters an event handler for the 'Gesture Ready For Next Intermediate Stage' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromGestureReadyForNextIntermediateStageCallbacks(XnCallbackHandle hCallback)
- {
- GestureReadyForNextIntermediateStageCookie* pGestureCookie = (GestureReadyForNextIntermediateStageCookie*)hCallback;
- xnUnregisterFromGestureReadyForNextIntermediateStage(GetHandle(), pGestureCookie->hCallback);
- xnOSFree(pGestureCookie);
- }
-
- /** @cond */
- inline XnStatus XN_API_DEPRECATED("Use GetAllActiveGestures() instead") GetActiveGestures(XnChar*& astrGestures, XnUInt16& nGestures) const
- {
- return xnGetActiveGestures(GetHandle(), &astrGestures, &nGestures);
- }
- inline XnStatus XN_API_DEPRECATED("Use EnumerateAllGestures() instead") EnumerateGestures(XnChar*& astrGestures, XnUInt16& nGestures) const
- {
- return xnEnumerateGestures(GetHandle(), &astrGestures, &nGestures);
- }
- /** @endcond */
-
- private:
- typedef struct GestureCookie
- {
- GestureRecognized recognizedHandler;
- GestureProgress progressHandler;
- void* pUserCookie;
- XnCallbackHandle hCallback;
- } GestureCookie;
-
- static void XN_CALLBACK_TYPE GestureRecognizedCallback(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pIDPosition, const XnPoint3D* pEndPosition, void* pCookie)
- {
- GestureCookie* pGestureCookie = (GestureCookie*)pCookie;
- GestureGenerator gen(hNode);
- if (pGestureCookie->recognizedHandler != NULL)
- {
- pGestureCookie->recognizedHandler(gen, strGesture, pIDPosition, pEndPosition, pGestureCookie->pUserCookie);
- }
- }
-
- static void XN_CALLBACK_TYPE GestureProgressCallback(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, XnFloat fProgress, void* pCookie)
- {
- GestureCookie* pGestureCookie = (GestureCookie*)pCookie;
- GestureGenerator gen(hNode);
- if (pGestureCookie->progressHandler != NULL)
- {
- pGestureCookie->progressHandler(gen, strGesture, pPosition, fProgress, pGestureCookie->pUserCookie);
- }
- }
-
- typedef struct GestureIntermediateStageCompletedCookie
- {
- GestureIntermediateStageCompleted handler;
- void* pUserCookie;
- XnCallbackHandle hCallback;
- } GestureIntermediateStageCompletedCookie;
-
- static void XN_CALLBACK_TYPE GestureIntermediateStageCompletedCallback(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie)
- {
- GestureIntermediateStageCompletedCookie* pGestureCookie = (GestureIntermediateStageCompletedCookie*)pCookie;
- GestureGenerator gen(hNode);
- if (pGestureCookie->handler != NULL)
- {
- pGestureCookie->handler(gen, strGesture, pPosition, pGestureCookie->pUserCookie);
- }
- }
-
- typedef struct GestureReadyForNextIntermediateStageCookie
- {
- GestureReadyForNextIntermediateStage handler;
- void* pUserCookie;
- XnCallbackHandle hCallback;
- } GestureReadyForNextIntermediateStageCookie;
-
- static void XN_CALLBACK_TYPE GestureReadyForNextIntermediateStageCallback(XnNodeHandle hNode, const XnChar* strGesture, const XnPoint3D* pPosition, void* pCookie)
- {
- GestureReadyForNextIntermediateStageCookie* pGestureCookie = (GestureReadyForNextIntermediateStageCookie*)pCookie;
- GestureGenerator gen(hNode);
- if (pGestureCookie->handler != NULL)
- {
- pGestureCookie->handler(gen, strGesture, pPosition, pGestureCookie->pUserCookie);
- }
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> Performs an analysis of the scene, identifying different
- * objects.
- *
- * <b>Data output:</b> A label map and the floor plane.
- *
- * <b>Remarks:</b>
- *
- * The scene analyzer node analyzes a scene, calculating the separation
- * of the foreground from the background, identification of figures in the scene, and
- * detection of the floor plane and its coordinates.
- *
- * The SceneAnalyzer node's main output is a label map, in which each pixel
- * is labeled according to the object it belongs to. So, for example,
- * each human person gets a separate label, and all pixels belonging to him
- * are labeled with that label.
- */
- class SceneAnalyzer : public MapGenerator
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline SceneAnalyzer(XnNodeHandle hNode = NULL) : MapGenerator(hNode) {}
- inline SceneAnalyzer(const NodeWrapper& other) : MapGenerator(other) {}
-
- /**
- * @brief Creates a SceneAnalyzer node from available @ref node_alternative "production node alternatives".
- *
- * <b>Remarks</b>
- *
- * See @ref create_method for a detailed description of this method.
- */
- inline XnStatus Create(Context& context, Query* pQuery = NULL, EnumerationErrors* pErrors = NULL);
-
-
- /**
- * @brief Gets the scene analyzer node's latest @ref glos_frame_object "frame object", saving
- * it in the @ref xn::SceneMetaData object. This @ref glos_frame_object "frame object" is a
- * snapshot of the generated label map data and its associated configuration information at a
- * certain point in time. This saved @ref glos_frame_object "frame object" provides fast
- * and easy access to the scene analyzer node's data and configuration information.
- *
- * @param [out] metaData Structure to be filled with the frame object.
- *
- * <b>Remarks:</b>
- *
- * This method is central in the use of the SceneAnalyzer node. Once the SceneAnalyzer
- * node is generating data, after each @ref conc_updating_data "'Update Data'" call,
- * the application calls this method to get the node's frame object, which contains
- * the data and all its associated properties.
- *
- * The frame scene is a labeled depth map, in which each pixel contains a numeric
- * label indicating whether it represents a user, or it is part of the background.
- */
- inline void GetMetaData(SceneMetaData& metaData) const
- {
- xnGetSceneMetaData(GetHandle(), metaData.GetUnderlying());
- }
-
- /**
- * @copybrief xnGetLabelMap
- * For full details and usage, see @ref xnGetLabelMap
- */
- inline const XnLabel* GetLabelMap() const
- {
- return xnGetLabelMap(GetHandle());
- }
-
- /**
- * @brief Gets a description of the floor, if it was found.
- *
- * @param [out] Plane A description of the floor
- */
- inline XnStatus GetFloor(XnPlane3D& Plane) const
- {
- return xnGetFloor(GetHandle(), &Plane);
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * Allows access to <b>Hand touching FOV edge</b> capability functions.
- *
- * <b>Usage:</b> Do not instantiate directly. Instead, use @ref HandsGenerator::GetHandTouchingFOVEdgeCap()
- * to obtain an instance.
- */
- class HandTouchingFOVEdgeCapability : public Capability
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline HandTouchingFOVEdgeCapability(XnNodeHandle hNode) : Capability(hNode) {}
- HandTouchingFOVEdgeCapability(const NodeWrapper& node) : Capability(node) {}
-
- /**
- * Callback for the hand getting close to the edge of the FOV
- *
- * @param [in] touchingfov the hand touching fov edge capability that raised this event.
- * @param [in] user ID of the hand that disappeared.
- * @param [in] pPosition Position of the hand.
- * @param [in] fTime Timestamp, in seconds.
- * @param [in] eDir Direction of the FOV touched
- * @param [in] pCookie User-provided cookie that was given when registering to this event.
- */
- typedef void (XN_CALLBACK_TYPE* HandTouchingFOVEdge)(HandTouchingFOVEdgeCapability& touchingfov, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, XnDirection eDir, void* pCookie);
-
- /**
- * @brief Registers an event handler for the 'Hand Touching FOV Edge' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToHandTouchingFOVEdge(HandTouchingFOVEdge handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- HandTouchingFOVEdgeCookie* pHandCookie;
- XN_VALIDATE_ALLOC(pHandCookie, HandTouchingFOVEdgeCookie);
- pHandCookie->handler = handler;
- pHandCookie->pUserCookie = pCookie;
-
- nRetVal = xnRegisterToHandTouchingFOVEdge(GetHandle(), HandTouchingFOVEdgeCB, pHandCookie, &pHandCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pHandCookie);
- return (nRetVal);
- }
-
- hCallback = pHandCookie;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Unregisters an event handler for the 'Hand Touching FOV Edge' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromHandTouchingFOVEdge(XnCallbackHandle hCallback)
- {
- HandTouchingFOVEdgeCookie* pHandCookie = (HandTouchingFOVEdgeCookie*)hCallback;
- xnUnregisterFromHandTouchingFOVEdge(GetHandle(), pHandCookie->hCallback);
- xnOSFree(pHandCookie);
- }
- private:
- typedef struct HandTouchingFOVEdgeCookie
- {
- HandTouchingFOVEdge handler;
- void* pUserCookie;
- XnCallbackHandle hCallback;
- } HandTouchingFOVEdgeCookie;
-
- static void XN_CALLBACK_TYPE HandTouchingFOVEdgeCB(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, XnDirection eDir, void* pCookie)
- {
- HandTouchingFOVEdgeCookie* pHandCookie = (HandTouchingFOVEdgeCookie*)pCookie;
- HandTouchingFOVEdgeCapability cap(hNode);
- if (pHandCookie->handler != NULL)
- {
- pHandCookie->handler(cap, user, pPosition, fTime, eDir, pHandCookie->pUserCookie);
- }
- }
-
- };
-
- /**
- * @ingroup cppref_prd_func
- * The HandsGenerator node generates tracking data about a single hand or multiple hands
- * with persistent IDs.
- *
- * The user interface (UI) in natural interaction applications is specifically implemented
- * and performed through hand movements.
- *
- * OpenNI's user interface (UI) ability is specifically through hand movements. Thus
- * it is the HandsGenerator class that provides the main UI ability.
- *
- * Using events, the HandsGenerator object notifies the application of various occurrences: a
- * 'Hand Create' event is sent when an expected hand has been positively identified or when a
- * new hand appears; a 'Hand Update' event is sent when a tracked hand appears again in a new
- * frame; a 'Hand Destroy' event is sent when a tracked hand disappears.
- *
- * <b>NOTE: </b> The HandsGenerator does not provide the mechanism for initially locating
- * the hand. Initial location of the hand can be performed by the Gestures class (see
- * further below). This is a typical scenario but not the only way to locate the hand.
- *
- * The following figure illustrates a typical scenario for using the HandsGenerator
- * class. After hand recognition the HandsGenerator class continues tracking the hand
- * and sending HandUpdate events until the application sends calls HandsGenerator's
- * StopTracking method.
- *
- * <b>1. Creating a HandsGenerator</b>
- *
- * As for many other types of generator nodes, HandsGenerator provides a Create method
- * to create a hands generator node.
- *
- * Assuming you have hands generator module (plug-in) installed on your computer, you
- * can create a hands generator node. Then you can start tracking for an expected hand.
- *
- * @note Creating a HandsGenerator node has nothing to do with the 'Hand Create'
- * event that OpenNI sends to the app on starting to successfully track the hand in
- * the FOV.
- *
- * <b>2. Starting Tracking</b>
- *
- * When starting to track a hand, the application already expects that a person's hand
- * is already present in the field of view and is at a certain coordinate (x,y) position.
- *
- * The source for this information, i.e., the presence of a hand object and its position,
- * can be obtained, for example, from a gesture generator node.
- * The application passes this location to the @ref StartTracking()
- * method of the HandsGenerator object, which starts tracking for
- * the expected hand. When - and if - the StartTracking() method finds the hand at the
- * expected position it sends a 'Hand Create' event to the application.
- *
- * <b>3. Tracking</b>
- *
- * While tracking a hand, 'Hand Update' events are sent to the application notifying that the hand
- * has moved to such and such a position. A 'Hand Update' event is sent each time a new
- * frame processed by the input sensors shows the hand is still present. A 'Hand Update'
- * event is sent even if the hand is still in the same position as it was in the previous
- * frame.
- *
- * If the tracked hand disappears (e.g., when the person puts his hand behind his back)
- * a 'Hand Destroy' event is sent to the application to notify that the hand has disappeared.
- *
- * The 'Hand Create' event is also sent if an additional hand is found internally.
- *
- * The tracking mechanism uses an algorithm that uses the depth to obtain points and
- * track. This algorithm can be somewhat susceptible to jitter of the hand, so HandsGenerator
- * provides a smoothing capability. Call the SetSmoothing() method to apply a smoothing
- * factor of none (0) to maximum (1). The default is 0. Recommended is 0.1 when using
- * the PrimeSense algorithm for hand generation.
- *
- * <b>4. Stopping Tracking</b>
- *
- * When the hand being tracked is no longer identified, the HandsGenerator object sends
- * the 'Hand Destroy' event.
- *
- * The application can also intentionally stop tracking a specific hand, e.g., when
- * the hand is no longer of interest. The application does this by calling the @ref StopTracking()
- * method. When the node stops tracking the hand it sends a 'Hand Destroy' event to the application.
- *
- * The application can also stop the tracking of all hands at once by calling the @ref StopTrackingAll()
- * method. In response, the node stops tracking all hands and for each hand it sends a
- * 'Hand Destroy' event to the application.
- * Even when there are no tracked hands, the HandsGenerator object remains functional
- * for the next tracking request.
- *
- * <h2>Events:</h2>
- *
- * @image html ClassHandsGenerator_EventSeq-sm.png "Event Sequence for HandsGenerator node"
- */
- class HandsGenerator : public Generator
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline HandsGenerator(XnNodeHandle hNode = NULL) : Generator(hNode) {}
- inline HandsGenerator(const NodeWrapper& other) : Generator(other) {}
-
- /**
- * @brief Creates a HandsGenerator node from available @ref node_alternative "production node alternatives".
- *
- * <b>Remarks:</b>
- *
- * See @ref create_method for a detailed description of this method.
- */
- inline XnStatus Create(Context& context, Query* pQuery = NULL, EnumerationErrors* pErrors = NULL);
-
- /**
- * Callback for the creation of a new hand.
- *
- * Signals that the hands generator has recognized and started tracking a new hand in response
- * to the application calling the StartTracking() method. This event returns the
- * ID of the new hand, the time of its recognition, and its position on recognition
- * in the current frame.
- *
- * @param [in] generator Generator that raised this event.
- * @param [in] user ID of the new hand.
- * @param [in] pPosition Position at which the hand was created.
- * @param [in] fTime Timestamp, in seconds.
- * @param [in] pCookie User-provided cookie that was given when registering to
- * this event.
- */
- typedef void (XN_CALLBACK_TYPE* HandCreate)(HandsGenerator& generator, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie);
-
- /**
- * Signals that an already-existing hand has moved to a new position.
- *
- * Signals that a currently tracked hand was recognized at a specific position in
- * the new frame. OpenNI continues to send this event at each further frame that
- * the hand is still present. This event returns the ID of the hand, which is the
- * same ID returned by the HandCreate event, the hand's new position, and the time
- * of the update.
- *
- * @param [in] generator the generator that raised this event.
- * @param [in] user The id of the hand that moved.
- * @param [in] pPosition The new position of the relevant hand.
- * @param [in] fTime Timestamp, in seconds.
- * @param [in] pCookie A user-provided cookie that was given when registering to
- * this event.
- */
- typedef void (XN_CALLBACK_TYPE* HandUpdate)(HandsGenerator& generator, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie);
-
- /**
- * Callback for the disappearance of a hand.
- *
- * Signals that an existing hand has disappeared from the frame for any reason.
- * This event returns the user ID &ndash; still the same user ID as before &ndash;
- * and the time that it disappeared.
- *
- * @param [in] generator the generator that raised this event.
- * @param [in] user The id of the hand that disappeared.
- * @param [in] fTime Timestamp, in seconds.
- * @param [in] pCookie A user-provided cookie that was given when registering to
- * this event.
- */
- typedef void (XN_CALLBACK_TYPE* HandDestroy)(HandsGenerator& generator, XnUserID user, XnFloat fTime, void* pCookie);
-
- /**
- * @brief Registers event handlers for the 'Hand Create', 'Hand Update' and 'Hand Destroy' events.
- * Pass NULL for any event you don't want your application to receive.
- *
- * @param [in] CreateCB [Optional] Callback function to be invoked when the 'Hand Create' event is raised.
- * @param [in] UpdateCB [Optional] Callback function to be invoked when the 'Hand Update' event is raised.
- * @param [in] DestroyCB [Optional] Callback function to be invoked when the 'Hand Destroy' event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterHandCallbacks(HandCreate CreateCB, HandUpdate UpdateCB, HandDestroy DestroyCB, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- HandCookie* pHandCookie;
- XN_VALIDATE_ALLOC(pHandCookie, HandCookie);
- pHandCookie->createHandler = CreateCB;
- pHandCookie->updateHandler = UpdateCB;
- pHandCookie->destroyHandler = DestroyCB;
- pHandCookie->pUserCookie = pCookie;
-
- nRetVal = xnRegisterHandCallbacks(GetHandle(), HandCreateCB, HandUpdateCB, HandDestroyCB, pHandCookie, &pHandCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pHandCookie);
- return (nRetVal);
- }
-
- hCallback = pHandCookie;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Unregisters event handlers for the 'Hand Create', 'Hand Update' and 'Hand Destroy' events.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterHandCallbacks(XnCallbackHandle hCallback)
- {
- HandCookie* pHandCookie = (HandCookie*)hCallback;
- xnUnregisterHandCallbacks(GetHandle(), pHandCookie->hCallback);
- xnOSFree(pHandCookie);
- }
-
- /**
- * @brief Stops tracking an existing hand that you are no longer interested in.
- *
- * @param [in] user Hand to stop tracking. This parameter is the ID of the hand.
- *
- * <b>Remarks</b>
- *
- * Typically, the application will stop tracking an existing hand that it is no
- * longer interested in.
- *
- * Calling this method causes the 'Hand Destroy' event to be raised when OpenNI destroys
- * the hand.
- */
- inline XnStatus StopTracking(XnUserID user)
- {
- return xnStopTracking(GetHandle(), user);
- }
-
- /**
- * @brief Stops tracking all existing hands.
- *
- * <b>Remarks</b>
- *
- * Calling this method causes the 'Hand Destroy' event to be raised when OpenNI destroys
- * the hand.
- */
- inline XnStatus StopTrackingAll()
- {
- return xnStopTrackingAll(GetHandle());
- }
-
- /**
- * @brief Starts tracking at the specific position where the application expects a hand.
- *
- * @param [in] ptPosition The position at which there is a new hand
- *
- * <b>Remarks</b>
- *
- * Use the <code>ptPosition</code> parameter to tell the method what is the expected
- * location (in X-Y-Z coordinates) of the hand.
- *
- * This expected location can be obtained from a 'Gesture Recognized' event, but
- * it is not the only way of getting the hand's expected location.
- *
- * Calling this method causes the HandCreate event to be raised when OpenNI recognizes
- * the hand.
- */
- inline XnStatus StartTracking(const XnPoint3D& ptPosition)
- {
- return xnStartTracking(GetHandle(), &ptPosition);
- }
-
- /**
- * @brief Changes the smoothing factor.
- *
- * @param [in] fSmoothingFactor Smoothing factor, in the range 0..1. 0 Means no
- * smoothing, 1 means infinite smoothing.
- * Inside the range is generator dependent.
- * <br>
- * Recommended: 0.1
- *
- * <b>Remarks</b>
- *
- * The hand is identified from its physical depth. Since the human hand is not absolutely
- * steady, the hand point generated may be too jittery to be used for controlling
- * the user interface, e.g., pressing buttons. This method provides an algorithm
- * to smooth the jitter. You provide the desired smoothing factor as a parameter.
- */
- inline XnStatus SetSmoothing(XnFloat fSmoothingFactor)
- {
- return xnSetTrackingSmoothing(GetHandle(), fSmoothingFactor);
- }
-
- /**
- * Gets an @ref HandTouchingFOVEdgeCapability object for accessing hand touching
- * FOV edge callbacks functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_HAND_TOUCHING_FOV_EDGE
- * is supported
- * by calling @ref IsCapabilitySupported().
- */
- inline const HandTouchingFOVEdgeCapability GetHandTouchingFOVEdgeCap() const
- {
- return HandTouchingFOVEdgeCapability(GetHandle());
- }
-
- /**
- * Gets an @ref HandTouchingFOVEdgeCapability object for accessing hand touching
- * FOV edge callbacks functionality.
- * It is the application responsibility to check first if @ref XN_CAPABILITY_HAND_TOUCHING_FOV_EDGE
- * is supported
- * by calling @ref IsCapabilitySupported().
- */
- inline HandTouchingFOVEdgeCapability GetHandTouchingFOVEdgeCap()
- {
- return HandTouchingFOVEdgeCapability(GetHandle());
- }
-
- private:
- typedef struct HandCookie
- {
- HandCreate createHandler;
- HandUpdate updateHandler;
- HandDestroy destroyHandler;
- void* pUserCookie;
- XnCallbackHandle hCallback;
- } HandCookie;
-
- static void XN_CALLBACK_TYPE HandCreateCB(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie)
- {
- HandCookie* pHandCookie = (HandCookie*)pCookie;
- HandsGenerator gen(hNode);
- if (pHandCookie->createHandler != NULL)
- {
- pHandCookie->createHandler(gen, user, pPosition, fTime, pHandCookie->pUserCookie);
- }
- }
- static void XN_CALLBACK_TYPE HandUpdateCB(XnNodeHandle hNode, XnUserID user, const XnPoint3D* pPosition, XnFloat fTime, void* pCookie)
- {
- HandCookie* pHandCookie = (HandCookie*)pCookie;
- HandsGenerator gen(hNode);
- if (pHandCookie->updateHandler != NULL)
- {
- pHandCookie->updateHandler(gen, user, pPosition, fTime, pHandCookie->pUserCookie);
- }
- }
- static void XN_CALLBACK_TYPE HandDestroyCB(XnNodeHandle hNode, XnUserID user, XnFloat fTime, void* pCookie)
- {
- HandCookie* pHandCookie = (HandCookie*)pCookie;
- HandsGenerator gen(hNode);
- if (pHandCookie->destroyHandler != NULL)
- {
- pHandCookie->destroyHandler(gen, user, fTime, pHandCookie->pUserCookie);
- }
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> Provides the 'Skeleton' functionality for a @ref xn::UserGenerator
- * node. This capability lets the node generate a skeleton representation for each human
- * user generated by the node.
- *
- * @note See @ref meanings_of_user "Meanings of 'User'".
- *
- * <b>Usage:</b> Do not instantiate directly. Instead, use @ref UserGenerator::GetSkeletonCap()
- * to obtain an instance.
- *
- * <b>Data output:</b> Skeleton.
- *
- * The OpenNI definition of <i>joints</i> refers to a predefined set of points on the
- * human body, as defined by the @ref xn::XnSkeletonJoint enum type. Examples of these
- * joints are @ref XN_SKEL_HEAD, @ref XN_SKEL_TORSO, @ref XN_SKEL_LEFT_ELBOW,
- * @ref XN_SKEL_LEFT_WRIST and @ref XN_SKEL_LEFT_HAND. Note that some of these <i>joints</i>
- * are actual joints, in the conventional sense as termed by the English language, for
- * example, @ref XN_SKEL_LEFT_ELBOW and @ref XN_SKEL_LEFT_WRIST; and other joints are in
- * fact <i>limbs</i>, for example, @ref XN_SKEL_HEAD and @ref XN_SKEL_LEFT_HAND.
- * However, OpenNI defines all these as <i>joints</i>, each joint with a single position
- * coordinate. Each detected joint is defined by its <i>position</i>, which is held
- * as a struct of type @ref xn::XnSkeletonJointPosition, comprising a 3D position coordinate
- * and confidence. The 3D position coordinate defines a point somewhere in the center
- * of the 'joint', for example, the position of the torso will be at the center of the
- * torso, i.e., somewhere in the stomach area.
- *
- * To graphically draw a complete skeleton, therefore, each joint must be connected
- * by a line to the adjacent point according to the form of the human body.
- *
- * An application typically uses this skeleton representation to track human motion,
- * or to graphically display all or part of the user as an avatar on screen, and optionally
- * graphically enhance it to make it look more like a full humanoid figure.
- *
- * @section skeleton_calib Calibration
- *
- * Tracking of a human user always starts with a process named 'Calibration'. In this
- * process the algorithm performs some implementation-specific logic to enable it
- * to track that user. there is no standard for what calibration is exactly and
- * each implementation may use whatever it needs to produce and calibrate a skeleton.
- * However, a typical way of calibrating the skeleton would be to measure distances
- * between key joints for a particular user and record the data as the calibration data
- * for that particular user.
- *
- * Some implementations of the user generator node require a human user to pose a specific
- * posture for the calibration process to succeed. The application can check if current implementation
- * requires such a pose by calling @ref NeedPoseForCalibration() method. If the answer is TRUE,
- * the application should call @ref GetCalibrationPose() to find out the name of the pose a human user should
- * take in order to calibrate the algorithm. The application can use the @ref xn::PoseDetectionCapability
- * to find out if a human user is assuming a specific position, and once he does, calibration can start.
- *
- * The application starts the calibration process by calling @ref RequestCalibration(). There
- * are several events raised during the calibration process, but the most important one is
- * 'Calibration Complete'. Once calibration is done, the application may call @ref StartTracking()
- * to make the algorithm start tracking the skeleton of that human user.
- */
- class SkeletonCapability : public Capability
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline SkeletonCapability(XnNodeHandle hNode) : Capability(hNode) {}
- SkeletonCapability(const NodeWrapper& node) : Capability(node) {}
-
- /**
- * @brief Returns whether a specific skeleton joint is supported by the SkeletonCapability object.
- *
- * @param [in] eJoint Joint to check.
- */
- inline XnBool IsJointAvailable(XnSkeletonJoint eJoint) const
- {
- return xnIsJointAvailable(GetHandle(), eJoint);
- }
-
- /**
- * @brief Returns whether a specific skeleton profile is supported by the SkeletonCapability object.
- *
- * @param [in] eProfile Profile to check.
- */
- inline XnBool IsProfileAvailable(XnSkeletonProfile eProfile) const
- {
- return xnIsProfileAvailable(GetHandle(), eProfile);
- }
-
- /**
- * @brief Sets the skeleton profile. The skeleton profile specifies which joints are to
- * be active, and which to be inactive. The @ref UserGenerator node generates output data
- * for the active joints only. This profile applies to all skeletons that the @ref UserGenerator node generates.
- *
- * @param [in] eProfile Specifies the profile to set.
- *
- * <b>Remarks</b>
- *
- * The profile (@ref xn::XnSkeletonProfile) enables the application to choose between
- * generating all joints, just the upper or lower torso, or just the head and hands
- * only.
- *
- * Since this method provides the flexibility to request only the data that the
- * application requires, this can help to significantly improve response time: setting
- * a smaller skeleton profile reduces the processing load on the computer, which
- * can cause a significant increase in avatar responsiveness.
- *
- * Use the @ref SetJointActive() method for selecting the profile down to a finer
- * resolution than possible with this method, e.g., to be able to select a specific
- * hand or foot.
- *
- * OpenNI does not standardize the initial profile set. If no profile is set, each
- * implementation may have its own default profile. For example, PrimeSense implementation's
- * default profile is NONE. This means if no profile is set, no joint will be available.
- *
- * Setting a profile changes all the joint configuration to that profile. This means
- * you can set a profile, then refine specific joints (adding or removing). You
- * can't do it the other way around.
- */
- inline XnStatus SetSkeletonProfile(XnSkeletonProfile eProfile)
- {
- return xnSetSkeletonProfile(GetHandle(), eProfile);
- }
-
- /**
- * @brief Changes the state of a specific skeleton joint to be active or inactive.
- * The @ref xn::UserGenerator node generates output data for the active joints only.
- * This state setting applies to all skeletons that the @ref xn::UserGenerator node generates.
- *
- * @param [in] eJoint Specifies the joint.
- * @param [in] bState New activation state (true/false).
- *
- * <b>Remarks</b>
- *
- * This method lets the application set the skeleton profile down to a finer resolution
- * than is possible with the @ref SetSkeletonProfile() method.
- *
- * The joint selector parameter (@ref xn::XnSkeletonJoint) lets the application
- * choose specific parts of a skeleton, e.g., a specific hand or foot.
- *
- * Since this method provides the flexibility to request only the data that the
- * application requires, this can help to significantly improve response time. Setting
- * a smaller skeleton profile can reduce the processing load on the computer, which
- * can cause a significant increase in avatar responsiveness (implementation-dependent).
- * Some implementations may produce all the data they can, and only filter it at
- * the end according to the configuration.
- */
- inline XnStatus SetJointActive(XnSkeletonJoint eJoint, XnBool bState)
- {
- return xnSetJointActive(GetHandle(), eJoint, bState);
- }
-
- /**
- * @brief Checks if a specific joint is tracked or not.
- *
- * @param [in] eJoint Specifies the joint.
- */
- inline XnBool IsJointActive(XnSkeletonJoint eJoint) const
- {
- return xnIsJointActive(GetHandle(), eJoint);
- }
-
- /**
- * @brief Registers an event handler for the 'Joint Configuration Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToJointConfigurationChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToJointConfigurationChange, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters an event handler for the 'Joint Configuration Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromJointConfigurationChange(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromJointConfigurationChange, GetHandle(), hCallback);
- }
-
- /**
- * @copybrief xnEnumerateActiveJoints
- * For full details and usage, see @ref xnEnumerateActiveJoints
- */
- inline XnStatus EnumerateActiveJoints(XnSkeletonJoint* pJoints, XnUInt16& nJoints) const
- {
- return xnEnumerateActiveJoints(GetHandle(), pJoints, &nJoints);
- }
-
- /**
- * @brief Gets all available information about a specific joint in the skeleton.
- *
- * @param [in] user ID of the user.
- * @param [in] eJoint Joint specifier.
- * @param [out] Joint Transformation structure for the joint. Includes position
- * and orientation.
- */
- inline XnStatus GetSkeletonJoint(XnUserID user, XnSkeletonJoint eJoint, XnSkeletonJointTransformation& Joint) const
- {
- return xnGetSkeletonJoint(GetHandle(), user, eJoint, &Joint);
- }
-
- /**
- * @brief Gets the position of one of the skeleton joints in the most recently generated user data.
- *
- * @param [in] user ID of the user.
- * @param [in] eJoint Joint specifier.
- * @param [out] Joint Latest position of the joint.
- *
- * <b>Remarks</b>
- *
- * The joint position is returned as a @ref XnSkeletonJointPosition structure, comprising
- * a real-world coordinate together with a confidence rating.
- *
- * Confidence can be in the range of 0..1.
- *
- * 0 means 'I'm guessing here'.<br>
- * 1 means 'This is where it is'. <br>
- *
- * The API is ready for when an implementation decides it is 'fairly certain'. In
- * a typical implementation, 0.5 is used when there is an educated guess, or have
- * run some heuristics to determine the position.
- */
- inline XnStatus GetSkeletonJointPosition(XnUserID user, XnSkeletonJoint eJoint, XnSkeletonJointPosition& Joint) const
- {
- return xnGetSkeletonJointPosition(GetHandle(), user, eJoint, &Joint);
- }
-
- /**
- * @brief Gets the orientation of a specific skeleton joint.
- *
- * @param [in] user ID of the user.
- * @param [in] eJoint Joint specifier.
- * @param [out] Joint Joint's orientation.
- */
- inline XnStatus GetSkeletonJointOrientation(XnUserID user, XnSkeletonJoint eJoint, XnSkeletonJointOrientation& Joint) const
- {
- return xnGetSkeletonJointOrientation(GetHandle(), user, eJoint, &Joint);
- }
-
- /**
- * @brief Returns whether a user is currently being tracked.
- *
- * @param [in] user ID of the user.
- *
- * <b>Remarks</b>
- *
- * This is a utility method. It is an alternative approach to saving the states
- * from the events that notify stages in calibration and tracking.
- */
- inline XnBool IsTracking(XnUserID user) const
- {
- return xnIsSkeletonTracking(GetHandle(), user);
- }
-
- /**
- * @brief Returns whether a user has been calibrated. see @ref skeleton_calib.
- *
- * @param [in] user ID of the user.
- *
- * <b>Remarks</b>
- *
- * This is a utility method. It is an alternative approach to saving the states
- * from the events that notify stages in calibration.
- */
- inline XnBool IsCalibrated(XnUserID user) const
- {
- return xnIsSkeletonCalibrated(GetHandle(), user);
- }
-
- /**
- * @brief Returns whether a user is being calibrated right now. see @ref skeleton_calib.
- *
- * @param [in] user ID of the user.
- *
- * <b>Remarks</b>
- *
- * This is a utility method. It is an alternative approach to saving the states
- * from the events that notify stages in calibration.
- */
- inline XnBool IsCalibrating(XnUserID user) const
- {
- return xnIsSkeletonCalibrating(GetHandle(), user);
- }
-
- /**
- * @brief Starts the calibration process to calibrate a user.
- *
- * @param [in] user ID of the user.
- * @param [in] bForce Disregard previous calibration to force a further calibration.<br>
- * Values:<br>
- * True: Disregards any previous calibration and forces a new calibration.<br>
- * False: Starts the calibration process only if no calibration data is available
- * for the skeleton.<br>
- * This means that if the user was previously calibrated (which actually means measuring
- * the length of its limbs, and estimating its torso, to be used in its skeletal
- * representation), and another calibration was requested, to either make do with
- * what we have (false), or forget the previous measurements and perform calibration
- * again.
- *
- * <b>Remarks</b>
- *
- * This method is typically called from inside an event handler for the 'Pose Detected'
- * event, signaling that a pose was detected in the FOV. Once a valid pose has been
- * detected the application will want to start calibrating the user.
- *
- * It can also be called outside of that, in implementations that don't require
- * a pose.
- */
- inline XnStatus RequestCalibration(XnUserID user, XnBool bForce)
- {
- return xnRequestSkeletonCalibration(GetHandle(), user, bForce);
- }
-
- /**
- * @brief Aborts an existing calibration process currently being executed for a specified user.
- *
- * @param [in] user ID of the user.
- *
- * <b>Remarks</b>
- *
- * Raises the 'Calibration Complete' event.
- */
- inline XnStatus AbortCalibration(XnUserID user)
- {
- return xnAbortSkeletonCalibration(GetHandle(), user);
- }
-
- /**
- * @brief Saves the skeleton's current calibration data to a file.
- *
- * @param [in] user ID of the user.
- * @param [in] strFileName Name of the file for saving the calibration data.
- *
- * <b>Remarks</b>
- *
- * The application is the one that should match the user, however it sees fit. For
- * example, if a calibration was saved as C:\\john_smith.bin, and then later another
- * application recognizes John Smith (let's say, through face recognition), the
- * calibration data can be loaded, instead of performing the entire calibration
- * process.
- *
- * This is a very useful tool for developers. They can save their own calibration,
- * and test their application without calibrating each time (going into pose, spend
- * time on calibration).
- */
- inline XnStatus SaveCalibrationDataToFile(XnUserID user, const XnChar* strFileName)
- {
- return xnSaveSkeletonCalibrationDataToFile(GetHandle(), user, strFileName);
- }
-
- /**
- * @brief Loads skeleton calibration data from a file to a skeleton.
- *
- * @param [in] user ID of the user.
- * @param [in] strFileName File to load the calibration data from.
- */
- inline XnStatus LoadCalibrationDataFromFile(XnUserID user, const XnChar* strFileName)
- {
- return xnLoadSkeletonCalibrationDataFromFile(GetHandle(), user, strFileName);
- }
-
- /**
- * @brief Saves the calibration data of a specified user. The calibration data includes the lengths of the human user's limbs.
- *
- * @param [in] user ID of the user.
- * @param [in] nSlot Slot to use for saving the calibration data
- *
- * <b>Remarks</b>
- *
- * The slots mechanism allows saving the calibration to memory instead of to files.
- * When used, a calibration is saved to a slot, and may be reloaded from it.
- */
- inline XnStatus SaveCalibrationData(XnUserID user, XnUInt32 nSlot)
- {
- return xnSaveSkeletonCalibrationData(GetHandle(), user, nSlot);
- }
-
- /**
- * @brief Loads calibration data of a specified user. The calibration data includes the lengths of the human user's limbs.
- *
- * @param [in] user ID of the user.
- * @param [in] nSlot Slot to use for saving the calibration data
- */
- inline XnStatus LoadCalibrationData(XnUserID user, XnUInt32 nSlot)
- {
- return xnLoadSkeletonCalibrationData(GetHandle(), user, nSlot);
- }
-
- /**
- * @brief Clears a specified slot of any saved calibration data.
- *
- * @param [in] nSlot Slot specifier.
- */
- inline XnStatus ClearCalibrationData(XnUInt32 nSlot)
- {
- return xnClearSkeletonCalibrationData(GetHandle(), nSlot);
- }
-
- /**
- * @brief Returns whether a specific slot already holds calibration data.
- *
- * @param [in] nSlot Slot specifier.
- */
- inline XnBool IsCalibrationData(XnUInt32 nSlot) const
- {
- return xnIsSkeletonCalibrationData(GetHandle(), nSlot);
- }
-
- /**
- * @brief Starts tracking a skeleton.
- *
- * @param [in] user ID of the user.
- *
- * <b>Remarks</b>
- *
- * This method is used for tracking the motion of the skeleton, representing a human
- * user body, within a real-life (3D) scene for analysis, interpretation, and use
- * by the application.
- *
- * While the skeleton is being tracked, the application can call the @ref GetSkeletonJointPosition()
- * method to get data about one of the joint positions.
- */
- inline XnStatus StartTracking(XnUserID user)
- {
- return xnStartSkeletonTracking(GetHandle(), user);
- }
-
- /**
- * @brief Stops tracking a skeleton.
- * @param [in] user ID of the user.
- */
- inline XnStatus StopTracking(XnUserID user)
- {
- return xnStopSkeletonTracking(GetHandle(), user);
- }
-
- /**
- * @brief Discards a skeleton's calibration.
- * @param [in] user ID of the user.
- *
- * <b>Remarks</b>
- *
- * Utility method for resetting a user to its initial state. For use in development.
- */
- inline XnStatus Reset(XnUserID user)
- {
- return xnResetSkeleton(GetHandle(), user);
- }
-
- /**
- * @brief Returns whether a specific pose is required for
- * calibration. This setting is applicable to all users.
- *
- * <b>Remarks</b>
- *
- * This is a setting made by the developer of the SkeletonCapability plug-in.
- */
- inline XnBool NeedPoseForCalibration() const
- {
- return xnNeedPoseForSkeletonCalibration(GetHandle());
- }
-
- /**
- * @brief Gets the name of the pose that is required for calibration. The
- * pose and its name reside in the plug-in module that provides the
- * SkeletonCapability. The pose's name and details are defined by the
- * developer of the module.
- *
- * @param [out] strPose Name of the pose required for calibration
- * <b>Remarks</b>
- *
- * This method is to be used only if the @ref NeedPoseForCalibration() method returns
- * TRUE, and only then will this method returns a name.
- */
- inline XnStatus GetCalibrationPose(XnChar* strPose) const
- {
- return xnGetSkeletonCalibrationPose(GetHandle(), strPose);
- }
-
- /**
- * @brief Sets the smoothing factor for all users generated by this @ref xn::UserGenerator node.
- * @param [in] fSmoothingFactor Smoothing factor<br>
- * Range: 0 to 1<br>
- *
- * <b>Remarks</b>
- *
- * The human body is identified from its physical depth. Since the human body is
- * not absolutely steady, the human body being calibrated may be too jittery to
- * easily obtain its position. This method provides an algorithm to smooth the jitter.
- * You provide the desired smoothing factor as a parameter.
- */
- inline XnStatus SetSmoothing(XnFloat fSmoothingFactor)
- {
- return xnSetSkeletonSmoothing(GetHandle(), fSmoothingFactor);
- }
-
- /**
- * Signals that a specific user's SkeletonCapability object is now starting the
- * calibration process.
- *
- * Example of a callback function to handle the 'Calibration Start' event:
- *
- @code
- OnCalibrationStart(xn::SkeletonCapability& skeleton, XnUserID user, void* pCookie)
- @endcode
- *
- * @param [in] skeleton SkeletonCapability object that raised the event.
- * @param [in] user The id of the user that's being calibrated.
- * @param [in] pCookie A user-provided cookie that was given when registering to
- * this event.
- *
- * <b>Remarks</b>
- *
- * The application itself initiates calibration by calling the @ref RequestCalibration() method.
- * When a SkeletonCapability object actually starts to perform the calibration,
- * it raises this event.
- */
- typedef void (XN_CALLBACK_TYPE* CalibrationStart)(SkeletonCapability& skeleton, XnUserID user, void* pCookie);
-
- /**
- * Signals that a specific user's SkeletonCapability object has now completed the
- * calibration process.
- *
- * Example of a callback function to handle the 'Calibration Complete' event:
- @code
- OnCalibrationEnd(xn::SkeletonCapability &skeleton, XnUserID user,
- XnCalibrationStatus calibrationError, void *pCookie)
- @endcode
- *
- * <b>Parameters: </b>
- *
- * hNode [in] Node that raised the event.
- * user [in] ID of the user for which calibration was attempted.
- * bSuccess [in] Indication of whether or not the calibration attempt succeeded.
- * pCookie [in] User-provided cookie that was given when registering to this event.
- */
- typedef void (XN_CALLBACK_TYPE* CalibrationEnd)(SkeletonCapability& skeleton, XnUserID user, XnBool bSuccess, void* pCookie);
-
- /**
- * @brief Registers an event handler for the 'Calibration Start' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * See @ref skeleton_calib for information about calibration.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToCalibrationStart(CalibrationStart handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
- CalibrationStartCookie* pCalibrationCookie;
- XN_VALIDATE_ALLOC(pCalibrationCookie, CalibrationStartCookie);
- pCalibrationCookie->handler = handler;
- pCalibrationCookie->pUserCookie = pCookie;
- nRetVal = xnRegisterToCalibrationStart(GetHandle(), CalibrationStartCallback, pCalibrationCookie, &pCalibrationCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pCalibrationCookie);
- return nRetVal;
- }
- hCallback = pCalibrationCookie;
- return XN_STATUS_OK;
- }
-
- /**
- * @brief Unregisters a handler from the 'Calibration Start' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * <b>Remarks</b>
- *
- * Due to historical reasons, this function has an XnStatus return value. In practice,
- * it will always succeed. The user can safely ignore the return value.
- */
- inline XnStatus UnregisterFromCalibrationStart(XnCallbackHandle hCallback)
- {
- CalibrationStartCookie* pCalibrationCookie = (CalibrationStartCookie*)hCallback;
- xnUnregisterFromCalibrationStart(GetHandle(), pCalibrationCookie->hCallback);
- xnOSFree(pCalibrationCookie);
- return XN_STATUS_OK;
- }
-
- /**
- * Signals that a specific user's skeleton is calibrating, and its current status.
- *
- * Example of a callback function to handle the 'Calibration Progress' event:
- @code
- OnCalibrationProgress(xn::SkeletonCapability &skeleton, XnUserID user,
- XnCalibrationStatus calibrationError, void *pCookie)
- @endcode
- *
- * @param [in] skeleton SkeletonCapability object that raised the event.
- * @param [in] user ID of the user holding SkeletonCapability object.
- * @param [in] calibrationError Status of the calibration. Values are defined by
- * XnCalibrationStatus.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- *
- * <b>Remarks</b>
- *
- * After the 'Calibration Start' event, the 'Calibration in Progress' event is raised
- * every frame until 'Calibration Complete' is raised. It informs the application
- * as to the current state of the calibration process.
- */
- typedef void (XN_CALLBACK_TYPE* CalibrationInProgress)(SkeletonCapability& skeleton, XnUserID user, XnCalibrationStatus calibrationError, void* pCookie);
-
- /**
- * @brief Registers an event handler for the 'Calibration In Progress' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToCalibrationInProgress(CalibrationInProgress handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- CalibrationInProgressCookie* pSkeletonCookie;
- XN_VALIDATE_ALLOC(pSkeletonCookie, CalibrationInProgressCookie);
- pSkeletonCookie->handler = handler;
- pSkeletonCookie->pUserCookie = pCookie;
-
- nRetVal = xnRegisterToCalibrationInProgress(GetHandle(), CalibrationInProgressCallback, pSkeletonCookie, &pSkeletonCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pSkeletonCookie);
- return (nRetVal);
- }
-
- hCallback = pSkeletonCookie;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Unregisters an event handler for the 'Calibration In Progress' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromCalibrationInProgress(XnCallbackHandle hCallback)
- {
- CalibrationInProgressCookie* pSkeletonCookie = (CalibrationInProgressCookie*)hCallback;
- xnUnregisterFromCalibrationInProgress(GetHandle(), pSkeletonCookie->hCallback);
- xnOSFree(pSkeletonCookie);
- }
-
- /**
- * @brief Signals that a specific user's skeleton has now completed the calibration
- * process, and provides a result status.
- *
- * Following is an example of a callback header to handle the 'Calibration Complete'
- * event:
- @code
- OnCalibrationComplete(xn::SkeletonCapability &skeleton, XnUserID user,
- XnCalibrationStatus calibrationError, void *pCookie)
- @endcode
- *
- * @param [in] skeleton SkeletonCapability object that raised the event.
- * @param [in] user ID of the user holding SkeletonCapability object.
- * @param [in] calibrationError Status of the calibration. Values are defined by
- * XnCalibrationStatus.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- */
- typedef void (XN_CALLBACK_TYPE* CalibrationComplete)(SkeletonCapability& skeleton, XnUserID user, XnCalibrationStatus calibrationError, void* pCookie);
-
- /**
- * @brief Registers an event handler for the 'Calibration Complete' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToCalibrationComplete(CalibrationComplete handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- CalibrationCompleteCookie* pSkeletonCookie;
- XN_VALIDATE_ALLOC(pSkeletonCookie, CalibrationCompleteCookie);
- pSkeletonCookie->handler = handler;
- pSkeletonCookie->pUserCookie = pCookie;
-
- nRetVal = xnRegisterToCalibrationComplete(GetHandle(), CalibrationCompleteCallback, pSkeletonCookie, &pSkeletonCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pSkeletonCookie);
- return (nRetVal);
- }
-
- hCallback = pSkeletonCookie;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Unregisters an event handler for the 'Calibration Complete' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromCalibrationComplete(XnCallbackHandle hCallback)
- {
- CalibrationCompleteCookie* pSkeletonCookie = (CalibrationCompleteCookie*)hCallback;
- xnUnregisterFromCalibrationComplete(GetHandle(), pSkeletonCookie->hCallback);
- xnOSFree(pSkeletonCookie);
- }
-
- /** @cond */
- XN_API_DEPRECATED("Use the overload with one argument - the bState parameter is useless")
- inline XnBool IsJointActive(XnSkeletonJoint eJoint, XnBool /*bState*/) const
- {
- return xnIsJointActive(GetHandle(), eJoint);
- }
-
- inline XnStatus XN_API_DEPRECATED("Please use RegisterToCalibrationStart/Complete") RegisterCalibrationCallbacks(CalibrationStart CalibrationStartCB, CalibrationEnd CalibrationEndCB, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- SkeletonCookie* pSkeletonCookie;
- XN_VALIDATE_ALLOC(pSkeletonCookie, SkeletonCookie);
- pSkeletonCookie->startHandler = CalibrationStartCB;
- pSkeletonCookie->endHandler = CalibrationEndCB;
- pSkeletonCookie->pUserCookie = pCookie;
-
-#pragma warning (push)
-#pragma warning (disable: XN_DEPRECATED_WARNING_IDS)
- nRetVal = xnRegisterCalibrationCallbacks(GetHandle(), CalibrationStartBundleCallback, CalibrationEndBundleCallback, pSkeletonCookie, &pSkeletonCookie->hCallback);
-#pragma warning (pop)
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pSkeletonCookie);
- return (nRetVal);
- }
-
- hCallback = pSkeletonCookie;
-
- return (XN_STATUS_OK);
- }
-
- inline void XN_API_DEPRECATED("Please use UnregisterFromCalibrationStart/Complete") UnregisterCalibrationCallbacks(XnCallbackHandle hCallback)
- {
- SkeletonCookie* pSkeletonCookie = (SkeletonCookie*)hCallback;
-#pragma warning (push)
-#pragma warning (disable: XN_DEPRECATED_WARNING_IDS)
- xnUnregisterCalibrationCallbacks(GetHandle(), pSkeletonCookie->hCallback);
-#pragma warning (pop)
- xnOSFree(pSkeletonCookie);
- }
- /** @endcond */
-
-private:
- typedef struct SkeletonCookie
- {
- CalibrationStart startHandler;
- CalibrationEnd endHandler;
- void* pUserCookie;
- XnCallbackHandle hCallback;
- } SkeletonCookie;
-
- static void XN_CALLBACK_TYPE CalibrationStartBundleCallback(XnNodeHandle hNode, XnUserID user, void* pCookie)
- {
- SkeletonCookie* pSkeletonCookie = (SkeletonCookie*)pCookie;
- SkeletonCapability cap(hNode);
- if (pSkeletonCookie->startHandler != NULL)
- {
- pSkeletonCookie->startHandler(cap, user, pSkeletonCookie->pUserCookie);
- }
- }
-
- static void XN_CALLBACK_TYPE CalibrationEndBundleCallback(XnNodeHandle hNode, XnUserID user, XnBool bSuccess, void* pCookie)
- {
- SkeletonCookie* pSkeletonCookie = (SkeletonCookie*)pCookie;
- SkeletonCapability cap(hNode);
- if (pSkeletonCookie->endHandler != NULL)
- {
- pSkeletonCookie->endHandler(cap, user, bSuccess, pSkeletonCookie->pUserCookie);
- }
- }
-
- typedef struct CalibrationStartCookie
- {
- CalibrationStart handler;
- void* pUserCookie;
- XnCallbackHandle hCallback;
- } CalibrationStartCookie;
-
- static void XN_CALLBACK_TYPE CalibrationStartCallback(XnNodeHandle hNode, XnUserID user, void* pCookie)
- {
- CalibrationStartCookie* pCalibrationCookie = (CalibrationStartCookie*)pCookie;
- SkeletonCapability cap(hNode);
- if (pCalibrationCookie->handler != NULL)
- {
- pCalibrationCookie->handler(cap, user, pCalibrationCookie->pUserCookie);
- }
- }
-
- typedef struct CalibrationInProgressCookie
- {
- CalibrationInProgress handler;
- void* pUserCookie;
- XnCallbackHandle hCallback;
- } CalibrationInProgressCookie;
-
- static void XN_CALLBACK_TYPE CalibrationInProgressCallback(XnNodeHandle hNode, XnUserID user, XnCalibrationStatus calibrationError, void* pCookie)
- {
- CalibrationInProgressCookie* pSkeletonCookie = (CalibrationInProgressCookie*)pCookie;
- SkeletonCapability cap(hNode);
- if (pSkeletonCookie->handler != NULL)
- {
- pSkeletonCookie->handler(cap, user, calibrationError, pSkeletonCookie->pUserCookie);
- }
- }
-
- typedef struct CalibrationCompleteCookie
- {
- CalibrationComplete handler;
- void* pUserCookie;
- XnCallbackHandle hCallback;
- } CalibrationCompleteCookie;
-
- static void XN_CALLBACK_TYPE CalibrationCompleteCallback(XnNodeHandle hNode, XnUserID user, XnCalibrationStatus calibrationError, void* pCookie)
- {
- CalibrationCompleteCookie* pSkeletonCookie = (CalibrationCompleteCookie*)pCookie;
- SkeletonCapability cap(hNode);
- if (pSkeletonCookie->handler != NULL)
- {
- pSkeletonCookie->handler(cap, user, calibrationError, pSkeletonCookie->pUserCookie);
- }
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- *
- * <b>Purpose:</b> Provides a 'Pose Detection' functionality for a @ref xn::UserGenerator
- * node. This capability lets the node recognize when the user is posed in a specific
- * position.
- *
- * <b>Usage:</b> Do not instantiate directly. Instead, use @ref UserGenerator::GetPoseDetectionCap()
- * to obtain an instance.
- *
- * <b>Data output:</b> Raises events.
- *
- * <b>Remarks:</b>
- *
- * A pose is a specific full body posture involving all the limbs. The PoseDetectionCapability
- * object scans the FOV to detect users performing poses. The PoseDetectionCapability
- * then generates the pose data.
- *
- * When and if the @ref PoseDetectionCapability object detects a pose it raises the
- * 'Pose Detected' event.
- */
- class PoseDetectionCapability : public Capability
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline PoseDetectionCapability(XnNodeHandle hNode) : Capability(hNode) {}
- PoseDetectionCapability(const NodeWrapper& node) : Capability(node) {}
-
- /**
- * <b>'Pose Detection' event</b>
- *
- * This event is raised to signal that a specific user has entered a pose.
- *
- * @param [in] pose Reference to the specific @ref xn::UserGenerator node
- * that raised the event.
- * @param [in] strPose Name of the specific pose defined for this event handler.
- * (The PoseDetectionCapability can define more than a single pose that can be detected.)
- * @param [in] user ID of the user that entered the pose.
- * @param [in] pCookie Returns any information ("cookie") that the application
- * placed in this parameter at the time of registering the event..
- */
- typedef void (XN_CALLBACK_TYPE* PoseDetection)(PoseDetectionCapability& pose, const XnChar* strPose, XnUserID user, void* pCookie);
-
- /**
- * @brief Get the number of poses supported by this capability.
- *
- * <b>Remarks</b>
- *
- * The number of supported poses is defined by the developer of the capability and
- * is common to all @ref xn::UserGenerator nodes using this capability on this OpenNI
- * deployment.
- */
- inline XnUInt32 GetNumberOfPoses() const
- {
- return xnGetNumberOfPoses(GetHandle());
- }
-
- /**
- * @brief Gets the names of all poses supported by this capability.
-
- * @param [out] pstrPoses Pre-allocated memory for the names of the supported poses.
- * @param [in] nNameLength Memory size for each pose name.
- * @param [in,out] nPoses In input - size of the preallocated memory, in output
- * - the number of pose names.
- *
- * <b>Remarks</b>
- *
- * The names of the poses are preset in advance by the developer of this capability.
- */
- inline XnStatus GetAllAvailablePoses(XnChar** pstrPoses, XnUInt32 nNameLength, XnUInt32& nPoses) const
- {
- return xnGetAllAvailablePoses(GetHandle(), pstrPoses, nNameLength, &nPoses);
- }
-
- inline XnBool IsPoseSupported(const XnChar* strPose)
- {
- return xnIsPoseSupported(GetHandle(), strPose);
- }
-
- inline XnStatus GetPoseStatus(XnUserID userID, const XnChar* poseName, XnUInt64& poseTime, XnPoseDetectionStatus& eStatus, XnPoseDetectionState& eState)
- {
- return xnGetPoseStatus(GetHandle(), userID, poseName, &poseTime, &eStatus, &eState);
- }
-
- /**
- * @brief Starts attempting to detect a pose for a specific user.
- *
- * @param [in] strPose Name of the requested pose. Call the GetAvailablePoses()
- * method to get the names of poses supported by the PoseDetectionCapability.
- * @param [in] user ID of a user to detect a pose for.
- *
- * <b>Remarks</b>
- *
- * This method will typically be used after a new user has been recognized in the
- * FOV. This is typically the next stage in the process of calibrating the new user -
- * @see skeleton_calib.
- * When and if the @ref PoseDetectionCapability object detects a pose it raises
- * the 'Pose Detected' event.
- */
- inline XnStatus StartPoseDetection(const XnChar* strPose, XnUserID user)
- {
- return xnStartPoseDetection(GetHandle(), strPose, user);
- }
-
- /**
- * @brief Stops attempting to detect a pose (for a specific user).
- *
- * @param [in] user ID of a user.
- *
- * <b>Remarks</b>
- *
- * The application will typically call this method when it has already received
- * a 'Pose Detected' event. Once a pose has been detected it is no longer necessary
- * to try to detect poses.
- */
- inline XnStatus StopPoseDetection(XnUserID user)
- {
- return xnStopPoseDetection(GetHandle(), user);
- }
-
- /** @copybrief xnStopSinglePoseDetection
- * For full details and usage, see @ref xnStopSinglePoseDetection
- */
- inline XnStatus StopSinglePoseDetection(XnUserID user, const XnChar* strPose)
- {
- return xnStopSinglePoseDetection(GetHandle(), user, strPose);
- }
-
- /**
- * @brief Registers an event handler for the 'Pose Detected' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToPoseDetected(PoseDetection handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
- PoseDetectionCookie* pPoseCookie;
- XN_VALIDATE_ALLOC(pPoseCookie, PoseDetectionCookie);
- pPoseCookie->handler = handler;
- pPoseCookie->pPoseCookie = pCookie;
-
- nRetVal = xnRegisterToPoseDetected(GetHandle(), PoseDetectionCallback, pPoseCookie, &pPoseCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pPoseCookie);
- return nRetVal;
- }
- hCallback = pPoseCookie;
- return XN_STATUS_OK;
- }
-
- /**
- * @brief Registers an event handler for the 'Out Of Pose' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToOutOfPose(PoseDetection handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
- PoseDetectionCookie* pPoseCookie;
- XN_VALIDATE_ALLOC(pPoseCookie, PoseDetectionCookie);
- pPoseCookie->handler = handler;
- pPoseCookie->pPoseCookie = pCookie;
-
- nRetVal = xnRegisterToOutOfPose(GetHandle(), PoseDetectionCallback, pPoseCookie, &pPoseCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pPoseCookie);
- return nRetVal;
- }
- hCallback = pPoseCookie;
- return XN_STATUS_OK;
- }
- /**
- * @brief Unregisters an event handler for the 'Pose Detected' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromPoseDetected(XnCallbackHandle hCallback)
- {
- PoseDetectionCookie* pPoseCookie = (PoseDetectionCookie*)hCallback;
- xnUnregisterFromPoseDetected(GetHandle(), pPoseCookie->hCallback);
- xnOSFree(pPoseCookie);
- }
- /**
- * @brief Unregisters an event handler for the 'Out Of Pose' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromOutOfPose(XnCallbackHandle hCallback)
- {
- PoseDetectionCookie* pPoseCookie = (PoseDetectionCookie*)hCallback;
- xnUnregisterFromOutOfPose(GetHandle(), pPoseCookie->hCallback);
- xnOSFree(pPoseCookie);
- }
-
- /**
- * <b>'Pose In Progress' event</b>:
- *
- * Raised at each frame time from the time StartPoseDetection was called until the
- * pose is detected. This event returns the current status of pose detection of
- * a user.
- *
- * @param [in] pose Reference to the specific @ref UserGenerator node that raised
- * the event.
- * @param [in] strPose Name of the specific pose defined for this event handler.
- * (The PoseDetectionCapability can define more than a single pose that can be detected.
- * @param [in] user ID of the user that entered the pose.
- * @param [in] poseError Current status of the pose detection.
- * Defined statuses:
- * XN_POSE_DETECTION_STATUS_OK
- * XN_POSE_DETECTION_STATUS_NO_USER
- * XN_POSE_DETECTION_STATUS_TOP_FOV
- * XN_POSE_DETECTION_STATUS_SIDE_FOV
- * XN_POSE_DETECTION_STATUS_ERROR
- * @param [in] pCookie Returns any information ("cookie") that the application
- * placed in this parameter at the time of registering the event.
- */
- typedef void (XN_CALLBACK_TYPE* PoseInProgress)(PoseDetectionCapability& pose, const XnChar* strPose, XnUserID user, XnPoseDetectionStatus poseError, void* pCookie);
-
- /**
- * @brief Registers an event handler for the 'Pose In Progress' event.
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- *
- * <b>Remarks</b>
- *
- * This event is raised at each frame time from the time StartPoseDetection() method
- * was called until the pose is actually detected.
- *
- * See the @ref PoseDetection callback type declaration for how to write the callback
- * (event handler).
- */
- inline XnStatus RegisterToPoseInProgress(PoseInProgress handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- PoseInProgressCookie* pPoseCookie;
- XN_VALIDATE_ALLOC(pPoseCookie, PoseInProgressCookie);
- pPoseCookie->handler = handler;
- pPoseCookie->pPoseCookie = pCookie;
-
- nRetVal = xnRegisterToPoseDetectionInProgress(GetHandle(), PoseDetectionInProgressCallback, pPoseCookie, &pPoseCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pPoseCookie);
- return (nRetVal);
- }
-
- hCallback = pPoseCookie;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Unregisters an event handler for the 'Pose In Progress' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromPoseInProgress(XnCallbackHandle hCallback)
- {
- PoseInProgressCookie* pPoseCookie = (PoseInProgressCookie*)hCallback;
- xnUnregisterFromPoseDetectionInProgress(GetHandle(), pPoseCookie->hCallback);
- xnOSFree(pPoseCookie);
- }
-
- /** @cond */
- inline XnStatus XN_API_DEPRECATED("Use GetAllAvailablePoses() instead") GetAvailablePoses(XnChar** pstrPoses, XnUInt32& nPoses) const
- {
- return xnGetAvailablePoses(GetHandle(), pstrPoses, &nPoses);
- }
-
- inline XnStatus XN_API_DEPRECATED("Please use RegisterToPoseDetected/RegisterToOutOfPose instead") RegisterToPoseCallbacks(PoseDetection PoseStartCB, PoseDetection PoseEndCB, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- PoseCookie* pPoseCookie;
- XN_VALIDATE_ALLOC(pPoseCookie, PoseCookie);
- pPoseCookie->startHandler = PoseStartCB;
- pPoseCookie->endHandler = PoseEndCB;
- pPoseCookie->pPoseCookie = pCookie;
-
-#pragma warning (push)
-#pragma warning (disable: XN_DEPRECATED_WARNING_IDS)
- nRetVal = xnRegisterToPoseCallbacks(GetHandle(), PoseDetectionStartBundleCallback, PoseDetectionStartEndBundleCallback, pPoseCookie, &pPoseCookie->hCallback);
-#pragma warning (pop)
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pPoseCookie);
- return (nRetVal);
- }
-
- hCallback = pPoseCookie;
-
- return (XN_STATUS_OK);
- }
-
- inline void XN_API_DEPRECATED("Please use UnregisterFromPoseDetected/UnregisterFromOutOfPose instead") UnregisterFromPoseCallbacks(XnCallbackHandle hCallback)
- {
- PoseCookie* pPoseCookie = (PoseCookie*)hCallback;
-#pragma warning (push)
-#pragma warning (disable: XN_DEPRECATED_WARNING_IDS)
- xnUnregisterFromPoseCallbacks(GetHandle(), pPoseCookie->hCallback);
-#pragma warning (pop)
- xnOSFree(pPoseCookie);
- }
- /** @endcond */
-
-private:
- typedef struct PoseCookie
- {
- PoseDetection startHandler;
- PoseDetection endHandler;
- void* pPoseCookie;
- XnCallbackHandle hCallback;
- } PoseCookie;
-
- static void XN_CALLBACK_TYPE PoseDetectionStartBundleCallback(XnNodeHandle hNode, const XnChar* strPose, XnUserID user, void* pCookie)
- {
- PoseCookie* pPoseCookie = (PoseCookie*)pCookie;
- PoseDetectionCapability cap(hNode);
- if (pPoseCookie->startHandler != NULL)
- {
- pPoseCookie->startHandler(cap, strPose, user, pPoseCookie->pPoseCookie);
- }
- }
-
- static void XN_CALLBACK_TYPE PoseDetectionStartEndBundleCallback(XnNodeHandle hNode, const XnChar* strPose, XnUserID user, void* pCookie)
- {
- PoseCookie* pPoseCookie = (PoseCookie*)pCookie;
- PoseDetectionCapability cap(hNode);
- if (pPoseCookie->endHandler != NULL)
- {
- pPoseCookie->endHandler(cap, strPose, user, pPoseCookie->pPoseCookie);
- }
- }
- typedef struct PoseDetectionCookie
- {
- PoseDetection handler;
- void* pPoseCookie;
- XnCallbackHandle hCallback;
- } PoseDetectionCookie;
- static void XN_CALLBACK_TYPE PoseDetectionCallback(XnNodeHandle hNode, const XnChar* strPose, XnUserID user, void* pCookie)
- {
- PoseDetectionCookie* pPoseDetectionCookie = (PoseDetectionCookie*)pCookie;
- PoseDetectionCapability cap(hNode);
- if (pPoseDetectionCookie->handler != NULL)
- {
- pPoseDetectionCookie->handler(cap, strPose, user, pPoseDetectionCookie->pPoseCookie);
- }
- }
-
- typedef struct PoseInProgressCookie
- {
- PoseInProgress handler;
- void* pPoseCookie;
- XnCallbackHandle hCallback;
- } PoseInProgressCookie;
-
- static void XN_CALLBACK_TYPE PoseDetectionInProgressCallback(XnNodeHandle hNode, const XnChar* strPose, XnUserID user, XnPoseDetectionStatus poseErrors, void* pCookie)
- {
- PoseInProgressCookie* pPoseCookie = (PoseInProgressCookie*)pCookie;
- PoseDetectionCapability cap(hNode);
- if (pPoseCookie->handler != NULL)
- {
- pPoseCookie->handler(cap, strPose, user, poseErrors, pPoseCookie->pPoseCookie);
- }
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> The UserGenerator node generates data describing users that it recognizes
- * in the scene, identifying each user individually and thus allowing actions to be
- * done on specific users.
- *
- * <b>Usage:</b> Instantiate the class and call Create() to create a user generator node.
- *
- * <b>Data output:</b>
- * - CoM from UserGenerator local data
- * - User pixels from @ref SceneMetaData
- *
- * <b>Capabilities:</b>
- * - @ref SkeletonCapability
- * - @ref PoseDetectionCapability
- *
- * <b>Remarks:</b>
- *
- * The UserGenerator node provides access to the recognized users through user IDs it
- * returns. The user IDs are unique user identification numbers. The application uses
- * these user IDs to pass them to various methods of this node to access the specific
- * data of the specified user. For example:
- *
- * @ref xn::UserGenerator::GetUserPixels() gets the pixel map of a specific user, and
- * @ref xn::UserGenerator::GetCoM() gets the location of the center of mass of a specific
- * user.
- *
- * Typically, an application will require only a single UserGenerator node. However,
- * there are cases where more than one UserGenerator node could be required. For example,
- * where there are two sensors it may be convenient to build a production graph with
- * two UserGenerator nodes, one node for each depth output.
- *
- * <b>Main Features:</b>
- *
- * - User CoM: Provides the location of the center of mass of a specific user.
- * - Number of users: Provides the number of users currently detected in the scene.
- * - Users list: Provides a list of the IDs of currently recognized users in the scene.
- * - User pixels: Provides the pixels that represent a specific user.
- * - Events: Provides events about users in the scene:
- * - A new user is identified ('New User')
- * - An existing user exits temporarily ('User Exit')
- * - An exited user returns ('User Reenter')
- * - An existing user exits permanently ('Lost User')
- *
- * @note Registering to the 'New User' and 'Lost User' events is done by calling @ref RegisterUserCallbacks().
- * Registering to the 'User Exit' and 'User Reenter' events is done by calling @ref RegisterToUserExit() and @ref RegisterToUserReEnter().
- *
- * @section user_events Events
- *
- * <b>New User' event</b>
- *
- * Signals that a new user has now been recognized in the scene. A new user is a
- * user that was not previously recognized in the scene, and is now recognized in
- * the scene.
- *
- * <b>'Lost User' event</b>
- *
- * Signals that a user has been lost from the list of previously recognized users
- * in the scene.
- *
- * The exact meaning of a lost user is decided by the developer of the user generator.
- * However, a typical implementation would define that a lost user is a previously
- * recognized user that then exits the scene and does not return, even after a 'Lost
- * User' timeout has elapsed. Thus this event is raised only after some delay after
- * the user actually exited the scene.
- *
- * Using the above approach, the difference then between the 'Lost User' event and
- * the 'User Exit' event (see below) would be that the 'User Exit' event is raised
- * every time a recognized user leaves the scene, but a 'Lost User' event is raised
- * only after the user has remained absent ("exit-ed") for a certain timeout period
- * of time.
- *
- * If no timeout is used at all, the 'User Exit' and 'User Reenter' events are redundant.
- *
- * <b>'User Exit' event</b>
- *
- * Signals that a user now exited from the scene.
- *
- * The exact meaning of a user that exited is decided by the developer of the
- * user generator. However, a typical implementation would define that a user that
- * exited the scene is a previously recognized user that then leaves the scene.
- * but returns within a specified time, before the 'Lost User' timeout has elapsed.
- * In such a case the UserGenerator object still remembers the user and so when
- * the user comes back, everything known about it is restored. See the 'Lost User'
- * event above for more explanation of the difference between the 'User Exit' event
- * and the 'Lost User' event in a typical implementation.
- *
- * <b>'User Reenter' event</b>
- *
- * Signals that a user has now reentered to the scene after exiting. A user that
- * reenters the scene after exiting is a recognized user that exited, but now is
- * returning within a specified permitted time span, before the 'Lost User' timeout
- * has elapsed. In such a case the UserGenerator node still remembers the user and
- * so when the user returns, everything known about it is restored.
- *
- * <b>Event Sequence</b>
- *
- * The following event sequences are typical:
- *
- * A:
- * -# 'New User'
- * -# 'User Exit'
- * -# 'Lost User'
- *
- * B:
- * -# 'New User'
- * -# 'User Exit'
- * -# 'User Reenter'
- * -# 'User Exit'
- * -# 'Lost User'
- */
- class UserGenerator : public Generator
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline UserGenerator(XnNodeHandle hNode = NULL) : Generator(hNode) {}
- inline UserGenerator(const NodeWrapper& other) : Generator(other) {}
-
- /**
- * @brief Creates a UserGenerator node from available @ref node_alternative "production node alternatives".
- *
- * <b>Remarks:</b>
- *
- * See @ref create_method for a detailed description of this method.
- */
- inline XnStatus Create(Context& context, Query* pQuery = NULL, EnumerationErrors* pErrors = NULL);
-
- /**
- * @brief Event handler signature for all UserGenerator events.
- *
- * Example of a handler prototype (for the 'New User' event in this case):
- @code
- void XN_CALLBACK_TYPE OnNewUser(xn::UserGenerator& generator, XnUserID nId, void* pCookie)
- @endcode
- *
- * @param [in] generator UserGenerator node that raised the event.
- * @param [in] user ID of the user.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- */
- typedef void (XN_CALLBACK_TYPE* UserHandler)(UserGenerator& generator, XnUserID user, void* pCookie);
-
- /**
- * @brief Gets the number of users currently identified in the scene.
- *
- * <b>Remarks:</b>
- *
- * The result of this method is required as input for the GetUsers() method.
- */
- inline XnUInt16 GetNumberOfUsers() const
- {
- return xnGetNumberOfUsers(GetHandle());
- }
-
- /**
- * @brief Gets an array of user IDs of all the recognized users in the scene at the current time.
- *
- * @param [out] aUsers Preallocated memory for the method to enter the user IDs.
- * @param [in,out] nUsers Number of users.
- *
- * @c nUsers is used both as an in parameter and an out one in this method:
- * [in] Size of the aUsers array (in units of users).
- * To get the value of nUsers (i.e., the size of array that you want - see
- * parameter below), you use the GetNumberOfUsers() method.
- * For example, if you want an array of size 4 - to contain a maximum of 4 users -
- * you pass 4 as the value of this parameter.
- *
- * [out] On completion, the method returns the number of users that were recognized.
- * E.g., if there is actually only one user, the output will be 1, although the
- * caller passed a value of 4 (as above) for to allocate an array of size 4.
- *
- * <b>Remarks:</b>
- *
- * The output user IDs from this method can be used as input to the @ref xn::UserGenerator::GetCoM()
- * method for getting the center of mass of each user.
- */
- inline XnStatus GetUsers(XnUserID aUsers[], XnUInt16& nUsers) const
- {
- return xnGetUsers(GetHandle(), aUsers, &nUsers);
- }
-
- /**
- * @brief Gets the position of a user's center of mass. This is the single point for
- * representing the user.
- *
- * @param [in] user Specifies a user ID.
- * @param [out] com The user's center of mass in 3-D coordinates.
- *
- * The center of mass is a useful point to represent the user. When you don't have
- * any other reference point (e.g., you don't have the position of a specific joint,
- * or of the head, or any other such point), this is an adequate point with which
- * to start to represent the user.
- *
- * <b>Remarks:</b>
- *
- * The returned @ref XnPoint3D value is the center of mass of all the shown pixels
- * that belong to that user, but not necessarily the real center of mass of the
- * human user.
- * The application can use this method to request the center of mass for each user.
- */
- inline XnStatus GetCoM(XnUserID user, XnPoint3D& com) const
- {
- return xnGetUserCoM(GetHandle(), user, &com);
- }
-
- /**
- * @brief Gets the pixel map of the specified user in the scene and saves it in the @ref xn::SceneMetaData object.
- * The pixels that form part of the user's body are labeled with user's ID. Other values are irrelevant.
- *
- * @param [in] user The ID of the user the pixel map should be returned for.
- * @param [out] smd Struct to be filled with the pixel map.
- *
- * <b>Remarks:</b>
- *
- * A usage example for this method in gaming is for coloring the avatar on the screen.
- *
- * The special value 0 (zero) can be used in the @c user parameter, telling the generator to return a label map
- * containing all users, where each pixel is either marked as 0 (background pixel) or with the user ID to which
- * it belongs.
- */
- inline XnStatus GetUserPixels(XnUserID user, SceneMetaData& smd) const
- {
- return xnGetUserPixels(GetHandle(), user, smd.GetUnderlying());
- }
-
- /**
- * @brief Registers event handlers for the 'New User' and 'Lost User' events.
- *
- * @param [in] NewUserCB Callback function to be invoked when the 'New User' event is raised.
- * @param [in] LostUserCB Callback function to be invoked when the 'Lost User' event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterUserCallbacks(UserHandler NewUserCB, UserHandler LostUserCB, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- UserCookie* pUserCookie;
- XN_VALIDATE_ALLOC(pUserCookie, UserCookie);
- pUserCookie->newHandler = NewUserCB;
- pUserCookie->lostHandler = LostUserCB;
- pUserCookie->pUserCookie = pCookie;
-
- nRetVal = xnRegisterUserCallbacks(GetHandle(), NewUserCallback, LostUserCallback, pUserCookie, &pUserCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pUserCookie);
- return (nRetVal);
- }
-
- hCallback = pUserCookie;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Unregisters event handlers for the 'New User' and 'Lost User' events.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterUserCallbacks(XnCallbackHandle hCallback)
- {
- UserCookie* pUserCookie = (UserCookie*)hCallback;
- xnUnregisterUserCallbacks(GetHandle(), pUserCookie->hCallback);
- xnOSFree(pUserCookie);
- }
-
- /**
- * @brief Gets a @ref SkeletonCapability object for accessing Skeleton functionality.
- *
- * <b>Remarks:</b>
- *
- * Once the @ref SkeletonCapability object has been obtained, the application can
- * work with a skeleton.
- *
- * It is the application's responsibility to check first if Skeleton capability
- * is supported by calling the @ref IsCapabilitySupported() method..
- */
- inline const SkeletonCapability GetSkeletonCap() const
- {
- return SkeletonCapability(GetHandle());
- }
-
- /**
- * @brief Gets a @ref SkeletonCapability object for accessing Skeleton functionality.
- *
- * <b>Remarks:</b>
- *
- * Once the @ref SkeletonCapability object has been obtained, the application can
- * work with a skeleton.
- *
- * It is the application's responsibility to check first if Skeleton capability
- * is supported by calling the @ref IsCapabilitySupported() method..
- */
- inline SkeletonCapability GetSkeletonCap()
- {
- return SkeletonCapability(GetHandle());
- }
-
- /**
- * @brief Gets a @ref xn::PoseDetectionCapability object for accessing Pose Detection
- * functionality
- *
- * <b>Remarks:</b>
- *
- * It is the application responsibility to check first if @ref XN_CAPABILITY_POSE_DETECTION
- * is supported
- * by calling @ref xn::ProductionNode::IsCapabilitySupported().
- */
- inline const PoseDetectionCapability GetPoseDetectionCap() const
- {
- return PoseDetectionCapability(GetHandle());
- }
-
- /**
- * @brief Gets a @ref xn::PoseDetectionCapability object for accessing Pose Detection
- * functionality
- *
- * <b>Remarks:</b>
- *
- * It is the application responsibility to check first if @ref XN_CAPABILITY_POSE_DETECTION
- * is supported
- * by calling @ref xn::ProductionNode::IsCapabilitySupported().
- */
- inline PoseDetectionCapability GetPoseDetectionCap()
- {
- return PoseDetectionCapability(GetHandle());
- }
-
- /**
- * @brief Registers an event handler for the 'User Exit' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToUserExit(UserHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- UserSingleCookie* pUserCookie;
- XN_VALIDATE_ALLOC(pUserCookie, UserSingleCookie);
- pUserCookie->handler = handler;
- pUserCookie->pUserCookie = pCookie;
-
- nRetVal = xnRegisterToUserExit(GetHandle(), UserSingleCallback, pUserCookie, &pUserCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pUserCookie);
- return (nRetVal);
- }
-
- hCallback = pUserCookie;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Unregisters an event handler for the 'User Exit' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromUserExit(XnCallbackHandle hCallback)
- {
- UserSingleCookie* pUserCookie = (UserSingleCookie*)hCallback;
- xnUnregisterFromUserExit(GetHandle(), pUserCookie->hCallback);
- xnOSFree(pUserCookie);
- }
-
- /**
- * @brief Registers an event handler for the 'User Reenter' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToUserReEnter(UserHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- UserSingleCookie* pUserCookie;
- XN_VALIDATE_ALLOC(pUserCookie, UserSingleCookie);
- pUserCookie->handler = handler;
- pUserCookie->pUserCookie = pCookie;
-
- nRetVal = xnRegisterToUserReEnter(GetHandle(), UserSingleCallback, pUserCookie, &pUserCookie->hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- xnOSFree(pUserCookie);
- return (nRetVal);
- }
-
- hCallback = pUserCookie;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Unregisters an event handler for the 'User Reenter' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromUserReEnter(XnCallbackHandle hCallback)
- {
- UserSingleCookie* pUserCookie = (UserSingleCookie*)hCallback;
- xnUnregisterFromUserReEnter(GetHandle(), pUserCookie->hCallback);
- xnOSFree(pUserCookie);
- }
-
- private:
- typedef struct UserCookie
- {
- UserHandler newHandler;
- UserHandler lostHandler;
- void* pUserCookie;
- XnCallbackHandle hCallback;
- } UserCookie;
-
- static void XN_CALLBACK_TYPE NewUserCallback(XnNodeHandle hNode, XnUserID user, void* pCookie)
- {
- UserCookie* pUserCookie = (UserCookie*)pCookie;
- UserGenerator gen(hNode);
- if (pUserCookie->newHandler != NULL)
- {
- pUserCookie->newHandler(gen, user, pUserCookie->pUserCookie);
- }
- }
-
- static void XN_CALLBACK_TYPE LostUserCallback(XnNodeHandle hNode, XnUserID user, void* pCookie)
- {
- UserCookie* pUserCookie = (UserCookie*)pCookie;
- UserGenerator gen(hNode);
- if (pUserCookie->lostHandler != NULL)
- {
- pUserCookie->lostHandler(gen, user, pUserCookie->pUserCookie);
- }
- }
-
- typedef struct UserSingleCookie
- {
- UserHandler handler;
- void* pUserCookie;
- XnCallbackHandle hCallback;
- } UserSingleCookie;
-
- static void XN_CALLBACK_TYPE UserSingleCallback(XnNodeHandle hNode, XnUserID user, void* pCookie)
- {
- UserSingleCookie* pUserCookie = (UserSingleCookie*)pCookie;
- UserGenerator gen(hNode);
- if (pUserCookie->handler != NULL)
- {
- pUserCookie->handler(gen, user, pUserCookie->pUserCookie);
- }
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * <b>Purpose:</b> An audio generator node generates audio data.
- *
- * <b>Event: 'Wave Output Mode Change'</b>
- *
- * Signals that the node's current configuration's Wave Output Mode has been changed
- * to some other wave output mode.
- *
- * Use @ref RegisterToWaveOutputModeChanges() and @ref UnregisterFromWaveOutputModeChanges() for using this event.
- *
- * This event is raised by calling SetWaveOutputMode().
- */
- class AudioGenerator : public Generator
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline AudioGenerator(XnNodeHandle hNode = NULL) : Generator(hNode) {}
- inline AudioGenerator(const NodeWrapper& other) : Generator(other) {}
-
- /**
- * @brief Creates an AudioGenerator node from available @ref node_alternative "production node alternatives".
- *
- * <b>Remarks</b>
- *
- * See @ref create_method for a detailed description of this method.
- */
- inline XnStatus Create(Context& context, Query* pQuery = NULL, EnumerationErrors* pErrors = NULL);
-
- /**
- * @brief Gets the audio generator node's latest @ref glos_frame_object "frame object", saving
- * it in the @ref xn::AudioMetaData object. This @ref glos_frame_object "frame object" is a
- * snapshot of the generated label map data and its associated configuration information at a
- * certain point in time. This saved @ref glos_frame_object "frame object" provides fast
- * and easy access to the audio generator node's data and configuration information.
- *
- * @param [out] metaData Structure to be filled with the frame object.
- *
- * <b>Remarks:</b>
- *
- * This method is central in the use of the AudioGenerator node. Once the AudioGenerator
- * node is generating data, after each @ref conc_updating_data "'Update Data'" call,
- * the application calls this method to get the node's frame object, which contains
- * the data and all its associated properties.
- */
- inline void GetMetaData(AudioMetaData& metaData) const
- {
- xnGetAudioMetaData(GetHandle(), metaData.GetUnderlying());
- }
-
- /**
- * @copybrief xnGetAudioBuffer
- * For full details and usage, see @ref xnGetAudioBuffer
- */
- inline const XnUChar* GetAudioBuffer() const
- {
- return xnGetAudioBuffer(GetHandle());
- }
-
- /**
- * @brief Gets the node's number of supported wave output modes.
- */
- inline XnUInt32 GetSupportedWaveOutputModesCount() const
- {
- return xnGetSupportedWaveOutputModesCount(GetHandle());
- }
-
- /**
- * @brief Returns a list of the wave output modes that the @ref AudioGenerator node supports.
- * @param [out] aSupportedModes Buffer to be filled with the list of wave output modes.
- * @param [in,out] nCount [in] Size of the array.
- [out] Number of modes returned.
- */
- inline XnStatus GetSupportedWaveOutputModes(XnWaveOutputMode* aSupportedModes, XnUInt32& nCount) const
- {
- return xnGetSupportedWaveOutputModes(GetHandle(), aSupportedModes, &nCount);
- }
-
- /**
- * @brief Sets the current wave output mode of the AudioGenerator node. This output mode
- * is used for generating the next audio packet.
- *
- * @param [in] OutputMode Mode to set as the current wave output mode.
- *
- * <b>Remarks</b>
- *
- * The wave output mode is contained in the @ref xn::XnWaveOutputMode struct. It
- * comprises: bits per sample, channel, and sample rate.
- */
- inline XnStatus SetWaveOutputMode(const XnWaveOutputMode& OutputMode)
- {
- return xnSetWaveOutputMode(GetHandle(), &OutputMode);
- }
-
- /**
- * @brief Gets the current AudioGenerator node's wave output mode. This output mode
- * is used for generating the next audio packet.
- *
- * @param [out] OutputMode Current wave output mode.
- *
- * <b>Remarks</b>
- *
- * The wave output mode is contained in the XnWaveOutputMode struct. Each wave output
- * mode comprises settings for bits per sample, channel, and sample rate, as follows:
- */
- inline XnStatus GetWaveOutputMode(XnWaveOutputMode& OutputMode) const
- {
- return xnGetWaveOutputMode(GetHandle(), &OutputMode);
- }
-
- /**
- * @brief Registers an event handler for the 'Wave Output Mode Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToWaveOutputModeChanges(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return _RegisterToStateChange(xnRegisterToWaveOutputModeChanges, GetHandle(), handler, pCookie, hCallback);
- }
-
- /**
- * @brief Unregisters an event handler for the 'Wave Output Mode Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromWaveOutputModeChanges(XnCallbackHandle hCallback)
- {
- _UnregisterFromStateChange(xnUnregisterFromWaveOutputModeChanges, GetHandle(), hCallback);
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- * Represents a Mock Audio Generator node
- */
- class MockAudioGenerator : public AudioGenerator
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline MockAudioGenerator(XnNodeHandle hNode = NULL) : AudioGenerator(hNode) {}
- inline MockAudioGenerator(const NodeWrapper& other) : AudioGenerator(other) {}
-
- /**
- * Creates a mock audio generator
- *
- * @param [in] context The context in which the node should be generated
- * @param [in] strName Optional. The name of the new node.
- */
- XnStatus Create(Context& context, const XnChar* strName = NULL);
-
- /**
- * Creates a mock audio generator, copying the initial state from another audio
- * generator.
- *
- * @param [in] other The audio generator to copy state from
- * @param [in] strName Optional. The name of the new node.
- */
- XnStatus CreateBasedOn(AudioGenerator& other, const XnChar* strName = NULL);
-
- /**
- * @copybrief xnMockAudioSetData
- * For full details and usage, see @ref xnMockAudioSetData
- */
- inline XnStatus SetData(XnUInt32 nFrameID, XnUInt64 nTimestamp, XnUInt32 nDataSize, const XnUInt8* pAudioBuffer)
- {
- return xnMockAudioSetData(GetHandle(), nFrameID, nTimestamp, nDataSize, pAudioBuffer);
- }
-
- /**
- * Sets the data of the mock node from a meta data object, overriding frame ID and
- * timestamp
- *
- * @param [in] audioMD Object to take data from
- * @param [in] nFrameID Frame ID
- * @param [in] nTimestamp Timestamp
- */
- inline XnStatus SetData(const AudioMetaData& audioMD, XnUInt32 nFrameID, XnUInt64 nTimestamp)
- {
- return SetData(nFrameID, nTimestamp, audioMD.DataSize(), audioMD.Data());
- }
-
- /**
- * Sets the data of the mock node from a meta data object
- *
- * @param [in] audioMD Object to take data from
- */
- inline XnStatus SetData(const AudioMetaData& audioMD)
- {
- return SetData(audioMD, audioMD.FrameID(), audioMD.Timestamp());
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- */
- class MockRawGenerator : public Generator
- {
- public:
- MockRawGenerator(XnNodeHandle hNode = NULL) : Generator(hNode) {}
- MockRawGenerator(const NodeWrapper& other) : Generator(other) {}
-
- inline XnStatus Create(Context& context, const XnChar* strName = NULL);
-
- inline XnStatus SetData(XnUInt32 nFrameID, XnUInt64 nTimestamp, XnUInt32 nDataSize, const void* pData)
- {
- return xnMockRawSetData(GetHandle(), nFrameID, nTimestamp, nDataSize, pData);
- }
-
- };
-
- /**
- * @ingroup cppref_prd_func
- * Represents a Codec node.
- */
- class Codec : public ProductionNode
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline Codec(XnNodeHandle hNode = NULL) : ProductionNode(hNode) {}
- inline Codec(const NodeWrapper& other) : ProductionNode(other) {}
-
- /**
- * @copybrief xnCreateCodec
- * For full details and usage, see @ref xnCreateCodec
- */
- inline XnStatus Create(Context& context, XnCodecID codecID, ProductionNode& initializerNode);
-
- /**
- * @copybrief xnGetCodecID
- * For full details and usage, see @ref xnGetCodecID
- */
- inline XnCodecID GetCodecID() const
- {
- return xnGetCodecID(GetHandle());
- }
-
- /**
- * @copybrief xnEncodeData
- * For full details and usage, see @ref xnEncodeData
- */
- inline XnStatus EncodeData(const void* pSrc, XnUInt32 nSrcSize, void* pDst, XnUInt32 nDstSize, XnUInt* pnBytesWritten) const
- {
- return xnEncodeData(GetHandle(), pSrc, nSrcSize, pDst, nDstSize, pnBytesWritten);
- }
-
- /**
- * @copybrief xnDecodeData
- * For full details and usage, see @ref xnDecodeData
- */
- inline XnStatus DecodeData(const void* pSrc, XnUInt32 nSrcSize, void* pDst, XnUInt32 nDstSize, XnUInt* pnBytesWritten) const
- {
- return xnDecodeData(GetHandle(), pSrc, nSrcSize, pDst, nDstSize, pnBytesWritten);
- }
- };
-
- /**
- * @ingroup cppref_prd_func
- *
- * <b>Purpose:</b> The ScriptNode object loads an XML script from a file or string,
- * and then runs the XML script to build a production graph. It also references every
- * node created from that script, so it wouldn't be destroyed.
- *
- * <b>Remarks:</b>
- *
- * A typical usage of a script node is:
- * - Create the script node, using the @ref Create() method.
- * - Load XML script from file or string, using @ref LoadScriptFromFile() or @ref LoadScriptFromString().
- * - Execute the script, using @ref Run().
- *
- * Note that the context's @ref xn::Context::RunXmlScriptFromFile "RunXmlScriptFromFile()" or
- * @ref xn::Context::RunXmlScript "RunXmlScript()" methods can be used to perform
- * all above steps.
-
- * All production nodes in the production graph use reference count to determine their life time,
- * but if an application executed a script, it can't know upfront which nodes will be created
- * by this script, and so, can't take reference to them, so those nodes might be destroyed
- * immediately. The script node, apart from executing the script, also keeps reference to
- * all the nodes created by the script. This means that if the script node is destroyed,
- * every production node that was created by the script, and is unreferenced by the application
- * will also be destroyed. For this reason, it is recommended for application using XML scripts
- * to keep a reference to the script node as long as they keep a reference to the context itself.
- *
- * A single ScriptNode object is responsible for building the entire production graph,
- * irrespective of however many node definitions there are in the XML script and how
- * many production nodes are created.
- *
- * For additional information about XML scripts, see @ref xmlscripts.
- */
- class ScriptNode : public ProductionNode
- {
- public:
- /**
- * Ctor
- *
- * @param [in] hNode Node handle
- */
- inline ScriptNode(XnNodeHandle hNode = NULL) : ProductionNode(hNode) {}
- inline ScriptNode(const NodeWrapper& other) : ProductionNode(other) {}
-
- inline XnStatus Create(Context& context, const XnChar* strFormat);
-
- inline const XnChar* GetSupportedFormat()
- {
- return xnScriptNodeGetSupportedFormat(GetHandle());
- }
-
- /**
- * @brief Loads an XML script file into the ScriptNode object.
- *
- * @param [in] strFileName Name of file containing an XML script.
- */
- inline XnStatus LoadScriptFromFile(const XnChar* strFileName)
- {
- return xnLoadScriptFromFile(GetHandle(), strFileName);
- }
-
- /**
- * @brief Loads an XML script string into the ScriptNode object.
- *
- * @param [in] strScript String containing an XML script.
- */
- inline XnStatus LoadScriptFromString(const XnChar* strScript)
- {
- return xnLoadScriptFromString(GetHandle(), strScript);
- }
-
- /**
- * @brief Runs the ScriptNode object's XML script to build a production graph.
- *
- * @param [out] pErrors List of enumeration errors produced during method execution.
- *
- * <b>Remarks</b>
- *
- * This method causes the whole production graph to enter Generating state. To read
- * data you have to run one of the @ref conc_updating_data "'Update Data'" methods
- * of the Context or of the node itself.
- */
- inline XnStatus Run(EnumerationErrors* pErrors);
- };
-
- //---------------------------------------------------------------------------
- // EnumerationErrors
- //---------------------------------------------------------------------------
- /**
- * @ingroup cppref_graph_mgmt
- * <b>Purpose:</b> An EnumerationError object returns a full list of modules that failed
- * to enumerate specifying exactly why each module failed.
- *
- * <b>Usage:</b> Instantiate and pass to enumeration methods.
- *
- * <b>Remarks:</b>
- *
- * Sometimes an application enumerates for a specific node, and receives zero results.
- * An obvious reason for this failure is that no module implementing the node type was
- * installed. Another possible reason is that a module may be installed but has no license.
- * Yet another possible reason is that a required hardware device is currently disconnected.
- *
- * Applications can use the EnumerationErrors class to acquire a full list of modules
- * that failed to enumerate specifying for each exactly why each module failed.
- *
- * The methods provided by the EnumerationErrors class let the application search enumeration
- * lists for specific types of nodes.
- */
- class EnumerationErrors
- {
- public:
- /**
- * Ctor
- */
- inline EnumerationErrors() : m_bAllocated(TRUE), m_pErrors(NULL) { xnEnumerationErrorsAllocate(&m_pErrors); }
-
- /**
- * Ctor
- *
- * @param [in] pErrors underlying C object to wrap
- * @param [in] bOwn TRUE to own the object (i.e. free it upon destruction), FALSE
- * otherwise.
- */
- inline EnumerationErrors(XnEnumerationErrors* pErrors, XnBool bOwn = FALSE) : m_bAllocated(bOwn), m_pErrors(pErrors) {}
-
- /**
- * Dtor
- */
- ~EnumerationErrors() { Free(); }
-
- /**
- * An iterator over enumeration errors
- */
- class Iterator
- {
- public:
- friend class EnumerationErrors;
-
- /**
- * Checks if the other iterator points to the same location
- *
- * @param [in] other another iterator
- */
- XnBool operator==(const Iterator& other) const
- {
- return m_it == other.m_it;
- }
-
- /**
- * Checks if the other iterator points to a different location
- *
- * @param [in] other another iterator
- */
- XnBool operator!=(const Iterator& other) const
- {
- return m_it != other.m_it;
- }
-
- /**
- * Moves the iterator to the next location. If end of list was reached, iterator
- * will be equal to @ref EnumerationErrors::End().
- */
- inline Iterator& operator++()
- {
- m_it = xnEnumerationErrorsGetNext(m_it);
- return *this;
- }
-
- /**
- * Returns an iterator to the next location. If end of list was reached, iterator
- * will be equal to @ref EnumerationErrors::End().
- */
- inline Iterator operator++(int)
- {
- return Iterator(xnEnumerationErrorsGetNext(m_it));
- }
-
- /**
- * @brief Returns the description data of the failing node the iterator points to.
- *
- * <b>Remarks</b>
- *
- * The description data returned in the @ref XnProductionNodeDescription struct
- * includes the node name, the vendor, and the version.
- */
- inline const XnProductionNodeDescription& Description() { return *xnEnumerationErrorsGetCurrentDescription(m_it); }
-
- /**
- * @brief Returns the failure error code of the failing node the iterator points to.
- * For a string representation of this error, call @ref xnGetStatusString().
- */
- inline XnStatus Error() { return xnEnumerationErrorsGetCurrentError(m_it); }
-
- private:
- inline Iterator(XnEnumerationErrorsIterator it) : m_it(it) {}
-
- XnEnumerationErrorsIterator m_it;
- };
-
- /**
- * @brief Gets an iterator to the first item in an enumeration errors list.
- *
- * <b>Remarks</b>
- *
- * To access the contents of the error item, either use the @ref ToString() method
- * of this class or the methods of the @ref EnumerationErrors::Iterator class.
- */
- inline Iterator Begin() const { return Iterator(xnEnumerationErrorsGetFirst(m_pErrors)); }
-
- /**
- * @brief Returns an iterator referring to the past-the-end element in an enumeration errors list.
- * This iterator does not point to an actual item.
- *
- * <b>Remarks</b>
- *
- * Use this as the sentinel for flagging the end of a list when searching.
- */
- inline Iterator End() const { return Iterator(NULL); }
-
- /**
- * @brief Returns a string representation of the Enumeration Errors object. The string
- * contains a full list of the modules that failed the most recent enumeration operation.
- * For each failed module, the Enumeration Errors object specifies why exactly the module failed.
- *
- * @param [in] csBuffer Character buffer to be filled.
- * @param [in] nSize Size of the character buffer.
- */
- inline XnStatus ToString(XnChar* csBuffer, XnUInt32 nSize)
- {
- return xnEnumerationErrorsToString(m_pErrors, csBuffer, nSize);
- }
-
- /**
- * @copybrief xnEnumerationErrorsFree
- * For full details and usage, see @ref xnEnumerationErrorsFree
- */
- inline void Free()
- {
- if (m_bAllocated)
- {
- xnEnumerationErrorsFree(m_pErrors);
- m_pErrors = NULL;
- m_bAllocated = FALSE;
- }
- }
-
- /**
- * Gets the underlying C object
- */
- inline XnEnumerationErrors* GetUnderlying() { return m_pErrors; }
-
- private:
- XnEnumerationErrors* m_pErrors;
- XnBool m_bAllocated;
- };
-
- //---------------------------------------------------------------------------
- // Context
- //---------------------------------------------------------------------------
-
- /**
- * @ingroup cppref_graph_mgmt
- *
- * A context is a workspace where the application builds an OpenNI production graph.
- * It contains methods for managing the production graph.
- *
- * In order to use any of the OpenNI functionality you must first construct a Context
- * object and initialize it. Prior to this, the application cannot do anything with
- * OpenNI.
- *
- * For a comprehensive overview to the Context class and its members, see @ref conc_context
- * "Overview to Contexts".
- *
- * @section context_global_error_event Event: 'Global Error State Change'
- *
- * Signals that the error state of any of the nodes has changed.
- *
- * This event can be used by the application to get a signal as soon as any error occurs
- * in one of the production nodes. The global error state aggregates error state from all
- * the production nodes in the context.
- *
- * Use @ref RegisterToErrorStateChange() and @ref UnregisterFromErrorStateChange() for using this event.
- *
- * @section context_node_creation_event Event: 'Node Creation'
- *
- * Signals that a new node was created in the context production graph.
- *
- * Use @ref RegisterToNodeCreation() and @ref UnregisterFromNodeCreation() for using this event.
- *
- * @section context_node_destruction_event Event: 'Node Destruction'
- *
- * Signals that a node was removed from the context production graph, and destroyed.
- *
- * Use @ref RegisterToNodeDestruction() and @ref UnregisterFromNodeDestruction() for using this event.
- */
- class Context
- {
- public:
- /**
- * Callback prototype for the @ref context_node_creation_event "'Node Creation'" event handler.
- *
- * @param [in] context The context that raised this event.
- * @param [in] createdNode The id of the hand that disappeared.
- * @param [in] pCookie A user-provided cookie that was given when registering to
- * this event.
- *
- * Example for such a handler:
- @code
- void XN_CALLBACK_TYPE OnNodeCreation(Context& context, ProductionNode& createdNode, void* pCookie)
- {}
- @endcode
- */
- typedef void (XN_CALLBACK_TYPE* NodeCreationHandler)(Context& context, ProductionNode& createdNode, void* pCookie);
-
- /**
- * Callback prototype for the @ref context_node_destruction_event "'Node Destruction'" event handler.
- *
- * @param [in] context The context that raised this event.
- * @param [in] strDestroyedNodeName The name of the node that was destroyed.
- * @param [in] pCookie A user-provided cookie that was given when registering to
- * this event.
- *
- * Example for such a handler:
- @code
- void XN_CALLBACK_TYPE OnNodeDestruction(Context& context, const XnChar* strDestroyedNodeName, void* pCookie)
- {}
- @endcode
- */
- typedef void (XN_CALLBACK_TYPE* NodeDestructionHandler)(Context& context, const XnChar* strDestroyedNodeName, void* pCookie);
-
- /**
- * Ctor
- */
- inline Context() : m_pContext(NULL), m_bUsingDeprecatedAPI(FALSE), m_bAllocated(FALSE), m_hShuttingDownCallback(NULL) {}
-
- /**
- * Ctor
- *
- * @param [in] pContext Underlying C object
- */
- inline Context(XnContext* pContext) : m_pContext(NULL), m_bUsingDeprecatedAPI(FALSE), m_bAllocated(FALSE), m_hShuttingDownCallback(NULL)
- {
- SetHandle(pContext);
- }
-
- /**
- * Copy Ctor
- *
- * @param [in] other Another context. Note that the context will only be destroyed
- * when the original object is destroyed.
- */
- inline Context(const Context& other) : m_pContext(NULL), m_bUsingDeprecatedAPI(FALSE), m_bAllocated(FALSE), m_hShuttingDownCallback(NULL)
- {
- SetHandle(other.m_pContext);
- }
-
- /**
- * Dtor
- */
- ~Context()
- {
- SetHandle(NULL);
- }
-
- inline Context& operator=(const Context& other)
- {
- SetHandle(other.m_pContext);
- return *this;
- }
-
- /**
- * Gets the underlying C object
- */
- inline XnContext* GetUnderlyingObject() const { return m_pContext; }
-
- /**
- * Checks if two context objects are references to the same context.
- *
- * @param [in] other Another object
- */
- inline XnBool operator==(const Context& other)
- {
- return (GetUnderlyingObject() == other.GetUnderlyingObject());
- }
-
- /**
- * Checks if two context objects are <i>not</i> references to the same context.
- *
- * @param [in] other Another object
- */
- inline XnBool operator!=(const Context& other)
- {
- return (GetUnderlyingObject() != other.GetUnderlyingObject());
- }
-
- /**
- * @brief Builds the context's general software environment.
- *
- * This method initializes runtime variables and data structures, and examines all
- * registered plug-ins to learn the purpose and specific capabilities of each. In
- * particular, during initialization the context initialization examines all registered
- * plug-ins to learn the purpose and specific capabilities of each. For example,
- * one plug-in is for creating a skeleton node, and another plug-in is for creating
- * a depth node. Thus an entire database is built of plug-ins that can be queried
- * according to vendor, model, and capabilities of each.
- *
- * Once you have completed the initialization you can create nodes that are based
- * on the plug-ins that OpenNI has discovered by this initialization process.
- */
- inline XnStatus Init()
- {
- XnContext* pContext = NULL;
- XnStatus nRetVal = xnInit(&pContext);
- XN_IS_STATUS_OK(nRetVal);
-
- TakeOwnership(pContext);
- m_bAllocated = TRUE;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Runs an XML script string to build a production graph.
- *
- * @param [in] strScript String containing an XML script.
- * @param [out] scriptNode @ref xn::ScriptNode object as the root to all the nodes
- * created from the XML file. When no longer needed, the node can
- * be released, causing all the created nodes to decrement their reference counts.
- * @param [in,out] pErrors Optional. To be filled with enumeration errors.
- *
- * <B>Remarks:</B>
- *
- * For a full description of the XML structure, see @ref xmlscripts.
- * Compare this method with initialization methods that run an XML script from a
- * file.
- */
- inline XnStatus RunXmlScript(const XnChar* strScript, ScriptNode& scriptNode, EnumerationErrors* pErrors = NULL)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnNodeHandle hScriptNode;
- nRetVal = xnContextRunXmlScriptEx(m_pContext, strScript, pErrors == NULL ? NULL : pErrors->GetUnderlying(), &hScriptNode);
- XN_IS_STATUS_OK(nRetVal);
-
- scriptNode.TakeOwnership(hScriptNode);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Runs an XML script file to build a production graph.
- *
- * @param [in] strFileName Name of file containing an XML script.
- * @param [out] scriptNode scriptNode object as the root to all the nodes created
- * from the XML file. When no longer needed, the node can
- * be released, causing all the created nodes to decrement
- * their reference counts.
- * @param [in,out] pErrors Optional. To be filled with enumeration errors.
- *
- * <B>Remarks:</B>
- *
- * The XML script file describes all the nodes you want to create. For each node
- * description in the XML file, this method creates a @ref xn::ProductionNode object.
- */
- inline XnStatus RunXmlScriptFromFile(const XnChar* strFileName, ScriptNode& scriptNode, EnumerationErrors* pErrors = NULL)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnNodeHandle hScriptNode;
- nRetVal = xnContextRunXmlScriptFromFileEx(m_pContext, strFileName, pErrors == NULL ? NULL : pErrors->GetUnderlying(), &hScriptNode);
- XN_IS_STATUS_OK(nRetVal);
-
- scriptNode.TakeOwnership(hScriptNode);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Shorthand combination of two other initialization methods - @ref Init() and then @ref RunXmlScriptFromFile() -
- * to initialize the context object and then create a production graph.
- *
- * @param [in] strFileName Name of file containing an XML script.
- * @param [out] scriptNode ScriptNode object as the root to all the nodes created
- * from the XML file. When no longer needed, the node can be
- * released, causing all the created nodes to decrement their reference counts.
- * @param [out] pErrors Optional. To be filled with enumeration errors.
- *
- * <B>Remarks:</B>
- *
- * The XML script file describes all the nodes you want to create. For each node
- * description in the XML file, this method creates a @ref xn::ProductionNode object.
- */
- inline XnStatus InitFromXmlFile(const XnChar* strFileName, ScriptNode& scriptNode, EnumerationErrors* pErrors = NULL)
- {
- XnContext* pContext = NULL;
-
- XnNodeHandle hScriptNode;
- XnStatus nRetVal = xnInitFromXmlFileEx(strFileName, &pContext, pErrors == NULL ? NULL : pErrors->GetUnderlying(), &hScriptNode);
- XN_IS_STATUS_OK(nRetVal);
-
- scriptNode.TakeOwnership(hScriptNode);
- TakeOwnership(pContext);
- m_bAllocated = TRUE;
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Recreates a production graph from a recorded ONI file and then replays the data
- * generation exactly as it was recorded.
- *
- * @param [in] strFileName Name of the recorded file to be run.
- * @param [out] playerNode Returns a @ref xn::Player object through which
- * playback can be controlled, e.g., seeking and setting playback speed.
- *
- * <B>Remarks:</B>
- *
- * OpenNI provides great flexibility of recording. You can decide you want to record
- * only the final output, e.g., just a skeleton in movement; or record both the
- * output skeleton and the depth input; or record only the depth input and then
- * recreate the skeleton at run-time after reading the recorded raw depth data.
- * You can also choose which nodes to record.
- */
- inline XnStatus OpenFileRecording(const XnChar* strFileName, ProductionNode& playerNode)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnNodeHandle hPlayer;
- nRetVal = xnContextOpenFileRecordingEx(m_pContext, strFileName, &hPlayer);
- XN_IS_STATUS_OK(nRetVal);
-
- playerNode.TakeOwnership(hPlayer);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @copybrief xnCreateMockNode
- * For full details and usage, see @ref xnCreateMockNode
- */
- inline XnStatus CreateMockNode(XnProductionNodeType type, const XnChar* strName, ProductionNode& mockNode)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnNodeHandle hMockNode;
- nRetVal = xnCreateMockNode(m_pContext, type, strName, &hMockNode);
- XN_IS_STATUS_OK(nRetVal);
-
- mockNode.TakeOwnership(hMockNode);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @copybrief xnCreateMockNodeBasedOn
- * For full details and usage, see @ref xnCreateMockNodeBasedOn
- */
- inline XnStatus CreateMockNodeBasedOn(ProductionNode& originalNode, const XnChar* strName, ProductionNode& mockNode)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnNodeHandle hMockNode;
- nRetVal = xnCreateMockNodeBasedOn(m_pContext, originalNode, strName, &hMockNode);
- XN_IS_STATUS_OK(nRetVal);
-
- mockNode.TakeOwnership(hMockNode);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @copybrief xnCreateCodec
- * For full details and usage, see @ref xnCreateCodec
- */
- inline XnStatus CreateCodec(XnCodecID codecID, ProductionNode& initializerNode, Codec& codec)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnNodeHandle hCodec;
- nRetVal = xnCreateCodec(m_pContext, codecID, initializerNode.GetHandle(), &hCodec);
- XN_IS_STATUS_OK(nRetVal);
-
- codec.TakeOwnership(hCodec);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @copybrief xnContextAddRef
- * For full details and usage, see @ref xnContextAddRef
- */
- inline XnStatus AddRef()
- {
- return xnContextAddRef(m_pContext);
- }
-
- /**
- * @copybrief xnContextRelease
- * For full details and usage, see @ref xnContextRelease
- */
- inline void Release()
- {
- SetHandle(NULL);
- }
-
-
- /**
- * @copybrief xnAddLicense
- * For full details and usage, see @ref xnAddLicense
- */
- inline XnStatus AddLicense(const XnLicense& License)
- {
- return xnAddLicense(m_pContext, &License);
- }
-
- /**
- * @copybrief xnEnumerateLicenses
- * For full details and usage, see @ref xnEnumerateLicenses
- */
- inline XnStatus EnumerateLicenses(XnLicense*& aLicenses, XnUInt32& nCount) const
- {
- return xnEnumerateLicenses(m_pContext, &aLicenses, &nCount);
- }
-
- /**
- * @copybrief xnFreeLicensesList
- * For full details and usage, see @ref xnFreeLicensesList
- */
- inline static void FreeLicensesList(XnLicense aLicenses[])
- {
- xnFreeLicensesList(aLicenses);
- }
-
- /**
- * @brief Enumerates all available production nodes for a specific node type (e.g., the application wants to create a
- * depth generator node) and returns a full list of matching production nodes.
- *
- * @param [in] Type Requested node type.
- * @param [in] pQuery Optional. A query object that can be used to filter results.
- * @param [out] TreesList List of possible production nodes.
- * @param [out] pErrors Optional. To contain enumeration errors.
- *
- * <B>Remarks:</B>
- *
- * The application chooses one of the nodes from the node list returned by this method and uses it as input
- * to the @ref xn::Context::CreateProductionTree() method to create a new production node.
- *
- * Using this method to help create a production node offers the greatest flexibility since it returns a
- * complete list of matching production nodes and so the application can then choose the most suitable node.
- *
- * By contrast, using @ref xn::Context::CreateAnyProductionTree() "CreateAnyProductionTree()" or a node's <b>Create()</b>
- * method creates a node from the first matching node that satisfies the query.
- */
- XnStatus EnumerateProductionTrees(XnProductionNodeType Type, const Query* pQuery, NodeInfoList& TreesList, EnumerationErrors* pErrors = NULL) const
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- const XnNodeQuery* pInternalQuery = (pQuery != NULL) ? pQuery->GetUnderlyingObject() : NULL;
-
- XnNodeInfoList* pList = NULL;
- nRetVal = xnEnumerateProductionTrees(m_pContext, Type, pInternalQuery, &pList, pErrors == NULL ? NULL : pErrors->GetUnderlying());
- XN_IS_STATUS_OK(nRetVal);
-
- TreesList.ReplaceUnderlyingObject(pList);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Enumerates for production nodes of a specific node type, and creates the first
- * production node found of that type.
- *
- * @param [in] type Requested node type.
- * @param [in] pQuery Optional. A query object that can be used to filter results.
- * @param [out] node Handle to the newly created node.
- * @param [in,out] pErrors Optional. To contain enumeration errors.
- *
- * <B>Remarks:</B>
- *
- * This method is a 'shortcut' version of using the @ref EnumerateProductionTrees()
- * method and then passing the first result to @ref CreateProductionTree().
- * Thus, this method is exactly like the <b>Create()</b> method for nodes.
- *
- * Other ways of creating a production graph let the application retrieve a complete
- * list of alternatives and then choose the most appropriate alternative.
- *
- * This method is the method used by the above XML script methods to create the
- * ProductionNode objects. The XML method runs the XML script, and for each node
- * description the XML method runs this function to create that node.
- *
- * Using this function is called 'creating a node from the context'. You can also
- * create a node by invoking the <b>Create</b> method of the node itself, e.g.,
- * the @ref xn::HandsGenerator::Create "Create()" method of a @ref xn::HandsGenerator
- * "HandsGenerator" node.
- *
- * By default, this method does not enable the production nodes to start generating
- * data immediately on creation.
- *
- * @sa @ref create_method for more detail.
- */
- XnStatus CreateAnyProductionTree(XnProductionNodeType type, Query* pQuery, ProductionNode& node, EnumerationErrors* pErrors = NULL)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnNodeQuery* pInternalQuery = (pQuery != NULL) ? pQuery->GetUnderlyingObject() : NULL;
-
- XnNodeHandle hNode;
- nRetVal = xnCreateAnyProductionTree(m_pContext, type, pInternalQuery, &hNode, pErrors == NULL ? NULL : pErrors->GetUnderlying());
- XN_IS_STATUS_OK(nRetVal);
-
- node.TakeOwnership(hNode);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Creates a production node from the information supplied in a @ref xn::NodeInfo object.
- *
- * @param [in] Tree Node properties for creating the new node.
- * @param [out] node Reference to the new @ref xn::ProductionNode object.
- *
- * <B>Remarks:</B>
- *
- * The application gets the NodeInfo object by choosing it from the list returned
- * by the @ref xn::Context::EnumerateProductionTrees() method.
- *
- * If the new production node requires additional nodes for its input, and those
- * nodes do not yet exist, then this method creates those additional nodes also
- * and associates them with the "original" new production node.
- *
- */
- XnStatus CreateProductionTree(NodeInfo& Tree, ProductionNode& node)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnNodeHandle hNode;
- nRetVal = xnCreateProductionTree(m_pContext, Tree, &hNode);
- XN_IS_STATUS_OK(nRetVal);
-
- node.TakeOwnership(hNode);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Returns a list of all the context's existing created nodes.
- *
- * @param [out] list List of the context's existing created nodes.
- *
- * You can use the @ref xn::NodeInfoList::FilterList() method to filter the returned
- * list of existing nodes.
- */
- XnStatus EnumerateExistingNodes(NodeInfoList& list) const
- {
- XnNodeInfoList* pList;
- XnStatus nRetVal = xnEnumerateExistingNodes(m_pContext, &pList);
- XN_IS_STATUS_OK(nRetVal);
-
- list.ReplaceUnderlyingObject(pList);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Returns a list of the context's existing created nodes filtered by type.
- *
- * @param [in] list List of the context's existing created nodes.
- * @param [in] type Type to enumerate for.
- *
- * <B>Remarks</B>
- *
- * Returns the list after filtering them by type, so it returns a list of the created
- * nodes of the specific type only.
- *
- * An example of a typical case of returning a list of two nodes of the same type
- * is where there are two sensors in a 3D set-up and you need to retrieve the corresponding
- * two depth nodes to generate data from them.
- *
- * You can use the @ref xn::NodeInfoList::FilterList() method to filter the returned
- * list of existing nodes.
- */
- XnStatus EnumerateExistingNodes(NodeInfoList& list, XnProductionNodeType type) const
- {
- XnNodeInfoList* pList;
- XnStatus nRetVal = xnEnumerateExistingNodesByType(m_pContext, type, &pList);
- XN_IS_STATUS_OK(nRetVal);
-
- list.ReplaceUnderlyingObject(pList);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Searches for an existing created node of a specified type and returns a reference to it.
- *
- * @param [in] type Type of node to search for.
- * @param [out] node Reference to an existing created node that was found.
- *
- * <B>Remarks</B>
- *
- * This method returns only the first node it finds; this method does not return
- * the entire list of matching nodes. Compare this with the @ref xn::Context::EnumerateExistingNodes()
- * method, which returns the entire list of matching nodes.
- * A typical usage is that the application already created all the nodes from XML.
- * Then, when it needs to start generating data from a particular node, e.g., the
- * skeleton data, it will call FindExistingNode specifying the skeleton type, and
- * it will get it and start using it.
- *
- * This method does not provide a query parameter (compare with @ref xn::Context::EnumerateExistingNodes).
- */
- XnStatus FindExistingNode(XnProductionNodeType type, ProductionNode& node) const
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnNodeHandle hNode;
- nRetVal = xnFindExistingRefNodeByType(m_pContext, type, &hNode);
- XN_IS_STATUS_OK(nRetVal);
-
- node.TakeOwnership(hNode);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @copybrief xnGetNodeHandleByName
- * For full details and usage, see @ref xnGetNodeHandleByName
- */
- XnStatus GetProductionNodeByName(const XnChar* strInstanceName, ProductionNode& node) const
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnNodeHandle hNode;
- nRetVal = xnGetRefNodeHandleByName(m_pContext, strInstanceName, &hNode);
- XN_IS_STATUS_OK(nRetVal);
-
- node.TakeOwnership(hNode);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @copybrief xnGetNodeHandleByName
- * For full details and usage, see @ref xnGetNodeHandleByName
- */
- XnStatus GetProductionNodeInfoByName(const XnChar* strInstanceName, NodeInfo& nodeInfo) const
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnNodeHandle hNode;
- nRetVal = xnGetRefNodeHandleByName(m_pContext, strInstanceName, &hNode);
- XN_IS_STATUS_OK(nRetVal);
-
- xnProductionNodeRelease(hNode);
-
- nodeInfo = NodeInfo(xnGetNodeInfo(hNode));
-
- return (XN_STATUS_OK);
- }
-
- /**
- * @brief Ensures all created @ref dict_gen_node "generator nodes" are generating data.
- *
- */
- inline XnStatus StartGeneratingAll()
- {
- return xnStartGeneratingAll(m_pContext);
- }
-
- /**
- * @brief Ensures all @ref dict_gen_node "generator nodes" are not generating data.
- */
- inline XnStatus StopGeneratingAll()
- {
- return xnStopGeneratingAll(m_pContext);
- }
-
- /**
- * @brief Enables/disables the GlobalMirror flag.
- *
- * @param [in] bMirror New mirroring state.
- *
- * <B>Remarks:</B>
- *
- * See @ref conc_global_mirror for understanding of the 'Global Mirror' concept.
- */
- inline XnStatus SetGlobalMirror(XnBool bMirror)
- {
- return xnSetGlobalMirror(m_pContext, bMirror);
- }
-
- /**
- * @brief Gets the current state of the GlobalMirror flag.
- *
- */
- inline XnBool GetGlobalMirror()
- {
- return xnGetGlobalMirror(m_pContext);
- }
-
- /**
- * @copybrief xnGetGlobalErrorState
- * For full details and usage, see @ref xnGetGlobalErrorState
- */
- inline XnStatus GetGlobalErrorState()
- {
- return xnGetGlobalErrorState(m_pContext);
- }
-
- /**
- * @brief Registers an event handler for the 'Global Error State Change' event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToErrorStateChange(XnErrorStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return xnRegisterToGlobalErrorStateChange(m_pContext, handler, pCookie, &hCallback);
- }
-
- /**
- * @brief Unregisters an event handler for the 'Global Error State Change' event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events .
- */
- inline void UnregisterFromErrorStateChange(XnCallbackHandle hCallback)
- {
- xnUnregisterFromGlobalErrorStateChange(m_pContext, hCallback);
- }
-
- /**
- * @brief Registers an event handler for the 'Node Creation' event. see @ref context_node_creation_event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToNodeCreation(NodeCreationHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- NodeCreationCookie* pCreationCookie;
- XN_VALIDATE_ALLOC(pCreationCookie, NodeCreationCookie);
- pCreationCookie->pFunc = handler;
- pCreationCookie->pCookie = pCookie;
-
- nRetVal = xnRegisterToNodeCreation(m_pContext, NodeCreationCallback, pCreationCookie, &pCreationCookie->hUnderlyingCallback);
- XN_IS_STATUS_OK(nRetVal);
-
- hCallback = pCreationCookie;
-
- return XN_STATUS_OK;
- }
-
- /**
- * @brief Unregisters an event handler for the 'Node Creation' event. see @ref context_node_creation_event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events.
- */
- inline void UnregisterFromNodeCreation(XnCallbackHandle hCallback)
- {
- NodeCreationCookie* pCreationCookie = (NodeCreationCookie*)hCallback;
- xnUnregisterFromNodeCreation(m_pContext, pCreationCookie->hUnderlyingCallback);
- xnOSFree(pCreationCookie);
- }
-
- /**
- * @brief Registers an event handler for the 'Node Destruction' event. see @ref context_node_destruction_event.
- *
- * @param [in] handler Callback function to be invoked when the event is raised.
- * @param [in] pCookie User's cookie, to be delivered to the callback.
- * @param [out] hCallback Handle to the callback to be used for unregistering it.
- *
- * For full details and usage of the parameters, see @ref reg_to_events.
- */
- inline XnStatus RegisterToNodeDestruction(NodeDestructionHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- NodeDestructionCookie* pDestructionCookie;
- XN_VALIDATE_ALLOC(pDestructionCookie, NodeDestructionCookie);
- pDestructionCookie->pFunc = handler;
- pDestructionCookie->pCookie = pCookie;
-
- nRetVal = xnRegisterToNodeDestruction(m_pContext, NodeDestructionCallback, pDestructionCookie, &pDestructionCookie->hUnderlyingCallback);
- XN_IS_STATUS_OK(nRetVal);
-
- hCallback = pDestructionCookie;
-
- return XN_STATUS_OK;
- }
-
- /**
- * @brief Unregisters an event handler for the 'Node Destruction' event. see @ref context_node_destruction_event.
- *
- * @param [in] hCallback Handle received from registration.
- *
- * For full details and usage of the parameter, see @ref unreg_from_events.
- */
- inline void UnregisterFromNodeDestruction(XnCallbackHandle hCallback)
- {
- NodeDestructionCookie* pDestructionCookie = (NodeDestructionCookie*)hCallback;
- xnUnregisterFromNodeDestruction(m_pContext, pDestructionCookie->hUnderlyingCallback);
- xnOSFree(pDestructionCookie);
- }
-
- /**
- * @brief Updates all generator nodes in the context to their latest available data,
- * first waiting for all nodes to have new data available.
- *
- * <b>Remarks</b>
- *
- * This method requests from OpenNI to cause all nodes in the context's Production
- * Graph that have new data available to update their application buffers with the
- * new data, each node updating its own application buffer.
- *
- * Before OpenNI causes the data updates, it waits until @b all the nodes have notified
- * that they have new data available. On receiving all the 'new data available'
- * notifications, OpenNI then causes all nodes with new data available to update
- * their application buffers with their new data. At this stage the generator nodes
- * have "generated" new data. This method then stops waiting and returns a success
- * status. The application can now read the newly generated data.
- *
- * @note Using this method is not recommended for most applications since it requires
- * <i>all</i> the nodes to have new data. Consider instead using @ref WaitAnyUpdateAll()
- * or @ref WaitOneUpdateAll(). Typical applications use the WaitAnyUpdateAll()
- * method.
- *
- * An error situation is defined as: after a preset timeout, not all nodes have
- * yet notified OpenNI they have new data available. On error, the method stops
- * waiting and returns an error status. None of the nodes update their application
- * buffers.
- *
- * See @ref conc_updating_data__summary_of_wait_fns for an overview to the @ref
- * conc_updating_data "'WaitXUpdateAll'" methods and how to read the data from the
- * nodes.
- *
- * @retval XN_STATUS_WAIT_DATA_TIMEOUT No new data available within 2 seconds.
- */
- inline XnStatus WaitAndUpdateAll()
- {
- return xnWaitAndUpdateAll(m_pContext);
- }
-
- /**
- * @brief Updates all generator nodes in the context to their latest available data,
- * first waiting for any of the nodes to have new data available.
- *
- * @note Typical applications use this method. Consider using this method for your
- * application.
- *
- * <b>Remarks</b>
- *
- * This method requests from OpenNI to cause all nodes with new data available in
- * the context's Production Graph to update their application buffers with the new
- * data, each node updating its own application buffer.
- *
- * Before OpenNI causes the data updates, it waits for any of the nodes to have
- * notified that it has new data available. On receiving a 'new data available'
- * notification, OpenNI then causes all nodes with new data available to update
- * their application buffers with their new data. At this stage the generator nodes
- * have "generated" new data. This method then stops waiting and returns a success
- * status. The application can now read the newly generated data.
- *
- * A node that does not have new data available does not update its application
- * buffer.
- *
- * An error situation is defined as: after a preset timeout, none of the nodes have
- * yet notified OpenNI they have new data available. On error, the method stops
- * waiting and returns an error status. None of the nodes update their application
- * buffers.
- *
- * See @ref conc_updating_data__summary_of_wait_fns for an overview to the @ref
- * conc_updating_data "'WaitXUpdateAll'" methods and how to read the data from the
- * nodes.
- *
- * @retval XN_STATUS_WAIT_DATA_TIMEOUT No new data available within 2 seconds.
- */
- inline XnStatus WaitAnyUpdateAll()
- {
- return xnWaitAnyUpdateAll(m_pContext);
- }
-
- /**
- * @brief Updates all generator nodes in the context to their latest available data, first waiting for a specified node to have new data available.
- *
- * <b>Remarks</b>
- *
- * This method requests from OpenNI to cause all nodes in the context's Production
- * Graph with new data available to update their application buffers with the new
- * data, each node updating its own application buffer.
- *
- * Before OpenNI causes the data updates, it waits for a specified node to notify
- * that it has new data available. On receiving the 'new data available' notification,
- * OpenNI then causes all nodes with new data available to update their application
- * buffers with their new data. At this stage the generator nodes have "generated"
- * new data. This method then stops waiting and returns a success status. The application
- * can now read the newly generated data.
- *
- * A node that does not have new data available does not update its application
- * buffer.
- *
- * An error situation is defined as: after a preset timeout, none of the nodes have
- * yet notified OpenNI they have has new data available. On error, the method stops
- * waiting and returns an error status. None of the nodes update their application
- * buffers.
- *
- * See @ref conc_updating_data__summary_of_wait_fns for an overview to the @ref
- * conc_updating_data "'WaitXUpdateAll'" methods and how to read the data from the
- * nodes.
- *
- * @retval XN_STATUS_WAIT_DATA_TIMEOUT No new data available within 2 seconds.
- */
- inline XnStatus WaitOneUpdateAll(ProductionNode& node)
- {
- return xnWaitOneUpdateAll(m_pContext, node.GetHandle());
- }
-
- /**
- * @brief Immediately updates all generator nodes in the context to their latest available data, without waiting for notification that any node has new data available.
- *
- * <b>Remarks</b>
- *
- * This method requests from OpenNI to cause all nodes in the context's Production
- * Graph with new data available to update their application buffers with the new
- * data, each node updating its own application buffer.
- *
- * OpenNI causes all nodes with new data available to update their application buffers
- * with their new data. At this stage the generator nodes have "generated" new data.
- * This method returns a success status. The application can now read the newly
- * generated data.
- *
- * A node that does not have new data available does not update its application
- * buffer.
- *
- * See @ref conc_updating_data__summary_of_wait_fns for an overview to the @ref
- * conc_updating_data "'WaitXUpdateAll'" methods and how to read the data from the
- * nodes.
- */
- inline XnStatus WaitNoneUpdateAll()
- {
- return xnWaitNoneUpdateAll(m_pContext);
- }
-
- /**
- * @copybrief xnAutoEnumerateOverSingleInput
- * For full details and usage, see @ref xnAutoEnumerateOverSingleInput
- */
- inline XnStatus AutoEnumerateOverSingleInput(NodeInfoList& List, XnProductionNodeDescription& description, const XnChar* strCreationInfo, XnProductionNodeType InputType, EnumerationErrors* pErrors, Query* pQuery = NULL) const
- {
- return xnAutoEnumerateOverSingleInput(m_pContext, List.GetUnderlyingObject(), &description, strCreationInfo, InputType, pErrors == NULL ? NULL : pErrors->GetUnderlying(), pQuery == NULL ? NULL : pQuery->GetUnderlyingObject());
- }
-
- /**
- * Replaces the underlying C object pointed to by this object.
- */
- inline void SetHandle(XnContext* pContext)
- {
- if (m_pContext == pContext)
- {
- return;
- }
-
- if (m_pContext != NULL)
- {
- if (m_bUsingDeprecatedAPI && m_bAllocated)
- {
- // Backwards compatibility: call shutdown instead of release, to make old programs get the
- // exact same behavior they used to have.
- xnForceShutdown(m_pContext);
- }
- else
- {
- xnContextUnregisterFromShutdown(m_pContext, m_hShuttingDownCallback);
- xnContextRelease(m_pContext);
- }
- }
-
- if (pContext != NULL)
- {
- XnStatus nRetVal = xnContextAddRef(pContext);
- XN_ASSERT(nRetVal == XN_STATUS_OK);
- XN_REFERENCE_VARIABLE(nRetVal);
-
- nRetVal = xnContextRegisterForShutdown(pContext, ContextShuttingDownCallback, this, &m_hShuttingDownCallback);
- XN_ASSERT(nRetVal == XN_STATUS_OK);
- }
-
- m_pContext = pContext;
- }
-
- inline void TakeOwnership(XnContext* pContext)
- {
- SetHandle(pContext);
-
- if (pContext != NULL)
- {
- xnContextRelease(pContext);
- }
- }
-
- /** @cond */
- inline XnStatus XN_API_DEPRECATED("Use other overload!") RunXmlScript(const XnChar* strScript, EnumerationErrors* pErrors = NULL)
- {
- m_bUsingDeprecatedAPI = TRUE;
- #pragma warning (push)
- #pragma warning (disable: XN_DEPRECATED_WARNING_IDS)
- return xnContextRunXmlScript(m_pContext, strScript, pErrors == NULL ? NULL : pErrors->GetUnderlying());
- #pragma warning (pop)
- }
-
- inline XnStatus XN_API_DEPRECATED("Use other overload!") RunXmlScriptFromFile(const XnChar* strFileName, EnumerationErrors* pErrors = NULL)
- {
- m_bUsingDeprecatedAPI = TRUE;
- #pragma warning (push)
- #pragma warning (disable: XN_DEPRECATED_WARNING_IDS)
- return xnContextRunXmlScriptFromFile(m_pContext, strFileName, pErrors == NULL ? NULL : pErrors->GetUnderlying());
- #pragma warning (pop)
- }
-
- inline XnStatus XN_API_DEPRECATED("Use other overload!") InitFromXmlFile(const XnChar* strFileName, EnumerationErrors* pErrors = NULL)
- {
- XnContext* pContext = NULL;
- m_bUsingDeprecatedAPI = TRUE;
-
- #pragma warning (push)
- #pragma warning (disable: XN_DEPRECATED_WARNING_IDS)
- XnStatus nRetVal = xnInitFromXmlFile(strFileName, &pContext, pErrors == NULL ? NULL : pErrors->GetUnderlying());
- #pragma warning (pop)
- XN_IS_STATUS_OK(nRetVal);
-
- TakeOwnership(pContext);
- m_bAllocated = TRUE;
-
- return (XN_STATUS_OK);
- }
-
- inline XnStatus XN_API_DEPRECATED("Use other overload!") OpenFileRecording(const XnChar* strFileName)
- {
- m_bUsingDeprecatedAPI = TRUE;
- #pragma warning (push)
- #pragma warning (disable: XN_DEPRECATED_WARNING_IDS)
- return xnContextOpenFileRecording(m_pContext, strFileName);
- #pragma warning (pop)
- }
-
- inline void XN_API_DEPRECATED("You may use Release() instead, or count on dtor") Shutdown()
- {
- if (m_pContext != NULL)
- {
- #pragma warning (push)
- #pragma warning (disable: XN_DEPRECATED_WARNING_IDS)
- xnShutdown(m_pContext);
- #pragma warning (pop)
- m_pContext = NULL;
- }
- }
-
- XnStatus XN_API_DEPRECATED("Please use other overload") CreateProductionTree(NodeInfo& Tree)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnNodeHandle hNode;
- nRetVal = xnCreateProductionTree(m_pContext, Tree, &hNode);
- XN_IS_STATUS_OK(nRetVal);
-
- Tree.m_bOwnerOfNode = TRUE;
-
- return (XN_STATUS_OK);
- }
- /** @endcond */
-
- private:
- typedef struct NodeCreationCookie
- {
- NodeCreationHandler pFunc;
- void* pCookie;
- XnCallbackHandle hUnderlyingCallback;
- } NodeCreationCookie;
-
- typedef struct NodeDestructionCookie
- {
- NodeDestructionHandler pFunc;
- void* pCookie;
- XnCallbackHandle hUnderlyingCallback;
- } NodeDestructionCookie;
-
- static void XN_CALLBACK_TYPE NodeCreationCallback(XnContext* pContext, XnNodeHandle hCreatedNode, void* pCookie)
- {
- NodeCreationCookie* pNodeCreationCookie = (NodeCreationCookie*)pCookie;
- Context context(pContext);
- ProductionNode createdNode(hCreatedNode);
- pNodeCreationCookie->pFunc(context, createdNode, pNodeCreationCookie->pCookie);
- }
-
- static void XN_CALLBACK_TYPE NodeDestructionCallback(XnContext* pContext, const XnChar* strDestroyedNodeName, void* pCookie)
- {
- NodeDestructionCookie* pNodeCreationCookie = (NodeDestructionCookie*)pCookie;
- Context context(pContext);
- pNodeCreationCookie->pFunc(context, strDestroyedNodeName, pNodeCreationCookie->pCookie);
- }
-
- static void XN_CALLBACK_TYPE ContextShuttingDownCallback(XnContext* /*pContext*/, void* pCookie)
- {
- Context* pThis = (Context*)pCookie;
- pThis->m_pContext = NULL;
- }
-
- XnContext* m_pContext;
- XnBool m_bUsingDeprecatedAPI;
- XnBool m_bAllocated;
- XnCallbackHandle m_hShuttingDownCallback;
- };
-
- /**
- * @ingroup cppref_misc
- * A utility class for resolution info
- */
- class Resolution
- {
- public:
- /**
- * Creates a @ref Resolution object.
- *
- * @param [in] res Resolution
- */
- inline Resolution(XnResolution res) : m_Res(res)
- {
- m_nXRes = xnResolutionGetXRes(res);
- m_nYRes = xnResolutionGetYRes(res);
- m_strName = xnResolutionGetName(res);
- }
-
- /**
- * Creates a @ref Resolution object out of X and Y resolutions.
- *
- * @param [in] xRes X resolution
- * @param [in] yRes Y resolution
- */
- inline Resolution(XnUInt32 xRes, XnUInt32 yRes) : m_nXRes(xRes), m_nYRes(yRes)
- {
- m_Res = xnResolutionGetFromXYRes(xRes, yRes);
- m_strName = xnResolutionGetName(m_Res);
- }
-
- /**
- * Creates a @ref Resolution object out of its name
- *
- * @param [in] strName name of the resolution
- */
- inline Resolution(const XnChar* strName)
- {
- m_Res = xnResolutionGetFromName(strName);
- m_nXRes = xnResolutionGetXRes(m_Res);
- m_nYRes = xnResolutionGetYRes(m_Res);
- m_strName = xnResolutionGetName(m_Res);
- }
-
- /**
- * Gets the resolution
- */
- inline XnResolution GetResolution() const { return m_Res; }
- /**
- * Gets the X resolution
- */
- inline XnUInt32 GetXResolution() const { return m_nXRes; }
- /**
- * Gets the Y resolution
- */
- inline XnUInt32 GetYResolution() const { return m_nYRes; }
- /**
- * Gets the name of the resolution
- */
- inline const XnChar* GetName() const { return m_strName; }
-
- private:
- XnResolution m_Res;
- XnUInt32 m_nXRes;
- XnUInt32 m_nYRes;
- const XnChar* m_strName;
- };
-
- //---------------------------------------------------------------------------
- // Functions Implementation
- //---------------------------------------------------------------------------
- inline XnStatus NodeInfoList::FilterList(Context& context, Query& query)
- {
- return xnNodeQueryFilterList(context.GetUnderlyingObject(), query.GetUnderlyingObject(), m_pList);
- }
-
- inline void ProductionNode::GetContext(Context& context) const
- {
- context.TakeOwnership(xnGetRefContextFromNodeHandle(GetHandle()));
- }
-
- inline Context ProductionNode::GetContext() const
- {
- XnContext* pContext = xnGetRefContextFromNodeHandle(GetHandle());
- Context result(pContext);
- xnContextRelease(pContext);
- return result;
- }
-
- inline NodeInfoList& NodeInfo::GetNeededNodes() const
- {
- if (m_pNeededNodes == NULL)
- {
- XnNodeInfoList* pList = xnNodeInfoGetNeededNodes(m_pInfo);
- m_pNeededNodes = XN_NEW(NodeInfoList, pList);
- }
-
- return *m_pNeededNodes;
- }
-
- inline void NodeInfo::SetUnderlyingObject(XnNodeInfo* pInfo)
- {
- if (m_pNeededNodes != NULL)
- {
- XN_DELETE(m_pNeededNodes);
- }
-
- m_bOwnerOfNode = FALSE;
- m_pInfo = pInfo;
- m_pNeededNodes = NULL;
- }
-
- inline XnBool FrameSyncCapability::CanFrameSyncWith(Generator& other) const
- {
- return xnCanFrameSyncWith(GetHandle(), other.GetHandle());
- }
-
- inline XnStatus FrameSyncCapability::FrameSyncWith(Generator& other)
- {
- return xnFrameSyncWith(GetHandle(), other.GetHandle());
- }
-
- inline XnStatus FrameSyncCapability::StopFrameSyncWith(Generator& other)
- {
- return xnStopFrameSyncWith(GetHandle(), other.GetHandle());
- }
-
- inline XnBool FrameSyncCapability::IsFrameSyncedWith(Generator& other) const
- {
- return xnIsFrameSyncedWith(GetHandle(), other.GetHandle());
- }
-
- inline XnStatus NodeInfo::GetInstance(ProductionNode& node) const
- {
- if (m_pInfo == NULL)
- {
- return XN_STATUS_INVALID_OPERATION;
- }
-
- XnNodeHandle hNode = xnNodeInfoGetRefHandle(m_pInfo);
- node.TakeOwnership(hNode);
-
- if (m_bOwnerOfNode)
- {
- xnProductionNodeRelease(hNode);
- }
-
- return (XN_STATUS_OK);
- }
-
- //---------------------------------------------------------------------------
- // Node creation functions
- //---------------------------------------------------------------------------
-
- inline XnStatus Device::Create(Context& context, Query* pQuery/*=NULL*/, EnumerationErrors* pErrors/*=NULL*/)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateDevice(context.GetUnderlyingObject(), &hNode, pQuery == NULL ? NULL : pQuery->GetUnderlyingObject(), pErrors == NULL ? NULL : pErrors->GetUnderlying());
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus Recorder::Create(Context& context, const XnChar* strFormatName /*= NULL*/)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateRecorder(context.GetUnderlyingObject(), strFormatName, &hNode);
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus Player::Create(Context& context, const XnChar* strFormatName)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreatePlayer(context.GetUnderlyingObject(), strFormatName, &hNode);
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus DepthGenerator::Create(Context& context, Query* pQuery/*=NULL*/, EnumerationErrors* pErrors/*=NULL*/)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateDepthGenerator(context.GetUnderlyingObject(), &hNode, pQuery == NULL ? NULL : pQuery->GetUnderlyingObject(), pErrors == NULL ? NULL : pErrors->GetUnderlying());
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus MockDepthGenerator::Create(Context& context, const XnChar* strName /* = NULL */)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateMockNode(context.GetUnderlyingObject(), XN_NODE_TYPE_DEPTH, strName, &hNode);
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus MockDepthGenerator::CreateBasedOn(DepthGenerator& other, const XnChar* strName /* = NULL */)
- {
- Context context;
- other.GetContext(context);
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateMockNodeBasedOn(context.GetUnderlyingObject(), other.GetHandle(), strName, &hNode);
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus ImageGenerator::Create(Context& context, Query* pQuery/*=NULL*/, EnumerationErrors* pErrors/*=NULL*/)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateImageGenerator(context.GetUnderlyingObject(), &hNode, pQuery == NULL ? NULL : pQuery->GetUnderlyingObject(), pErrors == NULL ? NULL : pErrors->GetUnderlying());
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus MockImageGenerator::Create(Context& context, const XnChar* strName /* = NULL */)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateMockNode(context.GetUnderlyingObject(), XN_NODE_TYPE_IMAGE, strName, &hNode);
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus MockImageGenerator::CreateBasedOn(ImageGenerator& other, const XnChar* strName /* = NULL */)
- {
- Context context;
- other.GetContext(context);
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateMockNodeBasedOn(context.GetUnderlyingObject(), other.GetHandle(), strName, &hNode);
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus IRGenerator::Create(Context& context, Query* pQuery/*=NULL*/, EnumerationErrors* pErrors/*=NULL*/)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateIRGenerator(context.GetUnderlyingObject(), &hNode, pQuery == NULL ? NULL : pQuery->GetUnderlyingObject(), pErrors == NULL ? NULL : pErrors->GetUnderlying());
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus MockIRGenerator::Create(Context& context, const XnChar* strName /* = NULL */)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateMockNode(context.GetUnderlyingObject(), XN_NODE_TYPE_IR, strName, &hNode);
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus MockIRGenerator::CreateBasedOn(IRGenerator& other, const XnChar* strName /* = NULL */)
- {
- Context context;
- other.GetContext(context);
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateMockNodeBasedOn(context.GetUnderlyingObject(), other.GetHandle(), strName, &hNode);
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus GestureGenerator::Create(Context& context, Query* pQuery/*=NULL*/, EnumerationErrors* pErrors/*=NULL*/)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateGestureGenerator(context.GetUnderlyingObject(), &hNode, pQuery == NULL ? NULL : pQuery->GetUnderlyingObject(), pErrors == NULL ? NULL : pErrors->GetUnderlying());
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus SceneAnalyzer::Create(Context& context, Query* pQuery/*=NULL*/, EnumerationErrors* pErrors/*=NULL*/)
- {
- //You're creating a scene!
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateSceneAnalyzer(context.GetUnderlyingObject(), &hNode, pQuery == NULL ? NULL : pQuery->GetUnderlyingObject(), pErrors == NULL ? NULL : pErrors->GetUnderlying());
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus HandsGenerator::Create(Context& context, Query* pQuery/*=NULL*/, EnumerationErrors* pErrors/*=NULL*/)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateHandsGenerator(context.GetUnderlyingObject(), &hNode, pQuery == NULL ? NULL : pQuery->GetUnderlyingObject(), pErrors == NULL ? NULL : pErrors->GetUnderlying());
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus UserGenerator::Create(Context& context, Query* pQuery/*=NULL*/, EnumerationErrors* pErrors/*=NULL*/)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateUserGenerator(context.GetUnderlyingObject(), &hNode, pQuery == NULL ? NULL : pQuery->GetUnderlyingObject(), pErrors == NULL ? NULL : pErrors->GetUnderlying());
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus AudioGenerator::Create(Context& context, Query* pQuery/*=NULL*/, EnumerationErrors* pErrors/*=NULL*/)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateAudioGenerator(context.GetUnderlyingObject(), &hNode, pQuery == NULL ? NULL : pQuery->GetUnderlyingObject(), pErrors == NULL ? NULL : pErrors->GetUnderlying());
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus MockAudioGenerator::Create(Context& context, const XnChar* strName /* = NULL */)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateMockNode(context.GetUnderlyingObject(), XN_NODE_TYPE_AUDIO, strName, &hNode);
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus MockAudioGenerator::CreateBasedOn(AudioGenerator& other, const XnChar* strName /* = NULL */)
- {
- Context context;
- other.GetContext(context);
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateMockNodeBasedOn(context.GetUnderlyingObject(), other.GetHandle(), strName, &hNode);
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus MockRawGenerator::Create(Context& context, const XnChar* strName /*= NULL*/)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateMockNode(context.GetUnderlyingObject(), XN_NODE_TYPE_GENERATOR, strName, &hNode);
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus Codec::Create(Context& context, XnCodecID codecID, ProductionNode& initializerNode)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateCodec(context.GetUnderlyingObject(), codecID, initializerNode.GetHandle(), &hNode);
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- inline XnStatus ScriptNode::Run(EnumerationErrors* pErrors)
- {
- return xnScriptNodeRun(GetHandle(), pErrors == NULL ? NULL : pErrors->GetUnderlying());
- }
-
- inline XnStatus ScriptNode::Create(Context& context, const XnChar* strFormat)
- {
- XnNodeHandle hNode;
- XnStatus nRetVal = xnCreateScriptNode(context.GetUnderlyingObject(), strFormat, &hNode);
- XN_IS_STATUS_OK(nRetVal);
- TakeOwnership(hNode);
- return (XN_STATUS_OK);
- }
-
- //---------------------------------------------------------------------------
- // Global Helper Functions
- //---------------------------------------------------------------------------
-
- inline void XN_API_DEPRECATED("Use xn::Version::Current() instead") GetVersion(XnVersion& Version)
- {
- xnGetVersion(&Version);
- }
-
- //---------------------------------------------------------------------------
- // Internal Helper Classes and Functions
- //---------------------------------------------------------------------------
-
- class StateChangedCallbackTranslator
- {
- public:
- StateChangedCallbackTranslator(StateChangedHandler handler, void* pCookie) : m_UserHandler(handler), m_pUserCookie(pCookie), m_hCallback(NULL) {}
-
- XnStatus Register(_XnRegisterStateChangeFuncPtr xnFunc, XnNodeHandle hNode)
- {
- return xnFunc(hNode, StateChangedCallback, this, &m_hCallback);
- }
-
- void Unregister(_XnUnregisterStateChangeFuncPtr xnFunc, XnNodeHandle hNode)
- {
- xnFunc(hNode, m_hCallback);
- }
-
- static XnStatus RegisterToUnderlying(_XnRegisterStateChangeFuncPtr xnFunc, XnNodeHandle hNode, StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- StateChangedCallbackTranslator* pTrans;
- XN_VALIDATE_NEW(pTrans, StateChangedCallbackTranslator, handler, pCookie);
-
- nRetVal = pTrans->Register(xnFunc, hNode);
- if (nRetVal != XN_STATUS_OK)
- {
- XN_DELETE(pTrans);
- return (nRetVal);
- }
-
- hCallback = pTrans;
-
- return (XN_STATUS_OK);
- }
-
- static XnStatus UnregisterFromUnderlying(_XnUnregisterStateChangeFuncPtr xnFunc, XnNodeHandle hNode, XnCallbackHandle hCallback)
- {
- StateChangedCallbackTranslator* pTrans = (StateChangedCallbackTranslator*)hCallback;
- pTrans->Unregister(xnFunc, hNode);
- XN_DELETE(pTrans);
- return XN_STATUS_OK;
- }
-
- private:
- friend class GeneralIntCapability;
-
- typedef struct StateChangeCookie
- {
- StateChangedHandler userHandler;
- void* pUserCookie;
- XnCallbackHandle hCallback;
- } StateChangeCookie;
-
- static void XN_CALLBACK_TYPE StateChangedCallback(XnNodeHandle hNode, void* pCookie)
- {
- StateChangedCallbackTranslator* pTrans = (StateChangedCallbackTranslator*)pCookie;
- ProductionNode node(hNode);
- pTrans->m_UserHandler(node, pTrans->m_pUserCookie);
- }
-
- StateChangedHandler m_UserHandler;
- void* m_pUserCookie;
- XnCallbackHandle m_hCallback;
- };
-
- static XnStatus _RegisterToStateChange(_XnRegisterStateChangeFuncPtr xnFunc, XnNodeHandle hNode, StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- return StateChangedCallbackTranslator::RegisterToUnderlying(xnFunc, hNode, handler, pCookie, hCallback);
- }
-
- static void _UnregisterFromStateChange(_XnUnregisterStateChangeFuncPtr xnFunc, XnNodeHandle hNode, XnCallbackHandle hCallback)
- {
- StateChangedCallbackTranslator::UnregisterFromUnderlying(xnFunc, hNode, hCallback);
- }
-
- inline XnStatus GeneralIntCapability::RegisterToValueChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- StateChangedCallbackTranslator* pTrans;
- XN_VALIDATE_NEW(pTrans, StateChangedCallbackTranslator, handler, pCookie);
-
- nRetVal = xnRegisterToGeneralIntValueChange(GetHandle(), m_strCap, pTrans->StateChangedCallback, pTrans, &pTrans->m_hCallback);
- if (nRetVal != XN_STATUS_OK)
- {
- XN_DELETE(pTrans);
- return (nRetVal);
- }
-
- hCallback = pTrans;
-
- return (XN_STATUS_OK);
- }
-
- inline void GeneralIntCapability::UnregisterFromValueChange(XnCallbackHandle hCallback)
- {
- StateChangedCallbackTranslator* pTrans = (StateChangedCallbackTranslator*)hCallback;
- xnUnregisterFromGeneralIntValueChange(GetHandle(), m_strCap, pTrans->m_hCallback);
- XN_DELETE(pTrans);
- }
-};
-
-#endif // __XN_CPP_WRAPPER_H__
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCyclicQueueT.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCyclicQueueT.h
deleted file mode 100644
index 6e323d3f..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCyclicQueueT.h
+++ /dev/null
@@ -1,79 +0,0 @@
-#ifndef _XN_CYCLIC_QUEUE_T_H_
-#define _XN_CYCLIC_QUEUE_T_H_
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include "XnQueueT.h"
-
-//---------------------------------------------------------------------------
-// Code
-//---------------------------------------------------------------------------
-
-template<class T, XnUInt32 TDefaultMaxDepth, class TAlloc = XnLinkedNodeDefaultAllocatorT<T> >
-class XnCyclicQueueT : protected XnQueueT<T, TAlloc>
-{
-public:
- typedef XnQueueT<T, TAlloc> Base;
-
- XnCyclicQueueT(XnUInt32 nMaxDepth = TDefaultMaxDepth) : Base(), m_nMaxDepth(nMaxDepth) {}
-
- XnCyclicQueueT(const XnCyclicQueueT& other) : Base(other)
- {
- *this = other;
- }
-
- XnCyclicQueueT& operator=(const XnCyclicQueueT& other)
- {
- Base::operator=(other);
- m_nMaxDepth = other.m_nMaxDepth;
- return *this;
- }
-
- ~XnCyclicQueueT() {}
-
- using Base::ConstIterator;
- using Base::IsEmpty;
- using Base::Size;
-
- XnStatus SetMaxSize(XnUInt32 nMaxSize)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- while (Size() > nMaxSize)
- {
- nRetVal = Remove(this->Begin());
- XN_IS_STATUS_OK(nRetVal);
- }
-
- m_nMaxDepth = nMaxSize;
-
- return (XN_STATUS_OK);
- }
-
- XnStatus Push(T const& value)
- {
- XnStatus nRetVal = XN_STATUS_OK;
- if (Size() == m_nMaxDepth)
- {
- nRetVal = Remove(this->Begin());
- XN_IS_STATUS_OK(nRetVal);
- }
-
- nRetVal = Base::Push(value);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
- }
-
- using Base::Pop;
- using Base::Top;
- using Base::Begin;
- using Base::End;
-
-protected:
- XnUInt32 m_nMaxDepth;
-};
-
-
-#endif // _XN_CYCLIC_QUEUE_T_H_ \ No newline at end of file
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCyclicStackT.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCyclicStackT.h
deleted file mode 100644
index 39d8ebca..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnCyclicStackT.h
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef _XN_CYCLIC_STACK_T_H_
-#define _XN_CYCLIC_STACK_T_H_
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include "XnStackT.h"
-
-//---------------------------------------------------------------------------
-// Code
-//---------------------------------------------------------------------------
-
-template<class T, XnUInt32 TDefaultMaxDepth, class TAlloc = XnLinkedNodeDefaultAllocatorT<T> >
-class XnCyclicStackT : protected XnStackT<T, TAlloc>
-{
-public:
- typedef XnStackT<T, TAlloc> Base;
-
- XnCyclicStackT(XnUInt32 nMaxDepth = TDefaultMaxDepth) : Base(), m_nMaxDepth(nMaxDepth) {}
-
- XnCyclicStackT(const XnCyclicStackT& other) : Base(other)
- {
- *this = other;
- }
-
- XnCyclicStackT& operator=(const XnCyclicStackT& other)
- {
- Base::operator=(other);
- m_nMaxDepth = other.m_nMaxDepth;
- return *this;
- }
-
- ~XnCyclicStackT() {}
-
- using typename Base::ConstIterator;
- using Base::Remove;
- using Base::IsEmpty;
- using Base::Size;
-
- XnStatus SetMaxSize(XnUInt32 nMaxSize)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- while (Size() > nMaxSize)
- {
- nRetVal = Remove(this->ReverseBegin());
- XN_IS_STATUS_OK(nRetVal);
- }
-
- m_nMaxDepth = nMaxSize;
-
- return (XN_STATUS_OK);
- }
-
- XnStatus Push(T const& value)
- {
- XnStatus nRetVal = XN_STATUS_OK;
- if (Size() == m_nMaxDepth)
- {
- nRetVal = Remove(this->ReverseBegin());
- XN_IS_STATUS_OK(nRetVal);
- }
-
- nRetVal = Base::Push(value);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
- }
-
- using Base::Pop;
- using Base::Top;
- using Base::Begin;
- using Base::End;
-
-protected:
- XnUInt32 m_nMaxDepth;
-};
-
-
-#endif // _XN_CYCLIC_STACK_T_H_
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDataTypes.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDataTypes.h
deleted file mode 100644
index fcc3296c..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDataTypes.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef _XN_DATA_TYPES_H_
-#define _XN_DATA_TYPES_H_
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include "XnOS.h"
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-/**
- * The value type for all general data structures
- */
-typedef void* XnValue;
-
-/**
- * Declares a translator from @a Type to XnValue, with a name @a ClassName. The class is declared
- * with the @a decl declspec.
- */
-#define XN_DECLARE_DEFAULT_VALUE_TRANSLATOR_DECL(decl, Type, ClassName) \
- class decl ClassName \
- { \
- public: \
- XN_PRAGMA_START_DISABLED_WARNING_SECTION(XN_CONDITION_IS_CONST_WARNING_ID) \
- \
- static XnValue CreateValueCopy(Type const& orig) \
- { \
- if (sizeof(Type) > sizeof(XnValue)) \
- { \
- Type* pNew = XN_NEW(Type, orig); \
- return (XnValue)pNew; \
- } \
- else \
- { \
- XnValue result = 0; \
- xnOSMemCopy(&result, &orig, sizeof(Type)); \
- return result; \
- } \
- } \
- static void FreeValue(XnValue& Value) \
- { \
- if (sizeof(Type) > sizeof(XnValue)) \
- { \
- Type* p = (Type*)Value; \
- XN_DELETE(p); \
- } \
- } \
- static XnValue GetAsValue(Type const& orig) \
- { \
- if (sizeof(Type) > sizeof(XnValue)) \
- { \
- return (XnValue)&orig; \
- } \
- else \
- { \
- XnValue result = 0; \
- xnOSMemCopy(&result, &orig, sizeof(Type)); \
- return result; \
- } \
- } \
- static Type const& GetFromValue(const XnValue& Value) \
- { \
- if (sizeof(Type) > sizeof(XnValue)) \
- { \
- Type const* p = (Type const*)Value; \
- return *p; \
- } \
- else \
- { \
- Type const* p = (Type const*)&Value; \
- return *p; \
- } \
- } \
- static Type& GetFromValue(XnValue& Value) \
- { \
- if (sizeof(Type) > sizeof(XnValue)) \
- { \
- Type* p = (Type*)Value; \
- return *p; \
- } \
- else \
- { \
- Type* p = (Type*)&Value; \
- return *p; \
- } \
- } \
- XN_PRAGMA_STOP_DISABLED_WARNING_SECTION \
- };
-
-/**
- * Declares a translator from @a Type to XnValue, with a name @a ClassName.
- */
-#define XN_DECLARE_DEFAULT_VALUE_TRANSLATOR(Type, ClassName) \
- XN_DECLARE_DEFAULT_VALUE_TRANSLATOR_DECL(, Type, ClassName)
-
-#define XN_DEFAULT_TRANSLATOR_NAME(ClassName) ClassName ## Translator
-
-#endif // _XN_DATA_TYPES_H_
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDerivedCast.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDerivedCast.h
deleted file mode 100644
index 7b11ee17..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDerivedCast.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-/****************************************************************************
-* *
-* OpenNI 1.1 Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/\
-
-#ifndef __XN_DERIVED_CAST_H__
-#define __XN_DERIVED_CAST_H__
-
-// derived_cast Acts as dynamic_cast without the need for RTTI. used in platforms that not implement RTTI well like Linux-Arm.
-template<class T>
-static T derived_cast(ModuleProductionNode* pPrdNode);
-
-#define DERIVED_CAST_IMPL(T, enm) \
- template<> \
- T* derived_cast<T*>(ModuleProductionNode* pPrdNode) \
- { \
- return (T*)pPrdNode->m_aInterfaces[enm]; \
- }
-
-DERIVED_CAST_IMPL(ModuleDevice, XN_NODE_TYPE_DEVICE)
-DERIVED_CAST_IMPL(ModuleRecorder, XN_NODE_TYPE_RECORDER)
-DERIVED_CAST_IMPL(ModulePlayer, XN_NODE_TYPE_PLAYER)
-DERIVED_CAST_IMPL(ModuleCodec, XN_NODE_TYPE_CODEC)
-DERIVED_CAST_IMPL(ModuleScriptNode, XN_NODE_TYPE_SCRIPT)
-DERIVED_CAST_IMPL(ModuleGenerator, XN_NODE_TYPE_GENERATOR)
-DERIVED_CAST_IMPL(ModuleUserGenerator, XN_NODE_TYPE_USER)
-DERIVED_CAST_IMPL(ModuleHandsGenerator, XN_NODE_TYPE_HANDS)
-DERIVED_CAST_IMPL(ModuleGestureGenerator, XN_NODE_TYPE_GESTURE)
-DERIVED_CAST_IMPL(ModuleAudioGenerator, XN_NODE_TYPE_AUDIO)
-DERIVED_CAST_IMPL(ModuleMapGenerator, XN_NODE_TYPE_MAP_GENERATOR)
-DERIVED_CAST_IMPL(ModuleDepthGenerator, XN_NODE_TYPE_DEPTH)
-DERIVED_CAST_IMPL(ModuleImageGenerator, XN_NODE_TYPE_IMAGE)
-DERIVED_CAST_IMPL(ModuleIRGenerator, XN_NODE_TYPE_IR)
-DERIVED_CAST_IMPL(ModuleSceneAnalyzer, XN_NODE_TYPE_SCENE)
-
-#ifdef dynamic_cast
-#undef dynamic_cast
-#endif
-
-#define dynamic_cast derived_cast
-
-#endif
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDump.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDump.h
deleted file mode 100644
index d0423c68..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDump.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef __XN_DUMP_H__
-#define __XN_DUMP_H__
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include "XnPlatform.h"
-#include "XnStatus.h"
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-struct XnDumpFile;
-typedef struct XnDumpFile XnDumpFile;
-
-//---------------------------------------------------------------------------
-// Functions
-//---------------------------------------------------------------------------
-
-/**
-* Configures if a specific dump mask is enabled.
-*
-* @param strMask [in] The mask to set.
-* @param bEnabled [in] TRUE to enable this dump, FALSE otherwise.
-*/
-XN_C_API XnStatus XN_C_DECL xnDumpSetMaskState(const XnChar* strMask, XnBool bEnabled);
-
-/**
-* This function checks if a dump mask is enabled
-*
-* @param strDumpMask [in] The mask that should be checked.
-*/
-XN_C_API XnBool XN_C_DECL xnLogIsDumpMaskEnabled(const XnChar* strDumpMask);
-
-/**
-* Opens a file for writing dump.
-*
-* @param strDumpName [in] Name of the dump mask this file belongs to.
-* @param strNameFormat [in] A format string for the name of the file.
-*
-* @returns a file handle for writing data. The file should be closed using @ref xnDumpFileClose().
-*/
-XN_C_API XnDumpFile* XN_C_DECL xnDumpFileOpen(const XnChar* strDumpName, const XnChar* strNameFormat, ...);
-
-/**
-* Opens a file for writing dump using some advanced options.
-*
-* You would usually prefer to use @ref xnDumpFileOpen().
-*
-* @param strDumpName [in] Name of the dump mask this file belongs to.
-* @param bForce [in] When TRUE, file will be created even if dump is currently off.
-* @param bSessionDump [in] When TRUE, file will be created with current session timestamp as a prefix to its name.
-* @param strNameFormat [in] A format string for the name of the file.
-*
-* @returns a file handle for writing data. The file should be closed using @ref xnDumpFileClose().
-*/
-XN_C_API XnDumpFile* XN_C_DECL xnDumpFileOpenEx(const XnChar* strDumpName, XnBool bForce, XnBool bSessionDump, const XnChar* strNameFormat, ...);
-
-/**
-* Writes a buffer to a dump file.
-*
-* @param pFile [in] Dump file to write to. A pointer retrieved from @ref xnDumpFileOpen.
-* @param pBuffer [in] Data to be written to file.
-* @param nBufferSize [in] Size of the buffer.
-*/
-XN_C_API void XN_C_DECL _xnDumpFileWriteBuffer(XnDumpFile* pFile, const void* pBuffer, XnUInt32 nBufferSize);
-
-/**
-* Writes a formatted string to a dump file.
-*
-* @param pFile [in] Dump file to write to. A pointer retrieved from @ref xnDumpFileOpen.
-* @param strFormat [in] Format string.
-*
-* NOTE: the total length of the string must not exceed 8 KB. If it does, it will be truncated.
-*/
-XN_C_API void XN_C_DECL _xnDumpFileWriteString(XnDumpFile* pFile, const XnChar* strFormat, ...);
-
-/**
-* Closes a dump file.
-*
-* @param hFile [in] Dump file to close. A pointer retrieved from @ref xnDumpFileOpen.
-*/
-XN_C_API void XN_C_DECL _xnDumpFileClose(XnDumpFile* pFile);
-
-#define xnDumpFileWriteBuffer(pFile, pBuffer, nBufferSize) \
- if ((pFile) != NULL) \
- { \
- _xnDumpFileWriteBuffer(pFile, pBuffer, nBufferSize); \
- } \
-
-#define xnDumpFileClose(pFile) \
- if ((pFile) != NULL) \
- { \
- _xnDumpFileClose(pFile); \
- pFile = NULL; \
- } \
-
-#if XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_WIN32_VAARGS_STYLE
- #define xnDumpFileWriteString(pFile, strFormat, ...) \
- if ((pFile) != NULL) \
- { \
- _xnDumpFileWriteString(pFile, strFormat, __VA_ARGS__); \
- }
-#elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_GCC_VAARGS_STYLE
- #define xnDumpFileWriteString(pFile, strFormat, ...) \
- if ((pFile) != NULL) \
- { \
- _xnDumpFileWriteString(pFile, strFormat, ##__VA_ARGS__);\
- }
-#elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_ARC_VAARGS_STYLE
- #define xnDumpFileWriteString(pFile, strFormat, ...) \
- if ((pFile) != NULL) \
- { \
- _xnDumpFileWriteString(pFile, strFormat); \
- }
-#elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_NO_VAARGS
- #define xnDumpFileWriteString(pFile, strFormat, arg) \
- if ((pFile) != NULL) \
- { \
- _xnDumpFileWriteString(pFile, strFormat,arg); \
- }
-#else
- #error Xiron Log - Unknown VAARGS type!
-#endif
-
-
-//---------------------------------------------------------------------------
-// Backwards Compatibility Stuff
-//---------------------------------------------------------------------------
-
-#ifndef __XN_NO_BC__
-
-#include "XnOS.h"
-
-typedef struct XnDump
-{
- XN_FILE_HANDLE hFile;
-} XnDump;
-
-const XnDump XN_DUMP_CLOSED = { XN_INVALID_FILE_HANDLE };
-
-XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpInit(XnDump* pDump, const XnChar* csDumpMask, const XnChar* csHeader, const XnChar* csFileNameFormat, ...);
-XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpForceInit(XnDump* pDump, const XnChar* csHeader, const XnChar* csFileNameFormat, ...);
-XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpClose(XnDump* pDump);
-XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpWriteBufferImpl(XnDump dump, const void* pBuffer, XnUInt32 nBufferSize);
-XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpWriteStringImpl(XnDump dump, const XnChar* csFormat, ...);
-XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpFlush(XnDump dump);
-
-#define xnDumpWriteBuffer(dump, pBuffer, nBufferSize) \
- if (dump.hFile != XN_INVALID_FILE_HANDLE) \
- { \
- xnDumpWriteBufferImpl(dump, pBuffer, nBufferSize); \
- }
-
-#if XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_WIN32_VAARGS_STYLE
- #define xnDumpWriteString(dump, csFormat, ...) \
- if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
- xnDumpWriteStringImpl((dump), csFormat, __VA_ARGS__); \
- }
-#elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_GCC_VAARGS_STYLE
- #define xnDumpWriteString(dump, csFormat, ...) \
- if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
- xnDumpWriteStringImpl((dump), csFormat, ##__VA_ARGS__); \
- }
-#elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_ARC_VAARGS_STYLE
- #define xnDumpWriteString(dump, csFormat...) \
- if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
- xnDumpWriteStringImpl((dump), csFormat); \
- }
-#elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_NO_VAARGS
- #define xnDumpWriteString(dump, csFormat, arg) \
- if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
- xnDumpWriteStringImpl((dump), csFormat, arg); \
- }
-#else
- #error Xiron Log - Unknown VAARGS type!
-#endif
-
-#endif // #ifndef __XN_NO_BC__
-
-#endif // __XN_DUMP_H__ \ No newline at end of file
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDumpWriters.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDumpWriters.h
deleted file mode 100644
index 0a641dbb..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnDumpWriters.h
+++ /dev/null
@@ -1,127 +0,0 @@
-#ifndef __XN_DUMP_WRITERS_H__
-#define __XN_DUMP_WRITERS_H__
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include "XnDump.h"
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-typedef struct XnDumpWriterFileHandle
-{
- void* pInternal;
-} XnDumpWriterFileHandle;
-
-typedef struct XnDumpWriter
-{
- void* pCookie;
- XnDumpWriterFileHandle (XN_CALLBACK_TYPE* OpenFile)(void* pCookie, const XnChar* strDumpName, XnBool bSessionDump, const XnChar* strFileName);
- void (XN_CALLBACK_TYPE* Write)(void* pCookie, XnDumpWriterFileHandle hFile, const void* pBuffer, XnUInt32 nBufferSize);
- void (XN_CALLBACK_TYPE* CloseFile)(void* pCookie, XnDumpWriterFileHandle hFile);
-} XnDumpWriter;
-
-//---------------------------------------------------------------------------
-// Functions
-//---------------------------------------------------------------------------
-XN_C_API XnStatus XN_C_DECL xnDumpRegisterWriter(XnDumpWriter* pWriter);
-
-XN_C_API void XN_C_DECL xnDumpUnregisterWriter(XnDumpWriter* pWriter);
-
-XN_C_API XnStatus XN_C_DECL xnDumpSetFilesOutput(XnBool bOn);
-
-//---------------------------------------------------------------------------
-// Helpers
-//---------------------------------------------------------------------------
-#ifdef __cplusplus
-
-class XnDumpWriterBase
-{
-public:
- XnDumpWriterBase() : m_bRegistered(FALSE)
- {
- m_cObject.pCookie = this;
- m_cObject.OpenFile = OpenFileCallback;
- m_cObject.Write = WriteCallback;
- m_cObject.CloseFile = CloseFileCallback;
- }
-
- virtual ~XnDumpWriterBase()
- {
- Unregister();
- }
-
- XnStatus Register()
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- if (!m_bRegistered)
- {
- OnRegister();
-
- nRetVal = xnDumpRegisterWriter(&m_cObject);
- if (nRetVal != XN_STATUS_OK)
- {
- OnUnregister();
- return (nRetVal);
- }
-
- m_bRegistered = TRUE;
- }
-
- return (XN_STATUS_OK);
- }
-
- void Unregister()
- {
- if (m_bRegistered)
- {
- xnDumpUnregisterWriter(&m_cObject);
- m_bRegistered = FALSE;
-
- OnUnregister();
- }
- }
-
- inline XnBool IsRegistered() { return m_bRegistered; }
-
- virtual XnDumpWriterFileHandle OpenFile(const XnChar* strDumpName, XnBool bSessionDump, const XnChar* strFileName) = 0;
- virtual void Write(XnDumpWriterFileHandle hFile, const void* pBuffer, XnUInt32 nBufferSize) = 0;
- virtual void CloseFile(XnDumpWriterFileHandle hFile) = 0;
-
- operator const XnDumpWriter*() const
- {
- return &m_cObject;
- }
-
-protected:
- virtual void OnRegister() {}
- virtual void OnUnregister() {}
-
-private:
- static XnDumpWriterFileHandle XN_CALLBACK_TYPE OpenFileCallback(void* pCookie, const XnChar* strDumpName, XnBool bSessionDump, const XnChar* strFileName)
- {
- XnDumpWriterBase* pThis = (XnDumpWriterBase*)pCookie;
- return pThis->OpenFile(strDumpName, bSessionDump, strFileName);
- }
-
- static void XN_CALLBACK_TYPE WriteCallback(void* pCookie, XnDumpWriterFileHandle hFile, const void* pBuffer, XnUInt32 nBufferSize)
- {
- XnDumpWriterBase* pThis = (XnDumpWriterBase*)pCookie;
- return pThis->Write(hFile, pBuffer, nBufferSize);
- }
-
- static void XN_CALLBACK_TYPE CloseFileCallback(void* pCookie, XnDumpWriterFileHandle hFile)
- {
- XnDumpWriterBase* pThis = (XnDumpWriterBase*)pCookie;
- return pThis->CloseFile(hFile);
- }
-
- XnDumpWriter m_cObject;
- XnBool m_bRegistered;
-};
-
-#endif
-
-#endif // __XN_DUMP_WRITERS_H__ \ No newline at end of file
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnEnumerationErrors.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnEnumerationErrors.h
deleted file mode 100644
index 4a1d77ce..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnEnumerationErrors.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef __XN_ENUMERATION_ERRORS_H__
-#define __XN_ENUMERATION_ERRORS_H__
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <XnTypes.h>
-
-/**
- * @ingroup cref
- * @defgroup enum_errors Enumeration Errors
- * This page details functions for managing an Enumeration Errors object.
- *
- * @section enum Enumeration
- *
- * The following code iterates over an enumeration errors object:
- * @code
-for (XnEnumerationErrorsIterator it = xnEnumerationErrorsGetFirst(pList);
- xnEnumerationErrorsIteratorIsValid(it);
- it = xnEnumerationErrorsGetNext(it))
-{
- const XnProductionNodeDescription* pCurrDesc = xnEnumerationErrorsGetCurrentDescription(it);
- XnStatus nCurrError = xnEnumerationErrorsGetCurrentError(it);
- ...
-}
- * @endcode
- * @{
- */
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-/**
- * Represents an iterator for an @ref XnEnumerationErrors object.
- */
-typedef struct XnModuleError* XnEnumerationErrorsIterator;
-
-//---------------------------------------------------------------------------
-// Functions
-//---------------------------------------------------------------------------
-
-
-/**
- * Allocates an enumeration errors object.
- *
- * @param ppErrors [out] The allocated object
- */
-XN_C_API XnStatus XN_C_DECL xnEnumerationErrorsAllocate(XnEnumerationErrors** ppErrors);
-
-/**
- * Frees an enumeration errors object
- *
- * @param pErrors [in] Parameter description
- */
-XN_C_API void XN_C_DECL xnEnumerationErrorsFree(const XnEnumerationErrors* pErrors);
-
-/**
- * Adds an error to the object.
- *
- * @param pErrors [in] Enumeration Errors object.
- * @param pDesc [in] Description of the failing module.
- * @param nError [in] The enumeration error that occurred.
- */
-XN_C_API XnStatus XN_C_DECL xnEnumerationErrorsAdd(XnEnumerationErrors* pErrors, const XnProductionNodeDescription* pDesc, XnStatus nError);
-
-/**
- * Returns a string representation of the Enumeration Errors object.
- *
- * @param pErrors [in] Enumeration Errors object.
- * @param csBuffer [in] A char buffer to be filled.
- * @param nSize [in] Size of the char buffer.
- */
-XN_C_API XnStatus XN_C_DECL xnEnumerationErrorsToString(const XnEnumerationErrors* pErrors, XnChar* csBuffer, XnUInt32 nSize);
-
-/**
- * Clears an Enumeration Errors object from all errors in it.
- *
- * @param pErrors [in] Enumeration Errors object.
- */
-XN_C_API XnStatus XN_C_DECL xnEnumerationErrorsClear(XnEnumerationErrors* pErrors);
-
-/**
- * Gets an iterator to the first error in the object.
- *
- * @param pErrors [in] Enumeration Errors object.
- */
-XN_C_API XnEnumerationErrorsIterator XN_C_DECL xnEnumerationErrorsGetFirst(const XnEnumerationErrors* pErrors);
-
-/**
- * Gets an iterator to the next error in the object.
- *
- * @param it [in] An iterator to an error in the object.
- */
-XN_C_API XnEnumerationErrorsIterator XN_C_DECL xnEnumerationErrorsGetNext(XnEnumerationErrorsIterator it);
-
-/**
- * Checks if an iterator is valid (i.e. points to a real error)
- *
- * @param it [in] The iterator to check.
- */
-XN_C_API XnBool XN_C_DECL xnEnumerationErrorsIteratorIsValid(XnEnumerationErrorsIterator it);
-
-/**
- * Gets the description of the node from current error.
- *
- * @param it [in] The iterator to the error.
- */
-XN_C_API const XnProductionNodeDescription* XN_C_DECL xnEnumerationErrorsGetCurrentDescription(XnEnumerationErrorsIterator it);
-
-/**
- * Gets the enumeration error caused when enumerating the node.
- *
- * @param it [in] The iterator to the error.
- */
-XN_C_API XnStatus XN_C_DECL xnEnumerationErrorsGetCurrentError(XnEnumerationErrorsIterator it);
-
-/**
- * @}
- */
-
-#endif // __XN_ENUMERATION_ERRORS_H__
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnEvent.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnEvent.h
deleted file mode 100644
index f915b6aa..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnEvent.h
+++ /dev/null
@@ -1,301 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef __XN_EVENT_H__
-#define __XN_EVENT_H__
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include "XnCallback.h"
-#include "XnList.h"
-#include "XnTypes.h"
-#include "XnOSCpp.h"
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-class XnEventInterface
-{
-public:
- XnEventInterface() {}
- virtual ~XnEventInterface() {}
-
- typedef XnStatus (XN_CALLBACK_TYPE* HandlerPtr)(void* pCookie);
-
- virtual XnStatus Register(HandlerPtr pFunc, void* pCookie, XnCallbackHandle* pHandle = NULL) = 0;
- virtual XnStatus Unregister(XnCallbackHandle handle) = 0;
-};
-
-class XnEvent : public XnEventInterface
-{
-public:
- XnEvent() : m_hLock(0)
- {
- xnOSCreateCriticalSection(&m_hLock);
- }
-
- virtual ~XnEvent()
- {
- Clear();
- xnOSCloseCriticalSection(&m_hLock);
- }
-
- XnStatus Register(HandlerPtr pFunc, void* pCookie, XnCallbackHandle* pHandle)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XN_VALIDATE_INPUT_PTR(pFunc);
-
- XnCallback* pCallback = NULL;
- XN_VALIDATE_NEW(pCallback, XnCallback, (XnFuncPtr)pFunc, pCookie);
-
- // always add to list of added (actual list will be updated in Raise method, to allow registering
- // from a callback).
- {
- XnAutoCSLocker lock(m_hLock);
- nRetVal = m_ToBeAdded.AddLast(pCallback);
- }
-
- if (nRetVal != XN_STATUS_OK)
- {
- XN_DELETE(pCallback);
- return (nRetVal);
- }
-
- // return handle
- if (pHandle != NULL)
- {
- *pHandle = pCallback;
- }
-
- return XN_STATUS_OK;
- }
-
- XnStatus Unregister(XnCallbackHandle handle)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XnCallback* pObject = (XnCallback*)handle;
-
- // add it to a temp list, to allow unregistering from a callback (actual list will be updated in raise
- // function).
- {
- XnAutoCSLocker lock(m_hLock);
-
- // try to remove it from the ToBeAdded list.
- if (!RemoveCallback(m_ToBeAdded, pObject))
- {
- // it's not in this list, so it's probably in the main list
- nRetVal = m_ToBeRemoved.AddLast(pObject);
- }
- }
- XN_IS_STATUS_OK(nRetVal);
-
- return XN_STATUS_OK;
- }
-
- XnStatus Clear()
- {
- ApplyListChanges();
-
- for (XnCallbackPtrList::ConstIterator it = m_Handlers.begin(); it != m_Handlers.end(); ++it)
- {
- XnCallback* pCallback = *it;
- XN_DELETE(pCallback);
- }
-
- m_Handlers.Clear();
- m_ToBeRemoved.Clear();
- m_ToBeAdded.Clear();
- return (XN_STATUS_OK);
- }
-
-protected:
- XnStatus ApplyListChanges()
- {
- // first add all
- for (XnCallbackPtrList::ConstIterator it = m_ToBeAdded.begin(); it != m_ToBeAdded.end(); ++it)
- {
- m_Handlers.AddLast(*it);
- }
- m_ToBeAdded.Clear();
-
- // and now remove
- for (XnCallbackPtrList::ConstIterator it = m_ToBeRemoved.begin(); it != m_ToBeRemoved.end(); ++it)
- {
- XnCallback* pCallback = *it;
- RemoveCallback(m_Handlers, pCallback);
- }
- m_ToBeRemoved.Clear();
-
- return (XN_STATUS_OK);
- }
-
-#if (XN_PLATFORM == XN_PLATFORM_WIN32)
-#pragma warning (push)
-#pragma warning (disable: 4127)
-#endif
-
- XN_DECLARE_LIST(XnCallback*, XnCallbackPtrList)
-
-#if (XN_PLATFORM == XN_PLATFORM_WIN32)
-#pragma warning (pop)
-#endif
-
- XN_CRITICAL_SECTION_HANDLE m_hLock;
- XnCallbackPtrList m_Handlers;
- XnCallbackPtrList m_ToBeAdded;
- XnCallbackPtrList m_ToBeRemoved;
-
-private:
- XnBool RemoveCallback(XnCallbackPtrList& list, XnCallback* pCallback)
- {
- XnCallbackPtrList::Iterator handlerIt = list.Find(pCallback);
- if (handlerIt != list.end())
- {
- list.Remove(handlerIt);
- XN_DELETE(pCallback);
- return TRUE;
- }
-
- return FALSE;
- }
-};
-
-#define _XN_RAISE_WITH_RET_CODE(args) \
- { \
- XnStatus nRetVal = pFunc(args pCallback->pCookie); \
- if (nRetVal != XN_STATUS_OK) \
- { \
- XnEvent::ApplyListChanges(); \
- return (nRetVal); \
- } \
- }
-
-#define _XN_RAISE_NO_RET_CODE(args) \
- pFunc(args pCallback->pCookie);
-
-/**
-* Declares a class inheriting from XnEvent, that can be used as an event with specific signature.
-* It is highly recommended not to use this macro directly.
-*/
-#define _XN_DECLARE_EVENT_CLASS(_class, _interface, _retVal, _raise, _signature, _raise_sign) \
- XN_PRAGMA_START_DISABLED_WARNING_SECTION(XN_HIDES_PARENT_METHOD_WARNING_ID) \
- class _interface : protected XnEvent \
- { \
- public: \
- typedef _retVal (XN_CALLBACK_TYPE* HandlerPtr)(_signature); \
- virtual XnStatus Register(HandlerPtr pFunc, void* pCookie, XnCallbackHandle* pHandle = NULL) = 0; \
- virtual XnStatus Unregister(XnCallbackHandle handle) = 0; \
- }; \
- class _class : public _interface \
- { \
- public: \
- XnStatus Register(HandlerPtr pFunc, void* pCookie, XnCallbackHandle* pHandle = NULL) \
- { \
- return XnEvent::Register((XnEvent::HandlerPtr)pFunc, pCookie, pHandle); \
- } \
- XnStatus Unregister(XnCallbackHandle handle) \
- { \
- return XnEvent::Unregister(handle); \
- } \
- XnStatus Raise(_raise_sign) \
- { \
- XnAutoCSLocker lock(m_hLock); \
- XnEvent::ApplyListChanges(); \
- XnEvent::XnCallbackPtrList::Iterator it = XnEvent::m_Handlers.begin(); \
- for (; it != XnEvent::m_Handlers.end(); ++it) \
- { \
- XnCallback* pCallback = *it; \
- HandlerPtr pFunc = (HandlerPtr)pCallback->pFuncPtr; \
- _raise \
- } \
- XnEvent::ApplyListChanges(); \
- return (XN_STATUS_OK); \
- } \
- XnStatus Clear() { return XnEvent::Clear(); } \
- }; \
- XN_PRAGMA_STOP_DISABLED_WARNING_SECTION
-
-
-#define _XN_SIGNATURE_0ARG()
-#define _XN_FULL_SIGNATURE_0ARG() void* pCookie
-#define _XN_ARGS_0ARG()
-
-#define _XN_SIGNATURE_1ARG(_type1, _name1) _type1 _name1
-#define _XN_FULL_SIGNATURE_1ARG(_type1, _name1) _type1 _name1, void* pCookie
-#define _XN_ARGS_1ARG(_name1) _name1,
-
-#define _XN_SIGNATURE_2ARG(_type1, _name1, _type2, _name2) _type1 _name1, _type2 _name2
-#define _XN_FULL_SIGNATURE_2ARG(_type1, _name1, _type2, _name2) _type1 _name1, _type2 _name2, void* pCookie
-#define _XN_ARGS_2ARG(_name1, _name2) _name1, _name2,
-
-#define _XN_SIGNATURE_3ARG(_type1, _name1, _type2, _name2, _type3, _name3) _type1 _name1, _type2 _name2, _type3 _name3
-#define _XN_FULL_SIGNATURE_3ARG(_type1, _name1, _type2, _name2, _type3, _name3) _type1 _name1, _type2 _name2, _type3 _name3, void* pCookie
-#define _XN_ARGS_3ARG(_name1, _name2, _name3) _name1, _name2, _name3,
-
-#define _XN_SIGNATURE_4ARG(_type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4) _type1 _name1, _type2 _name2, _type3 _name3, _type4 _name4
-#define _XN_FULL_SIGNATURE_4ARG(_type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4) _type1 _name1, _type2 _name2, _type3 _name3, _type4 _name4, void* pCookie
-#define _XN_ARGS_4ARG(_name1, _name2, _name3, _name4) _name1, _name2, _name3, _name4,
-
-#define _XN_SIGNATURE_5ARG(_type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4, _type5, _name5) _type1 _name1, _type2 _name2, _type3 _name3, _type4 _name4, _type5 _name5
-#define _XN_FULL_SIGNATURE_5ARG(_type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4, _type5, _name5) _type1 _name1, _type2 _name2, _type3 _name3, _type4 _name4, _type5 _name5, void* pCookie
-#define _XN_ARGS_5ARG(_name1, _name2, _name3, _name4, _name5) _name1, _name2, _name3, _name4, _name5,
-
-/** Declares an event class */
-#define XN_DECLARE_EVENT_0ARG(_class, _interface) \
- _XN_DECLARE_EVENT_CLASS(_class, _interface, void, _XN_RAISE_NO_RET_CODE(_XN_ARGS_0ARG()), _XN_FULL_SIGNATURE_0ARG(), _XN_SIGNATURE_0ARG())
-
-#define XN_DECLARE_EVENT_0ARG_RETVAL(_class, _interface) \
- _XN_DECLARE_EVENT_CLASS(_class, _interface, XnStatus, _XN_RAISE_WITH_RET_CODE(_XN_ARGS_0ARG()), _XN_FULL_SIGNATURE_0ARG(), _XN_SIGNATURE_0ARG())
-
-#define XN_DECLARE_EVENT_1ARG(_class, _interface, _type1, _name1) \
- _XN_DECLARE_EVENT_CLASS(_class, _interface, void, _XN_RAISE_NO_RET_CODE(_XN_ARGS_1ARG(_name1)), _XN_FULL_SIGNATURE_1ARG(_type1, _name1), _XN_SIGNATURE_1ARG(_type1, _name1))
-
-#define XN_DECLARE_EVENT_1ARG_RETVAL(_class, _interface, _type1, _name1) \
- _XN_DECLARE_EVENT_CLASS(_class, _interface, XnStatus, _XN_RAISE_WITH_RET_CODE(_XN_ARGS_1ARG(_name1)), _XN_FULL_SIGNATURE_1ARG(_type1, _name1), _XN_SIGNATURE_1ARG(_type1, _name1))
-
-#define XN_DECLARE_EVENT_2ARG(_class, _interface, _type1, _name1, _type2, _name2) \
- _XN_DECLARE_EVENT_CLASS(_class, _interface, void, _XN_RAISE_NO_RET_CODE(_XN_ARGS_2ARG(_name1, _name2)), _XN_FULL_SIGNATURE_2ARG(_type1, _name1, _type2, _name2), _XN_SIGNATURE_2ARG(_type1, _name1, _type2, _name2))
-
-#define XN_DECLARE_EVENT_2ARG_RETVAL(_class, _interface, _type1, _name1, _type2, _name2) \
- _XN_DECLARE_EVENT_CLASS(_class, _interface, XnStatus, _XN_RAISE_WITH_RET_CODE(_XN_ARGS_2ARG(_name1, _name2)), _XN_FULL_SIGNATURE_2ARG(_type1, _name1, _type2, _name2), _XN_SIGNATURE_2ARG(_type1, _name1, _type2, _name2))
-
-#define XN_DECLARE_EVENT_3ARG(_class, _interface, _type1, _name1, _type2, _name2, _type3, _name3) \
- _XN_DECLARE_EVENT_CLASS(_class, _interface, void, _XN_RAISE_NO_RET_CODE(_XN_ARGS_3ARG(_name1, _name2, _name3)), _XN_FULL_SIGNATURE_3ARG(_type1, _name1, _type2, _name2, _type3, _name3), _XN_SIGNATURE_3ARG(_type1, _name1, _type2, _name2, _type3, _name3))
-
-#define XN_DECLARE_EVENT_3ARG_RETVAL(_class, _interface, _type1, _name1, _type2, _name2, _type3, _name3) \
- _XN_DECLARE_EVENT_CLASS(_class, _interface, XnStatus, _XN_RAISE_WITH_RET_CODE(_XN_ARGS_3ARG(_name1, _name2, _name3)), _XN_FULL_SIGNATURE_3ARG(_type1, _name1, _type2, _name2, _type3, _name3), _XN_SIGNATURE_3ARG(_type1, _name1, _type2, _name2, _type3, _name3))
-
-#define XN_DECLARE_EVENT_4ARG(_class, _interface, _type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4) \
- _XN_DECLARE_EVENT_CLASS(_class, _interface, void, _XN_RAISE_NO_RET_CODE(_XN_ARGS_4ARG(_name1, _name2, _name3, _name4)), _XN_FULL_SIGNATURE_4ARG(_type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4), _XN_SIGNATURE_4ARG(_type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4))
-
-#define XN_DECLARE_EVENT_4ARG_RETVAL(_class, _interface, _type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4) \
- _XN_DECLARE_EVENT_CLASS(_class, _interface, XnStatus, _XN_RAISE_WITH_RET_CODE(_XN_ARGS_4ARG(_name1, _name2, _name3, _name4)), _XN_FULL_SIGNATURE_4ARG(_type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4), _XN_SIGNATURE_4ARG(_type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4))
-
-#define XN_DECLARE_EVENT_5ARG(_class, _interface, _type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4, _type5, _name5) \
- _XN_DECLARE_EVENT_CLASS(_class, _interface, void, _XN_RAISE_NO_RET_CODE(_XN_ARGS_5ARG(_name1, _name2, _name3, _name4, _name5)), _XN_FULL_SIGNATURE_5ARG(_type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4, _type5, _name5), _XN_SIGNATURE_5ARG(_type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4, _type5, _name5))
-
-#define XN_DECLARE_EVENT_5ARG_RETVAL(_class, _interface, _type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4, _type5, _name5) \
- _XN_DECLARE_EVENT_CLASS(_class, _interface, XnStatus, _XN_RAISE_WITH_RET_CODE(_XN_ARGS_5ARG(_name1, _name2, _name3, _name4, _name5)), _XN_FULL_SIGNATURE_5ARG(_type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4, _type5, _name5), _XN_SIGNATURE_5ARG(_type1, _name1, _type2, _name2, _type3, _name3, _type4, _name4, _type5, _name5))
-
-#endif //__XN_EVENT_H__
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnEventT.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnEventT.h
deleted file mode 100644
index f0b6379d..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnEventT.h
+++ /dev/null
@@ -1,393 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef _XN_EVENT_T_H_
-#define _XN_EVENT_T_H_
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include "XnOSCpp.h"
-#include "XnListT.h"
-#include "XnTypes.h"
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-
-/**
-* A struct for holding a callback function with its cookie
-*
-* @tparam FuncPtr The callback signature
-*/
-template<typename FuncPtr>
-struct XnCallbackT
-{
- XnCallbackT(FuncPtr func, void* cookie) : pFunc(func), pCookie(cookie) {}
-
- FuncPtr pFunc;
- void* pCookie;
-};
-
-/**
-* A class that contains the interface of an event (i.e. Register and Unregister)
-*
-* @tparam FuncPtr The callback signature
-*/
-template<typename FuncPtr>
-class XnEventInterfaceT
-{
-public:
- typedef FuncPtr HandlerPtr;
- typedef XnCallbackT<FuncPtr> TCallback;
- typedef XnEventInterfaceT TInterface;
-
- ~XnEventInterfaceT()
- {
- Clear();
- xnOSCloseCriticalSection(&m_hLock);
- }
-
- XnStatus Register(FuncPtr pFunc, void* pCookie, XnCallbackHandle& hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- XN_VALIDATE_INPUT_PTR(pFunc);
-
- TCallback* pCallback = NULL;
- XN_VALIDATE_NEW(pCallback, TCallback, pFunc, pCookie);
-
- // always add to list of added (actual list will be updated in Raise method, to allow registering
- // from a callback).
- {
- XnAutoCSLocker locker(m_hLock);
- nRetVal = m_toAdd.AddLast(pCallback);
- }
-
- if (nRetVal != XN_STATUS_OK)
- {
- XN_DELETE(pCallback);
- return nRetVal;
- }
-
- // return handle
- hCallback = (XnCallbackHandle)pCallback;
-
- return XN_STATUS_OK;
- }
-
- XnStatus Unregister(XnCallbackHandle hCallback)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- TCallback* pCallback = (TCallback*)hCallback;
-
- // add it to a temp list, to allow unregistering from a callback (actual list will be updated in raise
- // function).
- {
- XnAutoCSLocker locker(m_hLock);
-
- // try to remove it from the ToBeAdded list.
- if (!RemoveCallback(m_toAdd, pCallback))
- {
- // it's not in this list, so it's probably in the main list
- nRetVal = m_toRemove.AddLast(pCallback);
- }
- }
- XN_IS_STATUS_OK(nRetVal);
-
- return XN_STATUS_OK;
- }
-
-protected:
- typedef XnListT<TCallback*> CallbackPtrList;
-
- // Constructors are protected, so that this class cannot be instantiated directly.
- XnEventInterfaceT()
- {
- Init();
- }
-
- XnEventInterfaceT(const XnEventInterfaceT& other)
- {
- Init();
- *this = other;
- }
-
- XnEventInterfaceT& operator=(const XnEventInterfaceT& other)
- {
- Clear();
-
- // lock other one (so it won't change while being copied)
- XnAutoCSLocker otherLocker(other.m_hLock);
- // lock this one (we're making changes)
- XnAutoCSLocker locker(m_hLock);
-
- m_callbacks = other.m_callbacks;
- m_toAdd = other.m_toAdd;
- m_toRemove = other.m_toRemove;
-
- ApplyListChanges();
-
- return *this;
- }
-
- XnStatus Clear()
- {
- XnAutoCSLocker locker(m_hLock);
- ApplyListChanges();
-
- for (typename CallbackPtrList::ConstIterator it = m_callbacks.Begin(); it != m_callbacks.End(); ++it)
- {
- TCallback* pCallback = *it;
- XN_DELETE(pCallback);
- }
-
- m_callbacks.Clear();
- m_toRemove.Clear();
- m_toAdd.Clear();
- return (XN_STATUS_OK);
- }
-
- XnStatus ApplyListChanges()
- {
- XnAutoCSLocker locker(m_hLock);
-
- // first add all
- for (typename CallbackPtrList::ConstIterator it = m_toAdd.Begin(); it != m_toAdd.End(); ++it)
- {
- m_callbacks.AddLast(*it);
- }
- m_toAdd.Clear();
-
- // and now remove
- for (typename CallbackPtrList::ConstIterator it = m_toRemove.Begin(); it != m_toRemove.End(); ++it)
- {
- TCallback* pCallback = *it;
- RemoveCallback(m_callbacks, pCallback);
- }
- m_toRemove.Clear();
-
- return (XN_STATUS_OK);
- }
-
- XnBool RemoveCallback(CallbackPtrList& list, TCallback* pCallback)
- {
- typename CallbackPtrList::Iterator it = list.Find(pCallback);
- if (it != list.End())
- {
- list.Remove(it);
- XN_DELETE(pCallback);
- return TRUE;
- }
-
- return FALSE;
- }
-
- XN_CRITICAL_SECTION_HANDLE m_hLock;
- CallbackPtrList m_callbacks;
- CallbackPtrList m_toAdd;
- CallbackPtrList m_toRemove;
-
-private:
- void Init()
- {
- m_hLock = NULL;
- XnStatus nRetVal = xnOSCreateCriticalSection(&m_hLock);
- if (nRetVal != XN_STATUS_OK)
- {
- XN_ASSERT(FALSE);
- }
- }
-};
-
-// Handlers
-struct XnHandlerFuncNoArgs
-{
- typedef void (XN_CALLBACK_TYPE* FuncPtr)(void* pCookie);
-};
-
-template<class TArg1>
-struct XnHandlerFunc1Arg
-{
- typedef void (XN_CALLBACK_TYPE* FuncPtr)(TArg1 arg1, void* pCookie);
-};
-
-template<class TArg1, class TArg2>
-struct XnHandlerFunc2Args
-{
- typedef void (XN_CALLBACK_TYPE* FuncPtr)(TArg1 arg1, TArg2 arg2, void* pCookie);
-};
-
-template<class TArg1, class TArg2, class TArg3>
-struct XnHandlerFunc3Args
-{
- typedef void (XN_CALLBACK_TYPE* FuncPtr)(TArg1 arg1, TArg2 arg2, TArg3 arg3, void* pCookie);
-};
-
-template<class TArg1, class TArg2, class TArg3, class TArg4>
-struct XnHandlerFunc4Args
-{
- typedef void (XN_CALLBACK_TYPE* FuncPtr)(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, void* pCookie);
-};
-
-template<class TArg1, class TArg2, class TArg3, class TArg4, class TArg5>
-struct XnHandlerFunc5Args
-{
- typedef void (XN_CALLBACK_TYPE* FuncPtr)(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, void* pCookie);
-};
-
-// Event classes (there's a class per number of arguments)
-class XnEventNoArgs : public XnEventInterfaceT<XnHandlerFuncNoArgs::FuncPtr>
-{
-public:
- XnStatus Raise()
- {
- XnAutoCSLocker locker(this->m_hLock);
- ApplyListChanges();
-
- for (CallbackPtrList::ConstIterator it = m_callbacks.Begin(); it != m_callbacks.End(); ++it)
- {
- TCallback* pCallback = *it;
- pCallback->pFunc(pCallback->pCookie);
- }
-
- ApplyListChanges();
- return (XN_STATUS_OK);
- }
-};
-
-
-template<class TArg1>
-class XnEvent1Arg : public XnEventInterfaceT<typename XnHandlerFunc1Arg<TArg1>::FuncPtr>
-{
- typedef XnEventInterfaceT<typename XnHandlerFunc1Arg<TArg1>::FuncPtr> Base;
-
-public:
- XnStatus Raise(TArg1 arg)
- {
- XnAutoCSLocker locker(this->m_hLock);
- this->ApplyListChanges();
-
- for (typename Base::CallbackPtrList::ConstIterator it = this->m_callbacks.Begin(); it != this->m_callbacks.End(); ++it)
- {
- typename Base::TCallback* pCallback = *it;
- pCallback->pFunc(arg, pCallback->pCookie);
- }
-
- this->ApplyListChanges();
- return (XN_STATUS_OK);
- }
-};
-
-template<class TEventArgs>
-class XnEventT : public XnEvent1Arg<const TEventArgs&>
-{};
-
-template<class TArg1, class TArg2>
-class XnEvent2Args : public XnEventInterfaceT<typename XnHandlerFunc2Args<TArg1, TArg2>::FuncPtr>
-{
- typedef XnEventInterfaceT<typename XnHandlerFunc2Args<TArg1, TArg2>::FuncPtr> Base;
-
-public:
- XnStatus Raise(TArg1 arg1, TArg2 arg2)
- {
- XnAutoCSLocker locker(this->m_hLock);
- this->ApplyListChanges();
-
- for (typename Base::CallbackPtrList::ConstIterator it = this->m_callbacks.Begin(); it != this->m_callbacks.End(); ++it)
- {
- typename Base::TCallback* pCallback = *it;
- pCallback->pFunc(arg1, arg2, pCallback->pCookie);
- }
-
- this->ApplyListChanges();
- return (XN_STATUS_OK);
- }
-};
-
-template<class TArg1, class TArg2, class TArg3>
-class XnEvent3Args : public XnEventInterfaceT<typename XnHandlerFunc3Args<TArg1, TArg2, TArg3>::FuncPtr>
-{
- typedef XnEventInterfaceT<typename XnHandlerFunc3Args<TArg1, TArg2, TArg3>::FuncPtr> Base;
-
-public:
- XnStatus Raise(TArg1 arg1, TArg2 arg2, TArg3 arg3)
- {
- XnAutoCSLocker locker(this->m_hLock);
- this->ApplyListChanges();
-
- for (typename Base::CallbackPtrList::ConstIterator it = this->m_callbacks.Begin(); it != this->m_callbacks.End(); ++it)
- {
- typename Base::TCallback* pCallback = *it;
- pCallback->pFunc(arg1, arg2, arg3, pCallback->pCookie);
- }
-
- this->ApplyListChanges();
- return (XN_STATUS_OK);
- }
-};
-
-template<class TArg1, class TArg2, class TArg3, class TArg4>
-class XnEvent4Args : public XnEventInterfaceT<typename XnHandlerFunc4Args<TArg1, TArg2, TArg3, TArg4>::FuncPtr>
-{
- typedef XnEventInterfaceT<typename XnHandlerFunc4Args<TArg1, TArg2, TArg3, TArg4>::FuncPtr> Base;
-
-public:
- XnStatus Raise(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4)
- {
- XnAutoCSLocker locker(this->m_hLock);
- this->ApplyListChanges();
-
- for (typename Base::CallbackPtrList::ConstIterator it = this->m_callbacks.Begin(); it != this->m_callbacks.End(); ++it)
- {
- typename Base::TCallback* pCallback = *it;
- pCallback->pFunc(arg1, arg2, arg3, arg4, pCallback->pCookie);
- }
-
- this->ApplyListChanges();
- return (XN_STATUS_OK);
- }
-};
-
-template<class TArg1, class TArg2, class TArg3, class TArg4, class TArg5>
-class XnEvent5Args : public XnEventInterfaceT<typename XnHandlerFunc5Args<TArg1, TArg2, TArg3, TArg4, TArg5>::FuncPtr>
-{
- typedef XnEventInterfaceT<typename XnHandlerFunc5Args<TArg1, TArg2, TArg3, TArg4, TArg5>::FuncPtr> Base;
-
-public:
- XnStatus Raise(TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5)
- {
- XnAutoCSLocker locker(this->m_hLock);
- this->ApplyListChanges();
-
- for (typename Base::CallbackPtrList::ConstIterator it = this->m_callbacks.Begin(); it != this->m_callbacks.End(); ++it)
- {
- typename Base::TCallback* pCallback = *it;
- pCallback->pFunc(arg1, arg2, arg3, arg4, arg5, pCallback->pCookie);
- }
-
- this->ApplyListChanges();
- return (XN_STATUS_OK);
- }
-};
-
-#endif // _XN_EVENT_T_H_ \ No newline at end of file
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnFPSCalculator.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnFPSCalculator.h
deleted file mode 100644
index 036694b7..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnFPSCalculator.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef __XN_FPS_CALCULATOR_H__
-#define __XN_FPS_CALCULATOR_H__
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <XnPlatform.h>
-#include <XnStatus.h>
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-struct XnFPSDataImpl;
-typedef struct XnFPSDataImpl* XnFPSData;
-
-//---------------------------------------------------------------------------
-// Exported Functions
-//---------------------------------------------------------------------------
-/**
-* This function initializes the FPS calculator.
-*
-* @param pFPS [in] A pointer to an XnFPSData struct.
-* @param nSamplesCount [in] The number of last frames to be kept.
-*/
-XN_C_API XnStatus XN_C_DECL xnFPSInit(XnFPSData* pFPS, XnUInt32 nSamplesCount);
-
-/**
-* This function marks that another frame was processed.
-*
-* @param pFPS [in] A pointer to an XnFPSData struct.
-* @param nNow [in] Optional. Current time. When not provided, function will take it itself.
-*/
-XN_C_API XnStatus XN_C_DECL xnFPSMarkFrame(XnFPSData* pFPS, XnUInt64 nNow = 0);
-
-/**
-* This function calculates the average FPS over the last frames.
-*
-* @param pFPS [in] A pointer to an XnFPSData struct.
-* @param nAverageOver [in] The number of milliseconds to average over.
-* @param nNow [in] Optional. Current time. When not provided, function will take it itself.
-*/
-XN_C_API XnDouble XN_C_DECL xnFPSCalc(XnFPSData* pFPS, XnUInt32 nAverageOver = 3000, XnUInt64 nNow = 0);
-
-/**
-* This function frees the FPS calculator.
-*
-* @param pFPS [in] A pointer to an XnFPSData struct.
-*/
-XN_C_API XnStatus XN_C_DECL xnFPSFree(XnFPSData* pFPS);
-
-#endif //__XN_FPS_CALCULATOR_H__
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnGeneralBuffer.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnGeneralBuffer.h
deleted file mode 100644
index 4c6b3c77..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnGeneralBuffer.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef __XN_GENERAL_BUFFER_H__
-#define __XN_GENERAL_BUFFER_H__
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include "XnPlatform.h"
-#include "XnOS.h"
-#include "XnStatusCodes.h"
-
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-
-/* Describes a general buffer. */
-typedef struct XnGeneralBuffer
-{
- /* A pointer to the actual data. */
- void* pData;
- /* The size of the data in bytes. */
- XnUInt32 nDataSize;
-} XnGeneralBuffer;
-
-//---------------------------------------------------------------------------
-// Exported Functions
-//---------------------------------------------------------------------------
-
-/**
-* Packs a pointer and a size into an XnGeneralBuffer struct.
-*/
-inline XnGeneralBuffer XnGeneralBufferPack(void* pData, XnUInt32 nDataSize)
-{
- XnGeneralBuffer result;
- result.pData = pData;
- result.nDataSize = nDataSize;
- return result;
-}
-
-/**
-* Copies one general buffer into another.
-*/
-inline XnStatus XnGeneralBufferCopy(XnGeneralBuffer* pDest, const XnGeneralBuffer* pSrc)
-{
- XN_VALIDATE_INPUT_PTR(pDest);
- XN_VALIDATE_INPUT_PTR(pSrc);
-
- if (pSrc->nDataSize > pDest->nDataSize)
- return XN_STATUS_OUTPUT_BUFFER_OVERFLOW;
-
- xnOSMemCopy(pDest->pData, pSrc->pData, pSrc->nDataSize);
- pDest->nDataSize = pSrc->nDataSize;
- return XN_STATUS_OK;
-}
-
-inline XnStatus XnGeneralBufferAlloc(XnGeneralBuffer* pDest, XnUInt32 nSize)
-{
- XN_VALIDATE_INPUT_PTR(pDest);
-
- void* pData;
- pData = xnOSMalloc(nSize);
- XN_VALIDATE_ALLOC_PTR(pData);
-
- pDest->pData = pData;
- pDest->nDataSize = nSize;
- return XN_STATUS_OK;
-}
-
-inline XnStatus XnGeneralBufferRealloc(XnGeneralBuffer* pDest, XnUInt32 nSize)
-{
- XN_VALIDATE_INPUT_PTR(pDest);
-
- void* pData;
- pData = xnOSRealloc(pDest, nSize);
- XN_VALIDATE_ALLOC_PTR(pData);
-
- pDest->pData = pData;
- pDest->nDataSize = nSize;
- return XN_STATUS_OK;
-}
-
-inline void XnGeneralBufferFree(XnGeneralBuffer* pDest)
-{
- XN_FREE_AND_NULL(pDest->pData);
- pDest->nDataSize = 0;
-}
-
-//---------------------------------------------------------------------------
-// Helper Macros
-//---------------------------------------------------------------------------
-#define XN_PACK_GENERAL_BUFFER(x) XnGeneralBufferPack(&x, sizeof(x))
-
-#define XN_VALIDATE_GENERAL_BUFFER_TYPE(gb, t) \
- if ((gb).nDataSize != sizeof(t)) \
- { \
- return XN_STATUS_INVALID_BUFFER_SIZE; \
- }
-
-#endif //__XN_GENERAL_BUFFER_H__ \ No newline at end of file
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnHash.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnHash.h
deleted file mode 100644
index 7cc719f2..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnHash.h
+++ /dev/null
@@ -1,1014 +0,0 @@
-/****************************************************************************
-* *
-* OpenNI 1.x Alpha *
-* Copyright (C) 2011 PrimeSense Ltd. *
-* *
-* This file is part of OpenNI. *
-* *
-* OpenNI is free software: you can redistribute it and/or modify *
-* it under the terms of the GNU Lesser General Public License as published *
-* by the Free Software Foundation, either version 3 of the License, or *
-* (at your option) any later version. *
-* *
-* OpenNI is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU Lesser General Public License for more details. *
-* *
-* You should have received a copy of the GNU Lesser General Public License *
-* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
-* *
-****************************************************************************/
-#ifndef _XN_HASH_H
-#define _XN_HASH_H
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include "XnList.h"
-
-//---------------------------------------------------------------------------
-// Defines
-//---------------------------------------------------------------------------
-#define XN_HASH_LAST_BIN 256
-#define XN_HASH_NUM_BINS (XN_HASH_LAST_BIN + 1)
-//---------------------------------------------------------------------------
-// Types
-//---------------------------------------------------------------------------
-/**
-* The key to the hash
-*/
-typedef XnValue XnKey;
-
-/**
-* The hash value - the output of the hash function
-*/
-typedef XnUInt8 XnHashValue;
-
-/**
-* Default Hash function
-*/
-static XnHashValue XnDefaultHashFunction(const XnKey& key)
-{
- return (XnSizeT(key) & 0xff);
-}
-
-/**
-* Default Compare function
-*/
-static XnInt32 XnDefaultCompareFunction(const XnKey& key1, const XnKey& key2)
-{
- return XnInt32(XnSizeT(key1)-XnSizeT(key2));
-}
-
-/**
- * The hash - associative array
- */
-class XnHash
-{
-public:
- /**
- * Iterator to the XnHash
- */
- class ConstIterator
- {
- public:
- friend class XnHash;
-
- /**
- * Copy constructor
- *
- * @param other [in] instance to copy from
- */
- ConstIterator(const ConstIterator& other) :
- m_pHash(other.m_pHash), m_nCurrentBin(other.m_nCurrentBin), m_Iterator(other.m_Iterator) {}
-
- /**
- * Support ++iterator, go to the next object in the hash
- */
- ConstIterator& operator++()
- {
- ++m_Iterator;
-
- while (m_Iterator == m_pHash->m_Bins[m_nCurrentBin]->end() &&
- m_Iterator != m_pHash->m_Bins[XN_HASH_LAST_BIN]->end())
- {
- do
- {
- m_nCurrentBin++;
- } while (m_pHash->m_Bins[m_nCurrentBin] == NULL);
- m_Iterator = m_pHash->m_Bins[m_nCurrentBin]->begin();
- }
- return *this;
- }
-
- /**
- * Support iterator++, go to the next object in the hash, returning the old value
- */
- ConstIterator operator++(int)
- {
- XnHash::ConstIterator other(*this);
- ++*this;
- return other;
- }
-
- /**
- * Support --iterator, go to the previous object in the hash
- */
- ConstIterator& operator--()
- {
- --m_Iterator;
-
- while (m_Iterator == m_pHash->m_Bins[m_nCurrentBin]->end() &&
- m_Iterator != m_pHash->m_Bins[XN_HASH_LAST_BIN]->end())
- {
- do
- {
- if (m_nCurrentBin == 0)
- {
- m_nCurrentBin = XN_HASH_LAST_BIN;
- m_Iterator = m_pHash->m_Bins[XN_HASH_LAST_BIN]->end();
- return *this;
- }
- m_nCurrentBin--;
- } while (m_pHash->m_Bins[m_nCurrentBin] == NULL);
- m_Iterator = m_pHash->m_Bins[m_nCurrentBin]->rbegin();
- }
- return *this;
- }
-
- /**
- * Support iterator--, go to the previous object in the hash, returning the old value
- */
- ConstIterator operator--(int)
- {
- ConstIterator other(*this);
- --*this;
- return other;
- }
-
- /**
- * Operator to check if 2 iterators point to the same object
- *
- * @param other [in] instance to compare with
- */
- XnBool operator==(const ConstIterator& other) const
- {
- return m_Iterator == other.m_Iterator;
- }
-
- /**
- * Operator to check if 2 iterators point to different objects
- *
- * @param other [in] instance to compare with
- */
- XnBool operator!=(const ConstIterator& other) const
- {
- return m_Iterator != other.m_Iterator;
- }
-
- /**
- * Get the key of the current object (const version)
- */
- const XnKey& Key() const
- {
- return ((XnNode*)(*m_Iterator))->Data();
- }
-
- /**
- * Get the value of the current object (const version)
- */
- const XnValue& Value() const
- {
- return ((XnNode*)(*m_Iterator))->Next()->Data();
- }
-
- /**
- * Get the entire current object (non-const version)
- */
- XnNode* GetNode()
- {
- return m_Iterator.GetNode();
- }
-
- /**
- * Get the entire current object (const version)
- */
- const XnNode* GetNode() const
- {
- return m_Iterator.GetNode();
- }
-
- protected:
- /**
- * constructor to be used from inside the XnHash
- *
- * @param pHash [in] The hash to which the iterator belongs
- * @param nBin [in] The bin of the current object
- * @param listIterator [in] Iterator on the bin (each bin is a XnList)
- */
- ConstIterator(const XnHash* pHash, XnUInt16 nBin, XnList::Iterator listIterator) :
- m_pHash(pHash), m_nCurrentBin(nBin), m_Iterator(listIterator)
- {
- // Find the first valid
- while (m_Iterator == m_pHash->m_Bins[m_nCurrentBin]->end() &&
- m_Iterator != m_pHash->m_Bins[XN_HASH_LAST_BIN]->end())
- {
- do
- {
- m_nCurrentBin++;
- } while (m_pHash->m_Bins[m_nCurrentBin] == NULL);
- m_Iterator = m_pHash->m_Bins[m_nCurrentBin]->begin();
- }
- }
-
- /**
- * constructor to be used from inside the XnHash. It points to the first value in the hash.
- *
- * @param pHash [in] The hash to which the iterator belongs
- */
- ConstIterator(const XnHash* pHash) :
- m_pHash(pHash), m_nCurrentBin(0), m_Iterator(m_pHash->m_Bins[XN_HASH_LAST_BIN]->end()) {}
-
- /** The hash to which the iterator belongs */
- const XnHash* m_pHash;
- /** The bin of the current object */
- XnUInt16 m_nCurrentBin;
- /** Iterator for the specific bin */
- XnList::Iterator m_Iterator;
- };
-
- /**
- * Iterator to the XnHash
- */
- class Iterator : public ConstIterator
- {
- public:
- friend class XnHash;
-
- /**
- * Copy constructor
- *
- * @param other [in] instance to copy from
- */
- inline Iterator(const Iterator& other) : ConstIterator(other) {}
-
- /**
- * Support ++iterator, go to the next object in the list
- */
- inline Iterator& operator++()
- {
- ++(*(ConstIterator*)this);
- return (*this);
- }
- /**
- * Support iterator++, go to the next object in the list, returning the old value
- */
- inline Iterator operator++(int)
- {
- Iterator result = *this;
- ++*this;
- return (result);
- }
-
- /**
- * Support --iterator, go to the next object in the list
- */
- inline Iterator& operator--()
- {
- --(*(ConstIterator*)this);
- return (*this);
- }
- /**
- * Support iterator--, go to the next object in the list, returning the old value
- */
- inline Iterator operator--(int)
- {
- Iterator result = *this;
- --*this;
- return (result);
- }
-
- /**
- * Get the key of the current object (const version)
- */
- XnKey& Key() const { return (XnKey&)ConstIterator::Key(); }
-
- /**
- * Get the value of the current object (const version)
- */
- XnValue& Value() const { return (XnValue&)ConstIterator::Value(); }
-
- protected:
- /**
- * constructor to be used from inside the XnHash
- *
- * @param pHash [in] The hash to which the iterator belongs
- * @param nBin [in] The bin of the current object
- * @param listIterator [in] Iterator on the bin (each bin is a XnList)
- */
- Iterator(const XnHash* pHash, XnUInt16 nBin, XnList::Iterator listIterator) :
- ConstIterator(pHash, nBin, listIterator)
- {}
-
- /**
- * constructor to be used from inside the XnHash. It points to the first value in the hash.
- *
- * @param pHash [in] The hash to which the iterator belongs
- */
- Iterator(const XnHash* pHash) : ConstIterator(pHash) {}
-
- Iterator(const ConstIterator& other) : ConstIterator(other) {}
- };
-
- friend class ConstIterator;
-
-public:
- /**
- * Definition of a hash function - receive key, and outputs HashValue
- */
- typedef XnHashValue (*XnHashFunction)(const XnKey& key);
- /**
- * Definition of comparison function - receives 2 keys, returns 0 on equality
- */
- typedef XnInt32 (*XnCompareFunction)(const XnKey& key1, const XnKey& key2);
-
- /**
- * Constructor. Initializes internal representations.
- */
- XnHash()
- {
- m_nInitStatus = Init();
- }
-
- /**
- * Destructor. Destroys internal representations.
- */
- virtual ~XnHash()
- {
- if (m_Bins != NULL)
- {
- for (int i = 0; i < XN_HASH_NUM_BINS; ++i)
- {
- XN_DELETE(m_Bins[i]);
- }
- XN_DELETE_ARR(m_Bins);
- }
- }
-
- /**
- * Returns the status of the initialization of the hash.
- * @returns XN_STATUS_OK if the hash was initialized successfully, or an error code otherwise
- * (e.g. if memory could not be allocated).
- */
- XnStatus GetInitStatus() const
- {
- return m_nInitStatus;
- }
-
- /**
- * Set a new key-value entry. If key exists, will replace value.
- *
- * @param key [in] The key to which to associate the value
- * @param value [in] The value to add to the XnHash
- */
- XnStatus Set(const XnKey& key, const XnValue& value)
- {
- XnHashValue HashValue = (*m_HashFunction)(key);
-
- // Check if key already exists
- if (m_Bins[HashValue] != NULL)
- {
- Iterator hiter(this);
- if (Find(key, HashValue, hiter) == XN_STATUS_OK)
- {
- // Replace value
- hiter.Value() = value;
- return XN_STATUS_OK;
- }
- }
- else
- {
- // First time trying to access this bin, create it.
- m_Bins[HashValue] = XN_NEW(XnList);
- if (m_Bins[HashValue] == NULL)
- {
- return XN_STATUS_ALLOC_FAILED;
- }
- if (HashValue < m_nMinBin)
- m_nMinBin = HashValue;
- }
-
- // Get a new node for the key
- XnNode* pKeyNode = XnNode::Allocate();
- if (pKeyNode == NULL)
- {
- return XN_STATUS_ALLOC_FAILED;
- }
- pKeyNode->Data() = key;
-
- // Get a new node for the value
- XnNode* pValueNode = XnNode::Allocate();
- if (pValueNode == NULL)
- {
- XnNode::Deallocate(pKeyNode);
- return XN_STATUS_ALLOC_FAILED;
- }
- pValueNode->Data() = value;
-
- // Concatenate the value node to the key node
- pKeyNode->Next() = pValueNode;
- pValueNode->Next() = NULL;
-
- // Add the 2 nodes as the value to the key's list
- XnStatus ListStatus = m_Bins[HashValue]->AddLast(XnValue(pKeyNode));
- if (ListStatus != XN_STATUS_OK)
- {
- // Add failed. return the 2 nodes to the pool
- XnNode::Deallocate(pKeyNode);
- XnNode::Deallocate(pValueNode);
- return ListStatus;
- }
-
- return XN_STATUS_OK;
- }
-
- /**
- * Get the value associated with the supplied key
- *
- * @param key [in] The key of the entry
- * @param value [out] The retrieved value
- *
- * @return XN_STATUS_NO_MATCH if no such key exists
- */
- XnStatus Get(const XnKey& key, XnValue& value) const
- {
- // Check if key exists
- Iterator hiter(this);
- XnStatus FindStatus = Find(key, hiter);
- if (FindStatus != XN_STATUS_OK)
- {
- // Key doesn't exist!
- return FindStatus;
- }
- value = hiter.Value();
-
- return XN_STATUS_OK;
- }
-
- /**
- * Remove a key-value entry from the XnHash
- *
- * @param key [in] The key of the entry
- * @param value [out] The value that was in the removed entry
-
- * @return XN_STATUS_NO_MATCH if no such key exists
- */
- XnStatus Remove(const XnKey& key, XnValue& value)
- {
- // find the entry to which the key belongs
- Iterator hiter(this);
-
- XnStatus FindStatus = Find(key, hiter);
- if (FindStatus != XN_STATUS_OK)
- {
- // no such entry!
- return FindStatus;
- }
-
- // Remove by iterator
- value = hiter.Value();
- return Remove(hiter);
- }
-
- /**
- * Remove an entry from the XnHash by iterator
- *
- * @param iter [in] Iterator pointing to an entry in the hash
- * @param key [out] The key that was in the removed entry
- * @param value [out] The value that was in the removed entry
- *
- * @return XN_STATUS_ILLEGAL_POSITION if iterator is invalid
- */
- XnStatus Remove(ConstIterator iter, XnKey& key, XnValue& value)
- {
- if (iter == end())
- {
- // Can't remove invalid node
- return XN_STATUS_ILLEGAL_POSITION;
- }
-
- // Get value and key, to return to the caller
- value = iter.Value();
- key = iter.Key();
-
- return Remove(iter);
- }
-
- /**
- * Remove an entry from the XnHash by iterator
- *
- * @param iter [in] Iterator pointing to an entry in the hash
- *
- * @return XN_STATUS_ILLEGAL_POSITION if iterator is invalid
- */
- virtual XnStatus Remove(ConstIterator iter)
- {
- if (iter == end())
- {
- // Can't remove invalid node
- return XN_STATUS_ILLEGAL_POSITION;
- }
-
- XnNode* pNode = iter.GetNode();
-
- XnNode* pKeyNode = (XnNode*)(pNode->Data());
- XnNode* pValueNode = pKeyNode->Next();
-
- // Return the nodes to the pool
- XnNode::Deallocate(pKeyNode);
- XnNode::Deallocate(pValueNode);
-
- pNode->Previous()->Next() = pNode->Next();
- pNode->Next()->Previous() = pNode->Previous();
-
- XnNode::Deallocate(pNode);
-
- return XN_STATUS_OK;
- }
-
-
- /**
- * Remove all entries from the XnHash.
- */
- XnStatus Clear()
- {
- while (begin() != end())
- Remove(begin());
-
- return XN_STATUS_OK;
- }
-
- /**
- * Checks if hash is empty.
- */
- XnBool IsEmpty() const
- {
- return (begin() == end());
- }
-
- /**
- * Gets the number of entries in the hash.
- */
- XnUInt32 Size() const
- {
- XnUInt32 nSize = 0;
- for (Iterator iter = begin(); iter != end(); ++iter, ++nSize)
- ;
-
- return nSize;
- }
-
- /**
- * Get an iterator pointing to the entry to which the key belongs
- *
- * @param key [in] The key of the entry
- * @param hiter [out] Iterator to the entry described by key
- *
- * @return XN_STATUS_NO_MATCH No such key in the XnHash
- */
- XnStatus Find(const XnKey& key, ConstIterator& hiter) const
- {
- return ConstFind(key, hiter);
- }
-
- /**
- * Get an iterator pointing to the entry to which the key belongs
- *
- * @param key [in] The key of the entry
- * @param hiter [out] Iterator to the entry described by key
- *
- * @return XN_STATUS_NO_MATCH No such key in the XnHash
- */
- XnStatus Find(const XnKey& key, Iterator& hiter)
- {
- XnStatus nRetVal = XN_STATUS_OK;
-
- ConstIterator& it = hiter;
- nRetVal = ConstFind(key, it);
- XN_IS_STATUS_OK(nRetVal);
-
- return (XN_STATUS_OK);
- }
-
- /**
- * Get an iterator to the beginning of the XnHash (non-const version)
- */
- Iterator begin()
- {
- return Iterator(this, m_nMinBin, m_Bins[m_nMinBin]->begin());
- }
-
- /**
- * Get an iterator to the beginning of the XnHash (const version)
- */
- ConstIterator begin() const
- {
- return ConstIterator(this, m_nMinBin, m_Bins[m_nMinBin]->begin());
- }
-
- /**
- * Get an iterator to the end of the XnHash (position is invalid) (non-const version)
- */
- Iterator end()
- {
- return Iterator(this, XN_HASH_LAST_BIN, m_Bins[XN_HASH_LAST_BIN]->end());
- }
-
- /**
- * Get an iterator to the end of the XnHash (position is invalid) (const version)
- */
- ConstIterator end() const
- {
- return ConstIterator(this, XN_HASH_LAST_BIN, m_Bins[XN_HASH_LAST_BIN]->end());
- }
-
- /**
- * Change the hash function. The XnHash must be empty for this to succeed.
- *
- * @param hashFunction [in] The new hash function
- *
- * @return XN_STATUS_IS_NOT_EMPTY if the XnHash isn't empty
- */
- XnStatus SetHashFunction(XnHashFunction hashFunction)
- {
- if (begin() != end())
- {
- return XN_STATUS_IS_NOT_EMPTY;
- }
- m_HashFunction = hashFunction;
- return XN_STATUS_OK;
- }
-
- /**
- * Change the comparison function. The XnHash must be empty for this to succeed.
- *
- * @param compareFunction [in] The new hash function
- *
- * @return XN_STATUS_IS_NOT_EMPTY if the XnHash isn't empty
- */
- XnStatus SetCompareFunction(XnCompareFunction compareFunction)
- {
- if (begin() != end())
- {
- return XN_STATUS_IS_NOT_EMPTY;
- }
- m_CompareFunction = compareFunction;
- return XN_STATUS_OK;
- }
-
-protected:
-
- XnStatus Init()
- {
- m_Bins = XN_NEW_ARR(XnList*, XN_HASH_NUM_BINS);
- XN_VALIDATE_ALLOC_PTR(m_Bins);
-
- for (int i = 0; i < XN_HASH_NUM_BINS; i++)
- {
- m_Bins[i] = NULL;
- }
-
- m_Bins[XN_HASH_LAST_BIN] = XN_NEW(XnList); // We need this for an end() iterator
- m_nMinBin = XN_HASH_LAST_BIN;
-
- XN_VALIDATE_ALLOC_PTR(m_Bins[XN_HASH_LAST_BIN]);
- m_CompareFunction = &XnDefaultCompareFunction;
- m_HashFunction = &XnDefaultHashFunction;
- return XN_STATUS_OK;
- }
-
- /**
- * Get an iterator pointing to the entry to which the key belongs
- *
- * @param key [in] The key of the entry
- * @param hashValue [in] The hash value of the key
- * @param hiter [out] Iterator to the entry described by key
- *
- * @return XN_STATUS_NO_MATCH No such key in the XnHash
- */
- XnStatus Find(const XnKey& key, XnHashValue hashValue, ConstIterator& hiter) const
- {
- if (m_Bins[hashValue] != NULL)
- {
- hiter = ConstIterator(this, hashValue, m_Bins[hashValue]->begin());
- for (XnList::ConstIterator iter = m_Bins[hashValue]->begin();
- iter != m_Bins[hashValue]->end(); ++iter, ++hiter)
- {
- if ((*m_CompareFunction)(key, hiter.Key()) == 0)
- return XN_STATUS_OK;
- }
- }
-
- return XN_STATUS_NO_MATCH;
- }
-
-
- /** Each bin is a XnList */
- XnList** m_Bins;
-
- XnUInt16 m_nMinBin;
-
- /* Status of initialization - could be an error if memory could not be allocated. */
- XnStatus m_nInitStatus;
-
- /** The current hash function */
- XnHashFunction m_HashFunction;
- /** The current comparison function */
- XnCompareFunction m_CompareFunction;
-
-private:
- XN_DISABLE_COPY_AND_ASSIGN(XnHash);
-
- XnStatus ConstFind(const XnKey& key, ConstIterator& hiter) const
- {
- XnHashValue HashValue = (*m_HashFunction)(key);
- return Find(key, HashValue, hiter);
- }
-};
-
-/**
-* Declares a default Key Manager for type @a KeyType. It is given the name @a ClassName.
-* The manager uses the translator @a KeyTranslator, and is declared using the @a decl declspec.
-*/
-#define XN_DECLARE_DEFAULT_KEY_MANAGER_DECL(decl, KeyType, ClassName, KeyTranslator) \
- class decl ClassName \
- { \
- public: \
- inline static XnHashValue Hash(KeyType const& key) \
- { \
- const XnKey _key = KeyTranslator::GetAsValue(key); \
- return XnDefaultHashFunction(_key); \
- } \
- inline static XnInt32 Compare(KeyType const& key1, KeyType const& key2) \
- { \
- const XnKey _key1 = KeyTranslator::GetAsValue(key1); \
- const XnKey _key2 = KeyTranslator::GetAsValue(key2); \
- return XnDefaultCompareFunction(_key1, _key2); \
- } \
- };
-
-/**
-* Declares a default Key Manager for type @a KeyType. It is given the name @a ClassName.
-* The manager uses the translator @a KeyTranslator.
-*/
-#define XN_DECLARE_DEFAULT_KEY_MANAGER(KeyType, ClassName, KeyTranslator) \
- XN_DECLARE_DEFAULT_KEY_MANAGER_DECL(, KeyType, ClassName, KeyTranslator)
-
-/**
-* Declares a hash table from @a KeyType to @a ValueType named @a ClassName. The hash table uses
-* @a KeyTranslator and @a ValueTranslator for storing keys and values, and @a KeyManager for managing the keys.
-* It is declared using the @a decl declspec.
-*/
-#define XN_DECLARE_HASH_DECL(decl, KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator, KeyManager) \
- class decl ClassName : public XnHash \
- { \
- public: \
- class decl ConstIterator : public XnHash::ConstIterator \
- { \
- public: \
- friend class ClassName; \
- inline ConstIterator(const ConstIterator& other) : XnHash::ConstIterator(other) {} \
- inline ConstIterator& operator++() \
- { \
- ++(*(XnHash::ConstIterator*)this); \
- return (*this); \
- } \
- inline ConstIterator operator++(int) \
- { \
- ConstIterator result = *this; \
- ++*this; \
- return result; \
- } \
- inline ConstIterator& operator--() \
- { \
- --(*(XnHash::ConstIterator*)this); \
- return (*this); \
- } \
- inline ConstIterator operator--(int) \
- { \
- ConstIterator result = *this; \
- --*this; \
- return result; \
- } \
- inline KeyType const& Key() const \
- { \
- return KeyTranslator::GetFromValue(XnHash::ConstIterator::Key()); \
- } \
- inline ValueType const& Value() const \
- { \
- return ValueTranslator::GetFromValue(XnHash::ConstIterator::Value()); \
- } \
- protected: \
- inline ConstIterator(const XnHash::ConstIterator& other) : \
- XnHash::ConstIterator(other) {} \
- }; \
- class decl Iterator : public ConstIterator \
- { \
- public: \
- friend class ClassName; \
- inline Iterator(const Iterator& other) : ConstIterator(other) {} \
- inline Iterator& operator++() \
- { \
- ++(*(ConstIterator*)this); \
- return (*this); \
- } \
- inline Iterator operator++(int) \
- { \
- Iterator result = *this; \
- ++*this; \
- return result; \
- } \
- inline Iterator& operator--() \
- { \
- --(*(ConstIterator*)this); \
- return (*this); \
- } \
- inline Iterator operator--(int) \
- { \
- Iterator result = *this; \
- --*this; \
- return result; \
- } \
- inline KeyType& Key() const \
- { \
- return (KeyType&)ConstIterator::Key(); \
- } \
- inline ValueType& Value() const \
- { \
- return (ValueType&)ConstIterator::Value(); \
- } \
- protected: \
- inline Iterator(const XnHash::Iterator& other) : ConstIterator(other) {} \
- }; \
- public: \
- ClassName() \
- { \
- SetHashFunction(Hash); \
- SetCompareFunction(Compare); \
- } \
- virtual ~ClassName() \
- { \
- while (!IsEmpty()) \
- Remove(begin()); \
- } \
- XnStatus Set(KeyType const& key, ValueType const& value) \
- { \
- Iterator oldIt = begin(); \
- if (Find(key, oldIt) == XN_STATUS_OK) \
- { \
- oldIt.Value() = value; \
- } \
- else \
- { \
- XnKey _key = KeyTranslator::CreateValueCopy(key); \
- XnValue _value = ValueTranslator::CreateValueCopy(value); \
- XnStatus nRetVal = XnHash::Set(_key, _value); \
- if (nRetVal != XN_STATUS_OK) \
- { \
- KeyTranslator::FreeValue(_key); \
- ValueTranslator::FreeValue(_value); \
- return (nRetVal); \
- } \
- } \
- return XN_STATUS_OK; \
- } \
- XnStatus Get(KeyType const& key, ValueType& value) const \
- { \
- XnKey _key = KeyTranslator::GetAsValue(key); \
- XnValue _value; \
- XnStatus nRetVal = XnHash::Get(_key, _value); \
- if (nRetVal != XN_STATUS_OK) return (nRetVal); \
- value = ValueTranslator::GetFromValue(_value); \
- return XN_STATUS_OK; \
- } \
- XnStatus Get(KeyType const& key, ValueType*& pValue) const \
- { \
- XnKey _key = KeyTranslator::GetAsValue(key); \
- XnValue _value; \
- XnStatus nRetVal = XnHash::Get(_key, _value); \
- if (nRetVal != XN_STATUS_OK) return (nRetVal); \
- pValue = &ValueTranslator::GetFromValue(_value); \
- return XN_STATUS_OK; \
- } \
- XnStatus Remove(KeyType const& key) \
- { \
- ValueType dummy; \
- return Remove(key, dummy); \
- } \
- XnStatus Remove(KeyType const& key, ValueType& value) \
- { \
- ConstIterator it = end(); \
- XnStatus nRetVal = Find(key, it); \
- if (nRetVal != XN_STATUS_OK) return (nRetVal); \
- value = it.Value(); \
- return Remove(it); \
- } \
- inline XnStatus Remove(ConstIterator iter) \
- { \
- XnKey key = KeyTranslator::GetAsValue(iter.Key()); \
- XnValue value = ValueTranslator::GetAsValue(iter.Value()); \
- XnStatus nRetVal = XnHash::Remove(iter); \
- if (nRetVal != XN_STATUS_OK) return (nRetVal); \
- KeyTranslator::FreeValue(key); \
- ValueTranslator::FreeValue(value); \
- return XN_STATUS_OK; \
- } \
- XnStatus Find(KeyType const& key, ConstIterator& hiter) const \
- { \
- XnKey _key = KeyTranslator::GetAsValue(key); \
- XnHash::ConstIterator it = XnHash::end(); \
- XnStatus nRetVal = XnHash::Find(_key, it); \
- if (nRetVal != XN_STATUS_OK) return (nRetVal); \
- hiter = it; \
- return XN_STATUS_OK; \
- } \
- XnStatus Find(KeyType const& key, Iterator& hiter) \
- { \
- XnKey _key = KeyTranslator::GetAsValue(key); \
- XnHash::Iterator it = XnHash::end(); \
- XnStatus nRetVal = XnHash::Find(_key, it); \
- if (nRetVal != XN_STATUS_OK) return (nRetVal); \
- hiter = it; \
- return XN_STATUS_OK; \
- } \
- inline Iterator begin() { return XnHash::begin(); } \
- inline ConstIterator begin() const { return XnHash::begin(); } \
- inline Iterator end() { return XnHash::end(); } \
- inline ConstIterator end() const { return XnHash::end(); } \
- protected: \
- virtual XnStatus Remove(XnHash::ConstIterator iter) \
- { \
- return Remove(ConstIterator(iter)); \
- } \
- inline static XnHashValue Hash(const XnKey& key) \
- { \
- KeyType const& _key = KeyTranslator::GetFromValue(key); \
- return KeyManager::Hash(_key); \
- } \
- inline static XnInt32 Compare(const XnKey& key1, const XnKey& key2) \
- { \
- KeyType const _key1 = KeyTranslator::GetFromValue(key1); \
- KeyType const _key2 = KeyTranslator::GetFromValue(key2); \
- return KeyManager::Compare(_key1, _key2); \
- } \
- private: \
- XN_DISABLE_COPY_AND_ASSIGN(ClassName); \
- };
-
-/**
-* Declares a hash table from @a KeyType to @a ValueType named @a ClassName. The hash table uses
-* @a KeyTranslator and @a ValueTranslator for storing keys and values, and @a KeyManager for managing the keys.
-*/
-#define XN_DECLARE_HASH(KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator, KeyManager) \
- XN_DECLARE_HASH_DECL(, KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator, KeyManager)
-
-#define _XN_DEFAULT_KEY_MANAGER_NAME(ClassName) _##ClassName##Manager
-
-/**
-* Declares a hash table from @a KeyType to @a ValueType named @a ClassName. The hash table uses
-* @a KeyTranslator and @a ValueTranslator for storing keys and values. It declares and uses a default manager.
-* It is declared using the @a decl declspec.
-*/
-#define XN_DECLARE_DEFAULT_MANAGER_HASH_DECL(decl, KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator) \
- XN_DECLARE_DEFAULT_KEY_MANAGER_DECL(decl, KeyType, _XN_DEFAULT_KEY_MANAGER_NAME(ClassName), KeyTranslator) \
- XN_DECLARE_HASH_DECL(decl, KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator, _XN_DEFAULT_KEY_MANAGER_NAME(ClassName))
-
-/**
-* Declares a hash table from @a KeyType to @a ValueType named @a ClassName. The hash table uses
-* @a KeyTranslator and @a ValueTranslator for storing keys and values. It declares and uses a default manager.
-*/
-#define XN_DECLARE_DEFAULT_MANAGER_HASH(decl, KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator) \
- XN_DECLARE_DEFAULT_MANAGER_HASH_DECL(, KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator)
-
-#define _XN_DEFAULT_KEY_TRANSLATOR(ClassName) _##ClassName##KeyTranslator
-#define _XN_DEFAULT_VALUE_TRANSLATOR(ClassName) _##ClassName##ValueTranslator
-
-/**
-* Declares a hash table from @a KeyType to @a ValueType named @a ClassName. The hash table uses
-* default translators for storing keys and values. It declares and uses a default manager.
-* It is declared using the @a decl declspec.
-*/
-#define XN_DECLARE_DEFAULT_HASH_DECL(decl, KeyType, ValueType, ClassName) \
- XN_DECLARE_DEFAULT_VALUE_TRANSLATOR_DECL(decl, KeyType, _XN_DEFAULT_KEY_TRANSLATOR(ClassName)) \
- XN_DECLARE_DEFAULT_VALUE_TRANSLATOR_DECL(decl, ValueType, _XN_DEFAULT_VALUE_TRANSLATOR(ClassName)) \
- XN_DECLARE_DEFAULT_MANAGER_HASH_DECL(decl, KeyType, ValueType, ClassName, _XN_DEFAULT_KEY_TRANSLATOR(ClassName), _XN_DEFAULT_VALUE_TRANSLATOR(ClassName))
-
-/**
-* Declares a hash table from @a KeyType to @a ValueType named @a ClassName. The hash table uses
-* default translators for storing keys and values. It declares and uses a default manager.
-*/
-#define XN_DECLARE_DEFAULT_HASH(KeyType, ValueType, ClassName) \
- XN_DECLARE_DEFAULT_HASH_DECL(, KeyType, ValueType, ClassName)
-
-#endif // _XN_HASH_H
diff --git a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnHashT.h b/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnHashT.h
deleted file mode 100644
index 7708fd45..00000000
--- a/tests/manual/kinectsurface/QtKinectWrapper/OpenNI/Include/XnHashT.h
+++ /dev/null
@@ -1,668 +0,0 @@
-#ifndef _XN_HASH_T_H_
-#define _XN_HASH_T_H_
-
-//---------------------------------------------------------------------------
-// Includes
-//---------------------------------------------------------------------------
-#include <XnOS.h>
-#include <XnListT.h>
-
-//---------------------------------------------------------------------------
-// Defines
-//---------------------------------------------------------------------------
-typedef XnUInt8 XnHashCode;
-
-//---------------------------------------------------------------------------
-// Code
-//---------------------------------------------------------------------------
-template<class _TKey, class _TValue>
-struct XnKeyValuePair
-{
- typedef _TKey TKey;
- typedef _TValue TValue;
-
- XnKeyValuePair() : key(TKey()), value(TValue()) {}
- XnKeyValuePair(TKey key, TValue value) : key(key), value(value) {}
- XnKeyValuePair(const XnKeyValuePair& other) : key(other.key), value(other.value) {}
-
-public:
- TKey const& Key() const { return key; }
- TValue const& Value() const { return value; }
- TValue& Value() { return value; }
-
-private:
- TKey key;
- TValue value;
-};
-
-template<class TKey>
-class XnDefaultKeyManagerT
-{
-public:
- static XnHashCode Hash(TKey const& key)
- {
- return (((XnSizeT)key) & 0xff);
- }
-
- static XnInt32 Compare(TKey const& key1, TKey const& key2)
- {
- return XnInt32(XnSizeT(key1)-XnSizeT(key2));
- }
-};
-
-template<class TKey,
- class TValue,
- class TKeyManager = XnDefaultKeyManagerT<TKey>,
- class TAlloc = XnLinkedNodeDefaultAllocatorT<XnKeyValuePair<TKey, TValue> > >
-class XnHashT
-{
-public:
- typedef XnKeyValuePair<TKey, TValue> TPair;
- typedef XnListT<TPair, TAlloc> TPairList;
-
- enum
- {
- LAST_BIN = (1 << (sizeof(XnHashCode)*8)),
- NUM_BINS = LAST_BIN + 1,
- };
-
- class ConstIterator
- {
- public:
- ConstIterator() : m_ppBins(NULL), m_nCurrBin(0)
- {}
-
- ConstIterator(TPairList* const* apBins, XnUInt32 nCurrBin, typename TPairList::ConstIterator currIt)
- : m_ppBins(apBins), m_nCurrBin(nCurrBin), m_currIt(currIt)
- {
- if (nCurrBin != LAST_BIN && m_currIt == m_ppBins[m_nCurrBin]->End())
- {
- // this does not point to an actual entry. run to next one.
- ++*this;
- }
- }
-
- ConstIterator(const ConstIterator& other)
- : m_ppBins(other.m_ppBins), m_nCurrBin(other.m_nCurrBin), m_currIt(other.m_currIt)
- {}
-
- /**
- * Support ++iterator, go to the next object in the list
- */
- ConstIterator& operator++()
- {
- XN_ASSERT(m_nCurrBin != LAST_BIN);
-
- // increment internal bin iterator
- if (m_currIt != m_ppBins[m_nCurrBin]->End())
- {
- ++m_currIt;
- }
-
- // check if we need to move to next bin
- if (m_currIt == m_ppBins[m_nCurrBin]->End())
- {
- // go forward through bins, until we either reach the end or a non-empty bin
- do
- {
- ++m_nCurrBin;
- } while (m_nCurrBin < LAST_BIN &&
- (m_ppBins[m_nCurrBin] == NULL || m_ppBins[m_nCurrBin]->IsEmpty()));
-
- m_currIt = m_ppBins[m_nCurrBin]->Begin();
- }
-
- return *this;
- }
-
- /**
- * Support iterator++, go to the next object in the list, returning the old value
- */
- ConstIterator operator++(int)
- {
- ConstIterator retVal(*this);
- ++*this;
- return retVal;