Skip to content
Browse files

Updated baseline to 1.1.0.38.

  • Loading branch information...
1 parent 543dcc2 commit f0e60ef0836f90e94087faa950940f1ab07d034f @OpenNI committed Apr 14, 2011
Showing with 18,270 additions and 3,020 deletions.
  1. +148 −0 CHANGES
  2. +3 −6 Data/SamplesConfig.xml
  3. BIN Documentation/OpenNI.chm
  4. BIN Documentation/OpenNI_UserGuide.pdf
  5. +166 −0 Include/ARC/XnOSARC.h
  6. +186 −0 Include/ARC/XnPlatformARC.h
  7. +21 −24 Include/IXnNodeAllocator.h
  8. +21 −25 Include/Linux-Arm/XnPlatformLinux-Arm.h
  9. +30 −26 Include/Linux-x86/XnOSLinux-x86.h
  10. +22 −26 Include/Linux-x86/XnPlatformLinux-x86.h
  11. +43 −0 Include/MacOSX/XnPlatformMacOSX.h
  12. +28 −26 Include/Win32/XnOSWin32.h
  13. +22 −26 Include/Win32/XnPlatformWin32.h
  14. +81 −0 Include/XnAlgorithms.h
  15. +313 −0 Include/XnArray.h
  16. +21 −25 Include/XnBaseNode.h
  17. +114 −0 Include/XnBitSet.h
  18. +24 −27 Include/XnCallback.h
  19. +21 −23 Include/XnCodecIDs.h
  20. +40 −27 Include/XnContext.h
  21. +759 −107 Include/XnCppWrapper.h
  22. +21 −25 Include/XnDataTypes.h
  23. +21 −25 Include/XnEnumerationErrors.h
  24. +41 −29 Include/XnEvent.h
  25. +21 −25 Include/XnFPSCalculator.h
  26. +22 −25 Include/XnGeneralBuffer.h
  27. +32 −30 Include/XnHash.h
  28. +21 −23 Include/XnInternalDefs.h
  29. +21 −25 Include/XnLicensing.h
  30. +40 −27 Include/XnList.h
  31. +53 −91 Include/XnLog.h
  32. +21 −25 Include/XnMacros.h
  33. +1,733 −0 Include/XnModuleCFunctions.h
  34. +101 −34 Include/XnModuleCppInterface.h
  35. +158 −1,439 Include/XnModuleCppRegistratration.h
  36. +225 −52 Include/XnModuleInterface.h
  37. +21 −25 Include/XnNode.h
  38. +21 −24 Include/XnNodeAllocator.h
  39. +62 −63 Include/XnOS.h
  40. +48 −27 Include/XnOSCpp.h
  41. +47 −0 Include/XnOSMemory.h
  42. +45 −0 Include/XnOSStrings.h
  43. +21 −24 Include/XnOpenNI.h
  44. +28 −25 Include/XnPlatform.h
  45. +320 −25 Include/XnPrdNode.h
  46. +35 −25 Include/XnPrdNodeInfo.h
  47. +36 −26 Include/XnPrdNodeInfoList.h
  48. +21 −25 Include/XnProfiling.h
  49. +22 −23 Include/XnPropNames.h
  50. +21 −25 Include/XnQueries.h
  51. +21 −25 Include/XnQueue.h
  52. +21 −25 Include/XnScheduler.h
  53. +21 −25 Include/XnStack.h
  54. +24 −28 Include/XnStatus.h
  55. +23 −25 Include/XnStatusCodes.h
  56. +21 −25 Include/XnStatusRegister.h
  57. +31 −27 Include/XnStringsHash.h
  58. +21 −24 Include/XnThreadSafeQueue.h
  59. +113 −28 Include/XnTypes.h
  60. +29 −27 Include/XnUSB.h
  61. +65 −26 Include/XnUtils.h
  62. +23 −27 Include/XnVersion.h
  63. +1,618 −0 Platform/ARC/Build/Modules/nimCodecs/.cproject
  64. +106 −0 Platform/ARC/Build/Modules/nimCodecs/.project
  65. +1,605 −0 Platform/ARC/Build/Modules/nimMockNodes/.cproject
  66. +97 −0 Platform/ARC/Build/Modules/nimMockNodes/.project
  67. +1,610 −0 Platform/ARC/Build/Modules/nimRecorder/.cproject
  68. +102 −0 Platform/ARC/Build/Modules/nimRecorder/.project
  69. +3,903 −0 Platform/ARC/Build/OpenNI/.cproject
  70. +105 −0 Platform/ARC/Build/OpenNI/.project
  71. +1,611 −0 Platform/ARC/Build/Samples/NiSimpleRead/.cproject
  72. +100 −0 Platform/ARC/Build/Samples/NiSimpleRead/.project
  73. +51 −3 Platform/Linux-x86/Build/CommonMakefile
  74. +1 −0 Platform/Linux-x86/Build/Make.4100
  75. +37 −4 Platform/Linux-x86/Build/Makefile
  76. +151 −0 Platform/Linux-x86/Build/Makefile.4100
  77. +12 −1 Platform/Linux-x86/Build/OpenNI/Makefile
  78. BIN Platform/Linux-x86/Build/Prerequisites/libusb-1.0.8-osx.tar.bz2
  79. +34 −0 Platform/Linux-x86/Build/Res/AssemblyInfo-OpenNI.cs
  80. BIN Platform/Linux-x86/Build/Res/mainicon.ico
  81. +10 −1 Platform/Linux-x86/Build/Samples/NiSimpleViewer/Makefile
  82. +19 −2 Platform/Linux-x86/Build/Samples/NiUserTracker/Makefile
  83. +10 −1 Platform/Linux-x86/Build/Samples/NiViewer/Makefile
  84. +11 −0 Platform/Linux-x86/Build/Samples/SimpleRead.net/Makefile
  85. +13 −0 Platform/Linux-x86/Build/Samples/SimpleViewer.net/Makefile
  86. +13 −0 Platform/Linux-x86/Build/Samples/UserTracker.net/Makefile
  87. +11 −0 Platform/Linux-x86/Build/Wrappers/OpenNI.net/Makefile
  88. BIN Platform/Linux-x86/Build/Wrappers/OpenNI.net/OpenNI.snk
  89. +1 −1 Platform/Linux-x86/CreateRedist/RedistMaker
  90. +118 −42 Platform/Linux-x86/CreateRedist/Redist_OpenNi.py
  91. +20 −3 Platform/Linux-x86/CreateRedist/install.sh
  92. BIN Platform/Win32/Bin64/Debug/glut64.dll
  93. BIN Platform/Win32/Bin64/Release/glut64.dll
  94. +173 −10 Platform/Win32/Build/Modules/nimCodecs/nimCodecs.vcproj
  95. +175 −10 Platform/Win32/Build/Modules/nimMockNodes/nimMockNodes.vcproj
  96. +173 −10 Platform/Win32/Build/Modules/nimRecorder/nimRecorder.vcproj
  97. +183 −0 Platform/Win32/Build/OpenNI.sln
  98. +214 −9 Platform/Win32/Build/OpenNI/OpenNI.vcproj
  99. BIN Platform/Win32/Build/Prerequisites/nsis-2.46-strlen_8192.zip
  100. +34 −0 Platform/Win32/Build/Res/AssemblyInfo-OpenNI.cs
  101. +21 −23 Platform/Win32/Build/Res/Resource-OpenNI.h
  102. +173 −8 Platform/Win32/Build/Samples/NiAudioSample/NiAudioSample.vcproj
Sorry, we could not display the entire diff because too many files (525) changed.
View
148 CHANGES
@@ -0,0 +1,148 @@
+Detailed Change log:
+--------------------
+
+Version 1.1.0.38 (Stable version - Apr 11th 2010)
+-------------------------------------------------
+ * Fixed .NET requirements in the Win32 installer.
+ * Linux Bug Fix: xnOS timeouts did not work well, causing ISO mode to get stuck sometimes when closing the device.
+ * Linux Bug Fix: closing the device in BULK mode causes server to get stuck.
+ * Allow different install paths - one for 32-bit applications and one for 64-bit applications.
+ * Bug Fix: seeking in a file which has a generator node with no frames causes a crash.
+ * Project dependencies were missing for Win32 VS2010 RedistMaker.
+ * Removed the win32 vcredist from the tools directory. it's no longer needed since the redist is supplied by the new MSI installer.
+ * Memory Profiling: fixed it to work. Also - added an optional dump that tracks every alloc and free.
+ * .NET wrapper: fixed reference handling of objects: Have a map of wrapped contexts, each holding a map of wrapped nodes. That way, there is no chance of garbage collection of a needed object.
+ * OpenNI.NET: Fix memory errors caused by bad marshaling of strings.
+ * Adding some info about every created node in the log file.
+ * Fix Supported Pixels struct.
+ * Adding new capabilities to .NET wrappers.
+ * DirectShow filter: adding a new property page to handle additional OpenNI capabilities.
+ * xnWaitForCondition - no need to get timeout from outside. Always use XN_NODE_WAIT_FOR_DATA_TIMEOUT.
+ * Added 64bit support for the installers
+ * Added support for MJPEG image format.
+ * Adding a flow dump to the DirectShow filter.
+ * Adding CMOS capabilities interfaces.
+ * Fix for UAC installer problems.
+ * Fix enumeration so that same vendor and name with a higher version will appear before an older version.
+ * .NET wrappers now supports 64-bit.
+ * playback speed: added a sanity check so that sleep will never be more than 2 seconds...
+ * Changing installation to Windows Installer XML Toolset.
+ * Device Identification Capability: adding API for getting device name, vendor specific data, and serial number.
+ * Renamed XnArray::Add() to XnArray::Set()
+ * Added APIs of SaveCalibrationDataToFile and LoadCalibrationDataFromFile to UserGenerator's SkeletonCapability
+ * Added Save/Load calibration from files to UserTracker sample. Use 'S' and 'L' (capital)
+ * Fixed method validation in some functions
+ * .NET wrappers Bug Fix: CodecID ctor would generate the wrong ID.
+ * .NET wrappers - changes in API to make it more .NET standard.
+ * NiViewer: fix user message while recording.
+ * NiViewer: Skip first frame when starting recording after the open file dialog was opened.
+ * xnOSLoadLibrary now looks for dependencies in the same folder.
+ * xnOSCreateProcess now starts the process in the EXE directory.
+ * Context init is now thread-safe (there were problems because of use of current directory)
+ * Bug Fix: no error is returned if trying to SetDestination() on an already recording node.
+ * XnBitSet: Added function SetSize(), IsSet() now checks index boundary
+ * XnGeneralBuffer: XnGeneralBufferFree() now sets data pointer to NULL after freeing it
+ * Fixed some level 4 warnings
+ * NiConvertXToONI sample: Added command line arguments that enables taking a specific node from recording and specific range of frames.
+ * Bug Fix: C++ wrappers was missing GetBytesPerPixel() method.
+ * Adding some resolutions.
+ * Adding a DirectShow Video Capture Source filter, so that ImageGenerators can be used in messaging applications (Skype, Messenger, etc.)
+ * Added semaphores to XnOS: see xnOSCreateSemaphore().
+ * Added XnOS semaphores implementation - only for windows at this point.
+ * Fixed NULL checks in xnOSStrCmp and xnOSStrCaseCmp: they used the XN_VALIDATE_INPUT_PTR macro but the function return value is not XnStatus. Also added ASSERTs.
+ * In .net wrappers, Joint information as structs, and usable orientation
+ * In NiUserTracker, don't use WaitAndUpdateAll, use One instead
+ * Renamed XnBitSet::Get() to XnBitSet::IsSet()
+ * Adding GetBytesPerPixel to MapGenerator.
+ * Adding default implementation in Module C++ interfaces for GetData and GetBytesPerPixel for various node types.
+ * Adding ExtensionModule class to support registering extensions.
+ * Change all type switches to checking type hierarchy.
+ * Adding NiSampleExtensionModule - a sample module which creates an extension.
+ * Adding NiUseExtension - a sample that uses above extension.
+ * Added Uncompressed format for recording depth in NiViewer
+ * Adding CreateDevice method.
+ * Unifying node type and hierarchy type.
+ * Adding XnTypeManager: manages all OpenNI types: both built-in ones and extensions.
+ * Changing GetData() function to return a const pointer.
+ * Adding support in ModuleLoader for older modules which did not have the GetData() method.
+ * Adding Version class to C++ wrappers.
+ * Fixing IsJointActive() signature in C++ wrappers.
+ * Changed in XN_EXPORT_NODE macros to accept node type (in addition to different macros for different types).
+ * Adding xnRegisterExtensionNode (instead of xnRegisterNewNode which needed a context).
+ * Adding an option in the XML to set repeat for playback.
+ * XnUSBWin32: Added a EP reset before each read/write/queue command.
+ * Fix a playback speed bug where the first frame in the file would always sleep till its timestamp.
+ * XnUSBWin32: Fixed a problem where the endpoint set property command did not work on overlapped I/O endpoints.
+ * Adding XnBitSet - Holds a set of bits that can be individually get/set
+ * Added XnArray - self-growing array
+ * Added General GetData() function to Generator
+ * Added ability to expose a general generator with XN_EXPORT_GENERATOR
+ * XnProductionNodeType is now defined to be Int32 rather than enum - to support extensions.
+ * Fixing seek and playbackSpeed problems.
+ * Making types packed even if no shared libs (types might be used in recordings...)
+ * OpenNI: Adding support for platforms which does not have shared libraries.
+ * Playback speed: Worked around for bad recordings where timestamps sometimes go backwards.
+ * AutoCSLocker - adding copy ctor and operator=. Also adding some asserts to make sure operation succeeded.
+ * C++ wrappers: adding GetXCapability() const versions.
+ * Bug Fix: played nodes (from recordings) weren't really locked. They remained unlock for creating thread (the thread that called context.Init()).
+ * Bug Fix: Seek() did not work properly (it would sometimes go to wrong frame).
+ * The linux redist script will now do a full rebuild and also use the gacutil to clean old installs of OpenNI.net
+ * Added a new argument to the win32 redist script that allows a full rebuild to be made.
+ * The win32 redist script will now use the gacutil to clean old installs of the OpenNI.net wrapper.
+ * Bug Fix: trying to play an empty ONI file (no data) results in stack overflow.
+ * NiViewer: change default audio capturing format to uncompressed.
+ * Better management of timestamps in recordings:
+ 1. When writing frames, nodes are sorted according to timestamp.
+ 2. Recorder now holds timestamp of the first data it received. All other timestamps are computer accordingly.
+ * NiViewer: adding the option to choose which device to open by using the "-devices" switch.
+ * C++ wrappers: making some methods const.
+ * NiViewer Bug Fix: start recording with delay recorder while counting back... (this was because once nodes were added, the WaitOneUpdateAll() also called Record()).
+ * API fix: Mock nodes SetData() method should take a const MetaData object.
+ * Changing default XML file:
+ 1. Mark image node as stopOnError=false.
+ 2. Remove resolution. Let vendor decide its defaults.
+ * Adding an option to the XML to mark nodes as "stopOnError", which means if they can't be created, the XML script will continue to run.
+ * Win32 USB Driver changes:
+ 1. All refs of PrimeSensor were changed to PrimeSense Sensor
+ 2. Upgraded the driver from vista (WLH) to windows 7 (Win7) env.
+ 3. Upgraded the WinDDK from 7600.16385.0 (7.0) to 7600.16385.1 (7.1)
+ 4. Upgraded dpinst to the latest version.
+ 5. Added support for isochronous writes.
+ 6. Changed version from 3.1.0.4 to 3.1.1.0.
+ * Fixing C sample to free resources.
+ * Bug Fix: DataIndex record would always cause an assertion when the file loops.
+
+Version 1.0.0.25 (Unstable version - Jan 10th 2011)
+---------------------------------------------------
+ * Fixed a bug in XnUSB-Win32 where it return any USB devices that were associated with the driver and not only the requested VID/PID.
+ * Added OpenNI.net samples to Linux redist
+ * Renamed OpenNI.dll to OpenNI.net.dll on Linux so it will be the same name as Windows
+ * OpenNI.net is now installed to the GAC.
+ * Added proper support for OpenNI.net on Linux/Mac.
+ * .Net samples: handle errors correctly.
+ * Adding icons to C# samples.
+ * Added MacOSX platform support.
+ * Bug Fix: Xml query for max version checked the min version.
+ * Added the unstable README file.
+ * Bug Fix: when using WaitXUpdateAll, the MetaData of a non-updated node would not change its IsDataNew flag.
+ * Linux Bug Fix: xnOSCreateProcess() would cause zombie processes.
+ * Adding log functions to C# wrapper.
+ * Bug Fix: a bug in libusb caused bad calculation of max packet size of an endpoint, resulting in many lost frames in BULK mode.
+ * NiViewer Bug Fix: in background removal mode (6), there was no support for cropping, causing a crash.
+ * NiViewer Bug Fix on Linux: multiline messages are not displayed properly (they are cut)
+ * API change: renamed Ref() and Unref() to AddRef() and Release(). Old functions were left (so that API is not broken), but are marked as deprecated.
+ * NiBackRecorder: use MockDepthGenerator.SetData() instead of setting properties
+ * MockSetData now doesn't wait, but updates data immediately (this is useful when the synthetic data is with invalid size - no need to wait 2 seconds to get the error).
+ * Added validity checks to XnModuleCppRegistratration.h (calling a function without checking if capability is supported might cause a crash).
+ * Adding PlaybackSpeed functionality to Player.
+ * Adding .net wrappers.
+ * C++ wrappers: Make sure NULL callbacks aren't called
+ * UserTracker sample: print why enumeration failed.
+ * Seek optimization: adding data index to each node in ONI files. The data index is read when file is opened, and seeking can be done a lot faster.
+ * XnUSB: added an API for enumerating and opening a sensor by device path.
+ * Shared memory bug fix: failed to create shared memory if name contained backslash.
+ * C++ wrappers Bug Fix: RegisterToGestureChange would register to pixel format change.
+
+Version 1.0.0.23 (Stable version - Dec 8th 2010)
+-----------------------------------------------------
+* Initial release...
View
9 Data/SamplesConfig.xml
@@ -14,21 +14,18 @@
</Dumps>
</Log>
<ProductionNodes>
- <Node type="Image" name="Image1">
+ <Node type="Depth" name="Depth1">
<Configuration>
- <MapOutputMode xRes="640" yRes="480" FPS="30"/>
<Mirror on="true"/>
</Configuration>
</Node>
- <Node type="Depth" name="Depth1">
+ <Node type="Image" name="Image1" stopOnError="false">
<Configuration>
- <MapOutputMode xRes="640" yRes="480" FPS="30"/>
<Mirror on="true"/>
</Configuration>
</Node>
<!--
- <Node type="Audio" name="Audio1">
- </Node>
+ <Node type="Audio" name="Audio1"/>
-->
</ProductionNodes>
</OpenNI>
View
BIN Documentation/OpenNI.chm
Binary file not shown.
View
BIN Documentation/OpenNI_UserGuide.pdf
Binary file not shown.
View
166 Include/ARC/XnOSARC.h
@@ -0,0 +1,166 @@
+/****************************************************************************
+* *
+* 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_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_
View
186 Include/ARC/XnPlatformARC.h
@@ -0,0 +1,186 @@
+/****************************************************************************
+* *
+* 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_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)
+
+/** Declares a global shared library export function. */
+#define XN_API_EXPORT_INIT()
+
+#define XN_DEPRECATED_WARNING_IDS 1
+
+#endif //_XN_PLATFORM_ARC_H_
+
View
45 Include/IXnNodeAllocator.h
@@ -1,27 +1,24 @@
-/*****************************************************************************
-* *
-* OpenNI 1.0 Alpha *
-* Copyright (C) 2010 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 _ININODEALLOCATOR_H
#define _ININODEALLOCATOR_H
View
46 Include/Linux-Arm/XnPlatformLinux-Arm.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* OpenNI 1.0 Alpha *
-* Copyright (C) 2010 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_PLATFORM_LINUX_ARM_H_
#define _XN_PLATFORM_LINUX_ARM_H_
View
56 Include/Linux-x86/XnOSLinux-x86.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* OpenNI 1.0 Alpha *
-* Copyright (C) 2010 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_OSLINUX_X86_H_
#define _XN_OSLINUX_X86_H_
@@ -45,7 +41,8 @@ typedef void* XN_HANDLE;
/** A file handle type. */
typedef XnInt XN_FILE_HANDLE;
-static const XN_FILE_HANDLE XN_INVALID_FILE_HANDLE = -1;
+/** 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 "./"
@@ -144,6 +141,13 @@ 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. */
View
48 Include/Linux-x86/XnPlatformLinux-x86.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* OpenNI 1.0 Alpha *
-* Copyright (C) 2010 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_PLATFORM_LINUX_X86_H_
#define _XN_PLATFORM_LINUX_X86_H_
@@ -67,7 +63,7 @@ typedef unsigned char XnUChar;
typedef wchar_t XnWChar;
/** 8-bit signed integer. */
-typedef char XnInt8;
+typedef signed char XnInt8;
/** 8-bit unsigned integer. */
typedef unsigned char XnUInt8;
View
43 Include/MacOSX/XnPlatformMacOSX.h
@@ -0,0 +1,43 @@
+/****************************************************************************
+* *
+* 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_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_
View
54 Include/Win32/XnOSWin32.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* OpenNI 1.0 Alpha *
-* Copyright (C) 2010 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_OS_WIN32_H__
#define __XN_OS_WIN32_H__
@@ -68,7 +64,7 @@ typedef HANDLE XN_HANDLE;
typedef HANDLE XN_FILE_HANDLE;
/** The value of an invalid file handle. */
-static const XN_FILE_HANDLE XN_INVALID_FILE_HANDLE = INVALID_HANDLE_VALUE;
+#define XN_INVALID_FILE_HANDLE INVALID_HANDLE_VALUE
/** A string that specifies the current directory. */
#define XN_FILE_LOCAL_DIR ".\\"
@@ -156,6 +152,12 @@ typedef CRITICAL_SECTION* XN_CRITICAL_SECTION_HANDLE;
typedef HANDLE XN_EVENT_HANDLE;
//---------------------------------------------------------------------------
+// Semaphores
+//---------------------------------------------------------------------------
+/** A Xiron semaphore type. */
+typedef HANDLE XN_SEMAPHORE_HANDLE;
+
+//---------------------------------------------------------------------------
// Timer
//---------------------------------------------------------------------------
/** The Xiron OS timer structure. */
View
48 Include/Win32/XnPlatformWin32.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* OpenNI 1.0 Alpha *
-* Copyright (C) 2010 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_PLATFORM_WIN32_H_
#define _XN_PLATFORM_WIN32_H_
@@ -92,7 +88,7 @@ typedef unsigned char XnUChar;
typedef wchar_t XnWChar;
/** 8-bit signed integer. */
-typedef char XnInt8;
+typedef signed char XnInt8;
/** 8-bit unsigned integer. */
typedef unsigned char XnUInt8;
View
81 Include/XnAlgorithms.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+* *
+* 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_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__
View
313 Include/XnArray.h
@@ -0,0 +1,313 @@
+/****************************************************************************
+* *
+* 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 __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()
+ {
+ Init();
+ }
+
+ /** 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 itertor pointing to the beginning of this array. **/
+ Iterator begin()
+ {
+ return &m_pData[0];
+ }
+
+ /** @returns a const itertor 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()
+ {
+ m_pData = XN_NEW_ARR(T, BASE_SIZE);
+ m_nAllocatedSize = BASE_SIZE;
+ m_nSize = 0;
+ }
+
+ T* m_pData;
+ XnUInt32 m_nSize;
+ XnUInt32 m_nAllocatedSize;
+};
+
+#endif // __XNARRAY_H__
View
46 Include/XnBaseNode.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* OpenNI 1.0 Alpha *
-* Copyright (C) 2010 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 _NINODEALLOC_H
#define _NINODEALLOC_H
//---------------------------------------------------------------------------
View
114 Include/XnBitSet.h
@@ -0,0 +1,114 @@
+/****************************************************************************
+* *
+* 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 __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;
+ }
+
+ /** @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 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__
View
51 Include/XnCallback.h
@@ -1,27 +1,24 @@
-/*****************************************************************************
-* *
-* OpenNI 1.0 Alpha *
-* Copyright (C) 2010 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_CALLBACK_H__
#define __XN_CALLBACK_H__
@@ -34,10 +31,10 @@
struct XnCallback
{
XnCallback() : pFuncPtr(NULL), pCookie(NULL) {}
- XnCallback(void* pFuncPtr, void* pCookie) : pFuncPtr(pFuncPtr), pCookie(pCookie) {}
- void Set(void* pFuncPtr, void* pCookie) { this->pFuncPtr = pFuncPtr; this->pCookie = pCookie; }
+ XnCallback(XnFuncPtr pFuncPtr, void* pCookie) : pFuncPtr(pFuncPtr), pCookie(pCookie) {}
+ void Set(XnFuncPtr pFuncPtr, void* pCookie) { this->pFuncPtr = pFuncPtr; this->pCookie = pCookie; }
- void* pFuncPtr;
+ XnFuncPtr pFuncPtr;
void* pCookie;
};
View
44 Include/XnCodecIDs.h
@@ -1,26 +1,24 @@
-/*****************************************************************************
-* *
-* OpenNI 1.0 Alpha *
-* Copyright (C) 2010 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 __NICODECIDS_H__
#define __NICODECIDS_H__
View
67 Include/XnContext.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* OpenNI 1.0 Alpha *
-* Copyright (C) 2010 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_CONTEXT_H__
#define __XN_CONTEXT_H__
@@ -246,15 +242,32 @@ XN_C_API XnStatus xnCreateMockNodeBasedOn(
*
* @param hNode [in] A handle to the node.
*/
-XN_C_API XnStatus xnRefProductionNode(XnNodeHandle hNode);
+XN_C_API XnStatus 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.") 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 xnUnrefProductionNode(XnNodeHandle hNode);
+XN_C_API void 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.") xnUnrefProductionNode(XnNodeHandle hNode);
/**
* @brief Gets a list of all existing node in the context. Each node that was returned increases its ref count.
View
866 Include/XnCppWrapper.h
@@ -1,28 +1,24 @@
-/*****************************************************************************
-* *
-* OpenNI 1.0 Alpha *
-* Copyright (C) 2010 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_CPP_WRAPPER_H__
#define __XN_CPP_WRAPPER_H__
@@ -75,6 +71,49 @@ namespace xn
static void _UnregisterFromStateChange(_XnUnregisterStateChangeFuncPtr xnFunc, XnNodeHandle hNode, XnCallbackHandle hCallback);
//---------------------------------------------------------------------------
+ // Some Utilities
+ //---------------------------------------------------------------------------
+ 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);
+ }
+ private:
+ XnVersion m_version;
+ };
+
+ //---------------------------------------------------------------------------
// Meta Data
//---------------------------------------------------------------------------
@@ -290,6 +329,8 @@ namespace xn
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;
@@ -959,11 +1000,15 @@ namespace xn
*
* @param hNode [in] A node handle.
*/
- inline NodeWrapper(XnNodeHandle hNode)
+ inline NodeWrapper(XnNodeHandle hNode) : m_hNode(NULL)
{
NodeWrapper::SetHandle(hNode);
}
+ inline ~NodeWrapper()
+ {
+ }
+
/// Gets the underlying C handle.
inline operator XnNodeHandle() const { return m_hNode; }
@@ -995,8 +1040,25 @@ namespace xn
*/
const XnChar* GetName() const {return xnGetNodeName(m_hNode); }
+ /** @copybrief xnProductionNodeAddRef
+ * For full details and usage, see @ref xnProductionNodeAddRef
+ */
+ inline XnStatus AddRef() { return xnProductionNodeAddRef(m_hNode); }
+
+ /** @copybrief xnProductionNodeRelease
+ * For full details and usage, see @ref xnProductionNodeRelease
+ */
+ inline void Release()
+ {
+ xnProductionNodeRelease(m_hNode);
+ m_hNode = NULL;
+ }
+
+ inline XnStatus XN_API_DEPRECATED("Please use AddRef() instead.") Ref() { return AddRef(); }
+ inline void XN_API_DEPRECATED("Please use Release() instead.") Unref() { Release(); }
+
/// Replaces the object being pointed.
- virtual void SetHandle(XnNodeHandle hNode) { m_hNode = hNode; }
+ inline void SetHandle(XnNodeHandle hNode) { m_hNode = hNode; }
protected:
XnNodeHandle m_hNode;
@@ -1101,6 +1163,14 @@ namespace xn
*/
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);
+ }
+
private:
inline void SetUnderlyingObject(XnNodeInfo* pInfo);
@@ -1369,13 +1439,21 @@ namespace xn
/** @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
*/
@@ -1519,7 +1597,7 @@ namespace xn
/** @copybrief xnGetNodeErrorState
* For full details and usage, see @ref xnGetNodeErrorState
*/
- inline XnStatus GetErrorState()
+ inline XnStatus GetErrorState() const
{
return xnGetNodeErrorState(m_hNode);
}
@@ -1543,6 +1621,61 @@ namespace xn
/**
* @ingroup cppref
+ * Allows access to general integer capabilities functions. see @ref general_int for additional details.
+ */
+ class GeneralIntCapability : public Capability
+ {
+ public:
+ /**
+ * Ctor
+ *
+ * @param hNode [in] Node handle
+ * @param strCap [in] Name of the capability
+ */
+ GeneralIntCapability(XnNodeHandle hNode, const XnChar* strCap) : Capability(hNode), 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(m_hNode, m_strCap, &nMin, &nMax, &nStep, &nDefault, &bIsAutoSupported);
+ }
+
+ /** @copybrief xnGetGeneralIntValue
+ * For full details and usage, see @ref xnGetGeneralIntValue
+ */
+ inline XnInt32 Get()
+ {
+ XnInt32 nValue;
+ xnGetGeneralIntValue(m_hNode, m_strCap, &nValue);
+ return nValue;
+ }
+
+ /** @copybrief xnSetGeneralIntValue
+ * For full details and usage, see @ref xnSetGeneralIntValue
+ */
+ inline XnStatus Set(XnInt32 nValue)
+ {
+ return xnSetGeneralIntValue(m_hNode, m_strCap, nValue);
+ }
+
+ /** @copybrief xnRegisterToGeneralIntValueChange
+ * For full details and usage, see @ref xnRegisterToGeneralIntValueChange
+ */
+ XnStatus RegisterToValueChange(StateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback);
+
+ /** @copybrief xnUnregisterFromGeneralIntValueChange
+ * For full details and usage, see @ref xnUnregisterFromGeneralIntValueChange
+ */
+ void UnregisterFromValueChange(XnCallbackHandle hCallback);
+
+ private:
+ const XnChar* m_strCap;
+ };
+
+ /**
+ * @ingroup cppref
* Base class for all production nodes.
*/
class ProductionNode : public NodeWrapper
@@ -1560,20 +1693,6 @@ namespace xn
*/
inline NodeInfo GetInfo() const { return NodeInfo(xnGetNodeInfo(m_hNode)); }
- /** @copybrief xnRefProductionNode
- * For full details and usage, see @ref xnRefProductionNode
- */
- inline XnStatus Ref() { return xnRefProductionNode(m_hNode); }
-
- /** @copybrief xnUnrefProductionNode
- * For full details and usage, see @ref xnUnrefProductionNode
- */
- inline void Unref()
- {
- xnUnrefProductionNode(m_hNode);
- SetHandle(NULL);
- }
-
/** @copybrief xnAddNeededNode
* For full details and usage, see @ref xnAddNeededNode
*/
@@ -1593,7 +1712,7 @@ namespace xn
/** @copybrief xnGetContextFromNodeHandle
* For full details and usage, see @ref xnGetContextFromNodeHandle
*/
- inline void GetContext(Context& context);
+ inline void GetContext(Context& context) const;
/** @copybrief xnIsCapabilitySupported
* For full details and usage, see @ref xnIsCapabilitySupported
@@ -1704,10 +1823,71 @@ namespace xn
* It is the application responsibility to check first if @ref XN_CAPABILITY_ERROR_STATE is supported
* by calling @ref IsCapabilitySupported().
*/
+ inline const ErrorStateCapability GetErrorStateCap() const
+ {
+ return ErrorStateCapability(m_hNode);
+ }
+
+ /**
+ * Gets an @ref ErrorStateCapability object for accessing Error State functionality.
+ * It is the application responsibility to check first if @ref XN_CAPABILITY_ERROR_STATE is supported
+ * by calling @ref IsCapabilitySupported().
+ */
inline ErrorStateCapability GetErrorStateCap()
{
return ErrorStateCapability(m_hNode);
}
+
+ /**
+ * Gets an @ref GeneralIntCapability object for accessing the capability functionality.
+ * It is the application responsibility to check first if the capability is supported
+ * by calling @ref IsCapabilitySupported().
+ *
+ * @param strCapability [in] Name of the capability to get
+ */
+ inline GeneralIntCapability GetGeneralIntCap(const XnChar* strCapability)
+ {
+ return GeneralIntCapability(m_hNode, strCapability);
+ }
+ };
+
+ /**
+ * @ingroup cppref
+ * Allows access to <b>Device Identification</b> capability functions. see @ref device_id for additional details.
+ */
+ class DeviceIdentificationCapability : public Capability
+ {
+ public:
+ /**
+ * Ctor
+ *
+ * @param hNode [in] Node handle
+ */
+ DeviceIdentificationCapability(XnNodeHandle hNode) : Capability(hNode) {}
+
+ /** @copybrief xnGetDeviceName
+ * For full details and usage, see @ref xnGetDeviceName
+ */
+ inline XnStatus GetDeviceName(XnChar* strBuffer, XnUInt32 nBufferSize)
+ {
+ return xnGetDeviceName(m_hNode, strBuffer, &nBufferSize);
+ }
+
+ /** @copybrief xnGetVendorSpecificData
+ * For full details and usage, see @ref xnGetVendorSpecificData
+ */
+ inline XnStatus GetVendorSpecificData(XnChar* strBuffer, XnUInt32 nBufferSize)
+ {
+ return xnGetVendorSpecificData(m_hNode, strBuffer, &nBufferSize);
+ }
+
+ /** @copybrief xnGetSerialNumber
+ * For full details and usage, see @ref xnGetSerialNumber
+ */
+ inline XnStatus GetSerialNumber(XnChar* strBuffer, XnUInt32 nBufferSize)
+ {
+ return xnGetSerialNumber(m_hNode, strBuffer, &nBufferSize);
+ }
};
/**
@@ -1723,6 +1903,21 @@ namespace xn
* @param hNode [in] Node handle
*/
inline Device(XnNodeHandle hNode = NULL) : ProductionNode(hNode) {}
+
+ /** @copybrief xnCreateDevice
+ * For full details and usage, see @ref xnCreateDevice
+ */
+ inline XnStatus Create(Context& context, Query* pQuery = NULL, EnumerationErrors* pErrors = NULL);
+
+ /**
+ * Gets a @ref DeviceIdentificationCapability object for accessing device identification functionality.
+ * It is the application responsibility to check first if @ref XN_CAPABILITY_DEVICE_IDENTIFICATION is supported
+ * by calling @ref IsCapabilitySupported().
+ */
+ inline DeviceIdentificationCapability GetIdentificationCap()
+ {
+ return DeviceIdentificationCapability(m_hNode);
+ }
};
/**
@@ -1852,7 +2047,7 @@ namespace xn
/** @copybrief xnCanFrameSyncWith
* For full details and usage, see @ref xnCanFrameSyncWith
*/
- inline XnBool CanFrameSyncWith(Generator& other);
+ inline XnBool CanFrameSyncWith(Generator& other) const;
/** @copybrief xnFrameSyncWith
* For full details and usage, see @ref xnFrameSyncWith
@@ -1867,7 +2062,7 @@ namespace xn
/** @copybrief xnIsFrameSyncedWith
* For full details and usage, see @ref xnIsFrameSyncedWith
*/
- inline XnBool IsFrameSyncedWith(Generator& other);
+ inline XnBool IsFrameSyncedWith(Generator& other) const;
/** @copybrief xnRegisterToFrameSyncChange
* For full details and usage, see @ref xnRegisterToFrameSyncChange
@@ -1959,7 +2154,7 @@ namespace xn
/** @copybrief xnIsNewDataAvailable
* For full details and usage, see @ref xnIsNewDataAvailable
*/
- inline XnBool IsNewDataAvailable(XnUInt64* pnTimestamp = NULL)
+ inline XnBool IsNewDataAvailable(XnUInt64* pnTimestamp = NULL) const
{
return xnIsNewDataAvailable(m_hNode, pnTimestamp);
}
@@ -1980,6 +2175,14 @@ namespace xn
return xnIsDataNew(m_hNode);
}
+ /** @copybrief xnGetData
+ * For full details and usage, see @ref xnGetData
+ */
+ inline const void* GetData()
+ {
+ return xnGetData(m_hNode);
+ }
+
/** @copybrief xnGetDataSize
* For full details and usage, see @ref xnGetDataSize
*/