OpenNI 1.5.4: XnModuleCppInterface.h Source File

OpenNI

OpenNI 1.5.4
XnModuleCppInterface.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 *                                                                           *
00003 *  OpenNI 1.x Alpha                                                         *
00004 *  Copyright (C) 2011 PrimeSense Ltd.                                       *
00005 *                                                                           *
00006 *  This file is part of OpenNI.                                             *
00007 *                                                                           *
00008 *  OpenNI is free software: you can redistribute it and/or modify           *
00009 *  it under the terms of the GNU Lesser General Public License as published *
00010 *  by the Free Software Foundation, either version 3 of the License, or     *
00011 *  (at your option) any later version.                                      *
00012 *                                                                           *
00013 *  OpenNI is distributed in the hope that it will be useful,                *
00014 *  but WITHOUT ANY WARRANTY; without even the implied warranty of           *
00015 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the             *
00016 *  GNU Lesser General Public License for more details.                      *
00017 *                                                                           *
00018 *  You should have received a copy of the GNU Lesser General Public License *
00019 *  along with OpenNI. If not, see <http://www.gnu.org/licenses/>.           *
00020 *                                                                           *
00021 ****************************************************************************/
00022 #ifndef __XN_MODULE_CPP_INTERFACE_H__
00023 #define __XN_MODULE_CPP_INTERFACE_H__
00024 
00031 //---------------------------------------------------------------------------
00032 // Includes
00033 //---------------------------------------------------------------------------
00034 #include "XnModuleInterface.h"
00035 #include "XnListT.h"
00036 #include "XnCppWrapper.h"
00037 
00038 //---------------------------------------------------------------------------
00039 // Types
00040 //---------------------------------------------------------------------------
00041 namespace xn
00042 {
00043     typedef XnListT<XnModuleGetExportedInterfacePtr> ExportedNodesList;
00044 
00045     class ModuleProductionNode;
00046 
00047     class Module
00048     {
00049     public:
00050         Module() {}
00051         virtual ~Module() {}
00052 
00053         virtual XnStatus Load() { return XN_STATUS_OK; }
00054         virtual void Unload() {}
00055 
00056         inline XnStatus AddExportedNode(XnModuleGetExportedInterfacePtr pEntryPoint) { return m_ExportedNodes.AddLast(pEntryPoint); }
00057 
00058         XnUInt32 GetExportedNodesCount() { return m_ExportedNodes.Size(); }
00059 
00060         XnStatus GetExportedNodes(XnModuleGetExportedInterfacePtr* aEntryPoints, XnUInt32 nCount)
00061         {
00062             if (nCount < m_ExportedNodes.Size())                                        
00063             {                                                               
00064                 return XN_STATUS_OUTPUT_BUFFER_OVERFLOW;                    
00065             }                                                               
00066 
00067             XnUInt32 i = 0;                                             
00068             for (ExportedNodesList::ConstIterator it = m_ExportedNodes.Begin();         
00069                 it != m_ExportedNodes.End();                                            
00070                 ++it, ++i)                                                  
00071             {                                                               
00072                 aEntryPoints[i] = *it;                                      
00073             }                                                               
00074 
00075             return (XN_STATUS_OK);                                          
00076         }
00077 
00078     private:
00079         ExportedNodesList m_ExportedNodes;
00080     };
00081 
00082     class ExtensionModule : public Module
00083     {
00084     public:
00085         virtual XnStatus Load()
00086         {
00087             XnStatus nRetVal = XN_STATUS_OK;
00088             
00089             nRetVal = Module::Load();
00090             XN_IS_STATUS_OK(nRetVal);
00091 
00092             nRetVal = RegisterNewTypes();
00093             XN_IS_STATUS_OK(nRetVal);
00094             
00095             return (XN_STATUS_OK);
00096         }
00097 
00098     protected:
00099         virtual XnStatus RegisterNewTypes() = 0;
00100     };
00101 
00102     class ModuleExportedProductionNode
00103     {
00104     public:
00105         ModuleExportedProductionNode() {}
00106         virtual ~ModuleExportedProductionNode() {}
00107 
00108         virtual void GetDescription(XnProductionNodeDescription* pDescription) = 0;
00109         virtual XnStatus EnumerateProductionTrees(Context& context, NodeInfoList& TreesList, EnumerationErrors* pErrors) = 0;
00110         virtual XnStatus Create(Context& context, const XnChar* strInstanceName, const XnChar* strCreationInfo, NodeInfoList* pNeededTrees, const XnChar* strConfigurationDir, ModuleProductionNode** ppInstance) = 0;
00111         virtual void Destroy(ModuleProductionNode* pInstance) = 0;
00112     };
00113 
00114     class ModuleExtendedSerializationInterface
00115     {
00116     public:
00117         virtual ~ModuleExtendedSerializationInterface() {}
00118         virtual XnStatus NotifyExState(XnNodeNotifications* pNotifications, void* pCookie) = 0;
00119         virtual void UnregisterExNotifications() = 0;
00120     };
00121 
00122     class ModuleLockAwareInterface
00123     {
00124     public:
00125         virtual ~ModuleLockAwareInterface() {}
00126         virtual XnStatus SetLockState(XnBool bLocked) = 0;
00127         virtual XnBool GetLockState() = 0;
00128         virtual XnStatus RegisterToLockChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00129         virtual void UnregisterFromLockChange(XnCallbackHandle hCallback) = 0;
00130     };
00131 
00132     class ModuleErrorStateInterface
00133     {
00134     public:
00135         virtual ~ModuleErrorStateInterface() {}
00136         virtual XnStatus GetErrorState() = 0;
00137         virtual XnStatus RegisterToErrorStateChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00138         virtual void UnregisterFromErrorStateChange(XnCallbackHandle hCallback) = 0;
00139     };
00140 
00141     class ModuleGeneralIntInterface
00142     {
00143     public:
00144         virtual XnStatus GetRange(const XnChar* strCap, XnInt32& nMin, XnInt32& nMax, XnInt32& nStep, XnInt32& nDefault, XnBool& bIsAutoSupported) = 0;
00145         virtual XnStatus Get(const XnChar* strCap, XnInt32& nValue) = 0;
00146         virtual XnInt32 Set(const XnChar* strCap, XnInt32 nValue) = 0;
00147         virtual XnStatus RegisterToValueChange(const XnChar* strCap, XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00148         virtual void UnregisterFromValueChange(const XnChar* strCap, XnCallbackHandle hCallback) = 0;
00149     };
00150 
00151     class ModuleProductionNode
00152     {
00153     public:
00154 #ifdef XN_NO_DYNAMIC_CAST
00155         ModuleProductionNode()
00156         {
00157             xnOSMemSet(m_aInterfaces, 0, sizeof(m_aInterfaces));
00158             m_aInterfaces[XN_NODE_TYPE_PRODUCTION_NODE] = this;
00159         }
00160 #endif
00161         virtual ~ModuleProductionNode() {}
00162         virtual XnBool IsCapabilitySupported(const XnChar* /*strCapabilityName*/) { return FALSE; }
00163         virtual XnStatus SetIntProperty(const XnChar* /*strName*/, XnUInt64 /*nValue*/) { return XN_STATUS_ERROR; }
00164         virtual XnStatus SetRealProperty(const XnChar* /*strName*/, XnDouble /*dValue*/) { return XN_STATUS_ERROR; }
00165         virtual XnStatus SetStringProperty(const XnChar* /*strName*/, const XnChar* /*strValue*/) { return XN_STATUS_ERROR; }
00166         virtual XnStatus SetGeneralProperty(const XnChar* /*strName*/, XnUInt32 /*nBufferSize*/, const void* /*pBuffer*/) { return XN_STATUS_ERROR; }
00167         virtual XnStatus GetIntProperty(const XnChar* /*strName*/, XnUInt64& /*nValue*/) const { return XN_STATUS_ERROR; }
00168         virtual XnStatus GetRealProperty(const XnChar* /*strName*/, XnDouble& /*dValue*/) const { return XN_STATUS_ERROR; }
00169         virtual XnStatus GetStringProperty(const XnChar* /*strName*/, XnChar* /*csValue*/, XnUInt32 /*nBufSize*/) const { return XN_STATUS_ERROR; }
00170         virtual XnStatus GetGeneralProperty(const XnChar* /*strName*/, XnUInt32 /*nBufferSize*/, void* /*pBuffer*/) const { return XN_STATUS_ERROR; }
00171         virtual ModuleExtendedSerializationInterface* GetExtendedSerializationInterface() { return NULL; }
00172         virtual ModuleLockAwareInterface* GetLockAwareInterface() { return NULL; }
00173         virtual ModuleErrorStateInterface* GetErrorStateInterface() { return NULL; }
00174         virtual ModuleGeneralIntInterface* GetGeneralIntInterface(const XnChar* /*strCap*/) { return NULL; }
00175 
00176     public:
00177 #ifdef XN_NO_DYNAMIC_CAST
00178         void* m_aInterfaces[XN_NODE_TYPE_FIRST_EXTENSION];
00179 #endif
00180     };
00181 
00182     class ModuleDeviceIdentificationInterface
00183     {
00184     public:
00185         virtual ~ModuleDeviceIdentificationInterface() {}
00186         virtual XnStatus GetDeviceName(XnChar* strBuffer, XnUInt32& nBufferSize) = 0;
00187         virtual XnStatus GetVendorSpecificData(XnChar* strBuffer, XnUInt32& nBufferSize) = 0;
00188         virtual XnStatus GetSerialNumber(XnChar* strBuffer, XnUInt32& nBufferSize) = 0;
00189     };
00190 
00191     class ModuleDevice : virtual public ModuleProductionNode
00192     {
00193     public:
00194 #ifdef XN_NO_DYNAMIC_CAST
00195         ModuleDevice() { m_aInterfaces[XN_NODE_TYPE_DEVICE] = this; }
00196 #endif
00197         virtual ~ModuleDevice() {}
00198         virtual ModuleDeviceIdentificationInterface* GetIdentificationInterface() { return NULL; }
00199     };
00200 
00201     class ModuleMirrorInterface
00202     {
00203     public:
00204         virtual ~ModuleMirrorInterface() {}
00205         virtual XnStatus SetMirror(XnBool bMirror) = 0;
00206         virtual XnBool IsMirrored() = 0;
00207         virtual XnStatus RegisterToMirrorChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00208         virtual void UnregisterFromMirrorChange(XnCallbackHandle hCallback) = 0;
00209     };
00210 
00211     class ModuleAlternativeViewPointInterface
00212     {
00213     public:
00214         virtual ~ModuleAlternativeViewPointInterface() {}
00215         virtual XnBool IsViewPointSupported(ProductionNode& other) = 0;
00216         virtual XnStatus SetViewPoint(ProductionNode& other) = 0;
00217         virtual XnBool IsViewPointAs(ProductionNode& other) = 0;
00218         virtual XnStatus ResetViewPoint() = 0;
00219         virtual XnStatus RegisterToViewPointChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00220         virtual void UnregisterFromViewPointChange(XnCallbackHandle hCallback) = 0;
00221     };
00222 
00223     class ModuleFrameSyncInterface
00224     {
00225     public:
00226         virtual XnBool CanFrameSyncWith(ProductionNode& other) = 0;
00227         virtual XnStatus FrameSyncWith(ProductionNode& other) = 0;
00228         virtual XnStatus StopFrameSyncWith(ProductionNode& other) = 0;
00229         virtual XnBool IsFrameSyncedWith(ProductionNode& other) = 0;
00230         virtual XnStatus RegisterToFrameSyncChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00231         virtual void UnregisterFromFrameSyncChange(XnCallbackHandle hCallback) = 0;
00232     };
00233 
00234     class ModuleGenerator : virtual public ModuleProductionNode
00235     {
00236     public:
00237 #ifdef XN_NO_DYNAMIC_CAST
00238         ModuleGenerator() { m_aInterfaces[XN_NODE_TYPE_GENERATOR] = this;}
00239 #endif
00240         virtual ~ModuleGenerator() {}
00241         virtual XnStatus StartGenerating() = 0;
00242         virtual XnBool IsGenerating() = 0;
00243         virtual void StopGenerating() = 0;
00244         virtual XnStatus RegisterToGenerationRunningChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00245         virtual void UnregisterFromGenerationRunningChange(XnCallbackHandle hCallback) = 0;
00246         virtual XnStatus RegisterToNewDataAvailable(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00247         virtual void UnregisterFromNewDataAvailable(XnCallbackHandle hCallback) = 0;
00248         virtual XnBool IsNewDataAvailable(XnUInt64& nTimestamp) = 0;
00249         virtual XnStatus UpdateData() = 0;
00250         virtual const void* GetData() = 0;
00251         virtual XnUInt32 GetDataSize() = 0;
00252         virtual XnUInt64 GetTimestamp() = 0;
00253         virtual XnUInt32 GetFrameID() = 0;
00254         virtual ModuleMirrorInterface* GetMirrorInterface() { return NULL; }
00255         virtual ModuleAlternativeViewPointInterface* GetAlternativeViewPointInterface() { return NULL; }
00256         virtual ModuleFrameSyncInterface* GetFrameSyncInterface() { return NULL; }
00257     };
00258 
00259     class ModuleNodeNotifications
00260     {
00261     public:
00262         virtual ~ModuleNodeNotifications() {}
00263         virtual XnStatus OnNodeAdded(const XnChar* strNodeName, XnProductionNodeType type, XnCodecID compression) = 0;
00264         virtual XnStatus OnNodeRemoved(const XnChar* strNodeName) = 0;
00265         virtual XnStatus OnNodeIntPropChanged(const XnChar* strNodeName, const XnChar* strPropName, XnUInt64 nValue) = 0;
00266         virtual XnStatus OnNodeRealPropChanged(const XnChar* strNodeName, const XnChar* strPropName, XnDouble dValue) = 0;
00267         virtual XnStatus OnNodeStringPropChanged(const XnChar* strNodeName, const XnChar* strPropName, const XnChar* strValue) = 0;
00268         virtual XnStatus OnNodeStateReady(const XnChar* strNodeName) = 0;
00269         virtual XnStatus OnNodeGeneralPropChanged(const XnChar* strNodeName, const XnChar* strPropName, XnUInt32 nBufferSize, const void* pBuffer) = 0;
00270         virtual XnStatus OnNodeNewData(const XnChar* strNodeName, XnUInt64 nTimeStamp, XnUInt32 nFrame, const void* pData, XnUInt32 nSize) = 0;
00271     };
00272 
00273     class ModuleRecorder : 
00274         virtual public ModuleProductionNode, 
00275         virtual public ModuleNodeNotifications
00276     {
00277     public:
00278 #ifdef XN_NO_DYNAMIC_CAST
00279         ModuleRecorder() { m_aInterfaces[XN_NODE_TYPE_RECORDER] = this; }
00280 #endif
00281         virtual ~ModuleRecorder() {}
00282         virtual XnStatus SetOutputStream(void* pCookie, XnRecorderOutputStreamInterface* pStream) = 0;
00283     };
00284 
00285     class ModulePlayer : virtual public ModuleProductionNode
00286     {
00287     public:
00288 #ifdef XN_NO_DYNAMIC_CAST
00289         ModulePlayer() { m_aInterfaces[XN_NODE_TYPE_PLAYER] = this; }
00290 #endif
00291         virtual ~ModulePlayer() {}
00292         virtual XnStatus SetInputStream(void* pStreamCookie, XnPlayerInputStreamInterface* pStream) = 0;
00293         virtual XnStatus ReadNext() = 0;
00294         virtual XnStatus SetNodeNotifications(void* pNodeNotificationsCookie, XnNodeNotifications* pNodeNotifications) = 0;
00295 
00296         virtual XnStatus SetRepeat(XnBool bRepeat) = 0;
00297         virtual XnStatus SeekToTimeStamp(XnInt64 nTimeOffset, XnPlayerSeekOrigin origin) = 0;
00298         virtual XnStatus SeekToFrame(const XnChar* strNodeName, XnInt32 nFrameOffset, XnPlayerSeekOrigin origin) = 0;
00299         virtual XnStatus TellTimestamp(XnUInt64& nTimestamp) = 0;
00300         virtual XnStatus TellFrame(const XnChar* strNodeName, XnUInt32& nFrame) = 0;
00301         virtual XnUInt32 GetNumFrames(const XnChar* strNodeName, XnUInt32& nFrames) = 0;
00302         virtual const XnChar* GetSupportedFormat() = 0;
00303         virtual XnBool IsEOF() = 0;
00304         virtual XnStatus RegisterToEndOfFileReached(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00305         virtual void UnregisterFromEndOfFileReached(XnCallbackHandle hCallback) = 0;
00306     };
00307 
00308     class ModuleCroppingInterface
00309     {
00310     public:
00311         virtual ~ModuleCroppingInterface() {}
00312         virtual XnStatus SetCropping(const XnCropping &Cropping) = 0;
00313         virtual XnStatus GetCropping(XnCropping &Cropping) = 0;
00314         virtual XnStatus RegisterToCroppingChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00315         virtual void UnregisterFromCroppingChange(XnCallbackHandle hCallback) = 0;
00316     };
00317 
00318     class ModuleAntiFlickerInterface
00319     {
00320     public:
00321         virtual ~ModuleAntiFlickerInterface() {}
00322         virtual XnStatus SetPowerLineFrequency(XnPowerLineFrequency nFrequency) = 0;
00323         virtual XnPowerLineFrequency GetPowerLineFrequency() = 0;
00324         virtual XnStatus RegisterToPowerLineFrequencyChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00325         virtual void UnregisterFromPowerLineFrequencyChange(XnCallbackHandle hCallback) = 0;
00326     };
00327 
00328     class ModuleMapGenerator : virtual public ModuleGenerator
00329     {
00330     public:
00331 #ifdef XN_NO_DYNAMIC_CAST
00332         ModuleMapGenerator() { m_aInterfaces[XN_NODE_TYPE_MAP_GENERATOR] = this; }
00333 #endif
00334         virtual ~ModuleMapGenerator() {}
00335         virtual XnUInt32 GetSupportedMapOutputModesCount() = 0;
00336         virtual XnStatus GetSupportedMapOutputModes(XnMapOutputMode aModes[], XnUInt32& nCount) = 0;
00337         virtual XnStatus SetMapOutputMode(const XnMapOutputMode& Mode) = 0;
00338         virtual XnStatus GetMapOutputMode(XnMapOutputMode& Mode) = 0;
00339         virtual XnStatus RegisterToMapOutputModeChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00340         virtual void UnregisterFromMapOutputModeChange(XnCallbackHandle hCallback) = 0;
00341         virtual XnUInt32 GetBytesPerPixel() = 0;
00342         virtual ModuleCroppingInterface* GetCroppingInterface() { return NULL; }
00343         virtual ModuleAntiFlickerInterface* GetAntiFlickerInterface() { return NULL; }
00344     };
00345 
00346     class ModuleUserPositionInterface
00347     {
00348     public:
00349         virtual ~ModuleUserPositionInterface() {}
00350         virtual XnUInt32 GetSupportedUserPositionsCount() = 0;
00351         virtual XnStatus SetUserPosition(XnUInt32 nIndex, const XnBoundingBox3D& Position) = 0;
00352         virtual XnStatus GetUserPosition(XnUInt32 nIndex, XnBoundingBox3D& Position) = 0;
00353         virtual XnStatus RegisterToUserPositionChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00354         virtual void UnregisterFromUserPositionChange(XnCallbackHandle hCallback) = 0;
00355     };
00356 
00357     class ModuleDepthGenerator : virtual public ModuleMapGenerator
00358     {
00359     public:
00360 #ifdef XN_NO_DYNAMIC_CAST
00361         ModuleDepthGenerator() { m_aInterfaces[XN_NODE_TYPE_DEPTH] = this; }
00362 #endif
00363         virtual ~ModuleDepthGenerator() {}
00364         virtual const void* GetData() { return GetDepthMap(); }
00365         virtual XnUInt32 GetBytesPerPixel() { return sizeof(XnDepthPixel); }
00366         virtual XnDepthPixel* GetDepthMap() = 0;
00367         virtual XnDepthPixel GetDeviceMaxDepth() = 0;
00368         virtual void GetFieldOfView(XnFieldOfView& FOV) = 0;
00369         virtual XnStatus RegisterToFieldOfViewChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00370         virtual void UnregisterFromFieldOfViewChange(XnCallbackHandle hCallback) = 0;
00371         virtual ModuleUserPositionInterface* GetUserPositionInterface() { return NULL; }
00372     };
00373 
00374     class ModuleImageGenerator : virtual public ModuleMapGenerator
00375     {
00376     public:
00377 #ifdef XN_NO_DYNAMIC_CAST
00378         ModuleImageGenerator() { m_aInterfaces[XN_NODE_TYPE_IMAGE] = this; }
00379 #endif
00380         virtual ~ModuleImageGenerator() {}
00381         virtual const void* GetData() { return GetImageMap(); }
00382         virtual XnUInt32 GetBytesPerPixel() { return xnGetBytesPerPixelForPixelFormat(GetPixelFormat()); }
00383         virtual XnUInt8* GetImageMap() = 0;
00384         virtual XnBool IsPixelFormatSupported(XnPixelFormat Format) = 0;
00385         virtual XnStatus SetPixelFormat(XnPixelFormat Format) = 0;
00386         virtual XnPixelFormat GetPixelFormat() = 0;
00387         virtual XnStatus RegisterToPixelFormatChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00388         virtual void UnregisterFromPixelFormatChange(XnCallbackHandle hCallback) = 0;
00389     };
00390 
00391     class ModuleIRGenerator : virtual public ModuleMapGenerator
00392     {
00393     public:
00394 #ifdef XN_NO_DYNAMIC_CAST
00395         ModuleIRGenerator() { m_aInterfaces[XN_NODE_TYPE_IR] = this; }
00396 #endif
00397         virtual ~ModuleIRGenerator() {}
00398         virtual const void* GetData() { return GetIRMap(); }
00399         virtual XnUInt32 GetBytesPerPixel() { return sizeof(XnIRPixel); }
00400         virtual XnIRPixel* GetIRMap() = 0;
00401     };
00402 
00403     class ModuleGestureGenerator : virtual public ModuleGenerator
00404     {
00405     public:
00406 #ifdef XN_NO_DYNAMIC_CAST
00407         ModuleGestureGenerator() { m_aInterfaces[XN_NODE_TYPE_GESTURE] = this; }
00408 #endif
00409         virtual ~ModuleGestureGenerator() {}
00410         virtual const void* GetData() { return NULL; }
00411         virtual XnStatus AddGesture(const XnChar* strGesture, XnBoundingBox3D* pArea) = 0;
00412         virtual XnStatus RemoveGesture(const XnChar* strGesture) = 0;
00413         virtual XnStatus GetActiveGestures(XnChar** pstrGestures, XnUInt16& nGestures) = 0;
00414         virtual XnStatus GetAllActiveGestures(XnChar** pstrGestures, XnUInt32 nNameLength, XnUInt16& nGestures) = 0;
00415         virtual XnStatus EnumerateGestures(XnChar** pstrGestures, XnUInt16& nGestures) = 0;
00416         virtual XnStatus EnumerateAllGestures(XnChar** pstrGestures, XnUInt32 nNameLength, XnUInt16& nGestures) = 0;
00417         virtual XnBool IsGestureAvailable(const XnChar* strGesture) = 0;
00418         virtual XnBool IsGestureProgressSupported(const XnChar* strGesture) = 0;
00419         virtual XnStatus RegisterGestureCallbacks(XnModuleGestureRecognized RecognizedCB, XnModuleGestureProgress ProgressCB, void* pCookie, XnCallbackHandle& hCallback) = 0;
00420         virtual void UnregisterGestureCallbacks(XnCallbackHandle hCallback) = 0;
00421         virtual XnStatus RegisterToGestureChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00422         virtual void UnregisterFromGestureChange(XnCallbackHandle hCallback) = 0;
00423 
00424         virtual XnStatus RegisterToGestureIntermediateStageCompleted(XnModuleGestureIntermediateStageCompleted GestureIntermediateStageCompletedCB, void* pCookie, XnCallbackHandle& hCallback) = 0;
00425         virtual void UnregisterFromGestureIntermediateStageCompleted(XnCallbackHandle hCallback) = 0;
00426         virtual XnStatus RegisterToGestureReadyForNextIntermediateStage(XnModuleGestureReadyForNextIntermediateStage ReadyForNextIntermediateStageCB, void* pCookie, XnCallbackHandle& hCallback) = 0;
00427         virtual void UnregisterFromGestureReadyForNextIntermediateStage(XnCallbackHandle hCallback) = 0;
00428     };
00429 
00430     class ModuleSceneAnalyzer : virtual public ModuleMapGenerator
00431     {
00432     public:
00433 #ifdef XN_NO_DYNAMIC_CAST
00434         ModuleSceneAnalyzer() { m_aInterfaces[XN_NODE_TYPE_SCENE] = this; }
00435 #endif
00436         virtual ~ModuleSceneAnalyzer() {}
00437         virtual const void* GetData() { return GetLabelMap(); }
00438         virtual XnUInt32 GetBytesPerPixel() { return sizeof(XnLabel); }
00439         virtual const XnLabel* GetLabelMap() = 0;
00440         virtual XnStatus GetFloor(XnPlane3D& pPlane) = 0;
00441     };
00442 
00443     class ModuleHandTouchingFOVEdgeInterface
00444     {
00445     public:
00446         virtual ~ModuleHandTouchingFOVEdgeInterface() {}
00447         virtual XnStatus RegisterToHandTouchingFOVEdge(XnModuleHandTouchingFOVEdge TouchingFOVEdgeCB, void* pCookie, XnCallbackHandle& hCallback) = 0;
00448         virtual void UnregisterFromHandTouchingFOVEdge(XnCallbackHandle hCallback) = 0;
00449     };
00450 
00451     class ModuleHandsGenerator : virtual public ModuleGenerator
00452     {
00453     public:
00454 #ifdef XN_NO_DYNAMIC_CAST
00455         ModuleHandsGenerator() { m_aInterfaces[XN_NODE_TYPE_HANDS] = this; }
00456 #endif
00457         virtual ~ModuleHandsGenerator() {}
00458         virtual const void* GetData() { return NULL; }
00459         virtual XnStatus RegisterHandCallbacks(XnModuleHandCreate CreateCB, XnModuleHandUpdate UpdateCB, XnModuleHandDestroy DestroyCB, void* pCookie, XnCallbackHandle& hCallback) = 0;
00460         virtual void UnregisterHandCallbacks(XnCallbackHandle hCallback) = 0;
00461         virtual XnStatus StopTracking(XnUserID user) = 0;
00462         virtual XnStatus StopTrackingAll() = 0;
00463         virtual XnStatus StartTracking(const XnPoint3D& ptPosition) = 0;
00464         virtual XnStatus SetSmoothing(XnFloat fSmoothingFactor) = 0;
00465 
00466         virtual ModuleHandTouchingFOVEdgeInterface* GetHandTouchingFOVEdgeInterface() { return NULL; }
00467     };
00468 
00469     class ModuleSkeletonInterface
00470     {
00471     public:
00472         virtual ~ModuleSkeletonInterface() {}
00473         virtual XnBool IsJointAvailable(XnSkeletonJoint eJoint) = 0;
00474         virtual XnBool IsProfileAvailable(XnSkeletonProfile eProfile) = 0;
00475         virtual XnStatus SetSkeletonProfile(XnSkeletonProfile eProfile) = 0;
00476         virtual XnStatus SetJointActive(XnSkeletonJoint eJoint, XnBool bState) = 0;
00477         virtual XnBool IsJointActive(XnSkeletonJoint eJoint) = 0;
00478         virtual XnStatus RegisterToJointConfigurationChange(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00479         virtual void UnregisterFromJointConfigurationChange(XnCallbackHandle hCallback) = 0;
00480         virtual XnStatus EnumerateActiveJoints(XnSkeletonJoint* pJoints, XnUInt16& nJoints) = 0;
00481         virtual XnStatus GetSkeletonJoint(XnUserID user, XnSkeletonJoint eJoint, XnSkeletonJointTransformation& jointTransformation) = 0;
00482         virtual XnStatus GetSkeletonJointPosition(XnUserID user, XnSkeletonJoint eJoint, XnSkeletonJointPosition& pJointPosition) = 0;
00483         virtual XnStatus GetSkeletonJointOrientation(XnUserID user, XnSkeletonJoint eJoint, XnSkeletonJointOrientation& pJointOrientation) = 0;
00484         virtual XnBool IsTracking(XnUserID user) = 0;
00485         virtual XnBool IsCalibrated(XnUserID user) = 0;
00486         virtual XnBool IsCalibrating(XnUserID user) = 0;
00487         virtual XnStatus RequestCalibration(XnUserID user, XnBool bForce) = 0;
00488         virtual XnStatus AbortCalibration(XnUserID user) = 0;
00489         virtual XnStatus SaveCalibrationDataToFile(XnUserID user, const XnChar* strFileName) = 0;
00490         virtual XnStatus LoadCalibrationDataFromFile(XnUserID user, const XnChar* strFileName) = 0;
00491         virtual XnStatus SaveCalibrationData(XnUserID user, XnUInt32 nSlot) = 0;
00492         virtual XnStatus LoadCalibrationData(XnUserID user, XnUInt32 nSlot) = 0;
00493         virtual XnStatus ClearCalibrationData(XnUInt32 nSlot) = 0;
00494         virtual XnBool IsCalibrationData(XnUInt32 nSlot) = 0;
00495         virtual XnStatus StartTracking(XnUserID user) = 0;
00496         virtual XnStatus StopTracking(XnUserID user) = 0;
00497         virtual XnStatus Reset(XnUserID user) = 0;
00498         virtual XnBool NeedPoseForCalibration() = 0;
00499         virtual XnStatus GetCalibrationPose(XnChar* strPose) = 0;
00500         virtual XnStatus SetSmoothing(XnFloat fSmoothingFactor) = 0;
00501         virtual XnStatus RegisterCalibrationCallbacks(XnModuleCalibrationStart CalibrationStartCB, XnModuleCalibrationEnd CalibrationEndCB, void* pCookie, XnCallbackHandle& hCallback) = 0;
00502         virtual void UnregisterCalibrationCallbacks(XnCallbackHandle hCallback) = 0;
00503 
00504         virtual XnStatus RegisterToCalibrationInProgress(XnModuleCalibrationInProgress CalibrationInProgressCB, void* pCookie, XnCallbackHandle& hCallback) = 0;
00505         virtual void UnregisterFromCalibrationInProgress(XnCallbackHandle hCallback) = 0;
00506         virtual XnStatus RegisterToCalibrationComplete(XnModuleCalibrationComplete CalibrationCompleteCB, void* pCookie, XnCallbackHandle& hCallback) = 0;
00507         virtual void UnregisterFromCalibrationComplete(XnCallbackHandle hCallback) = 0;
00508 
00509         virtual XnStatus RegisterToCalibrationStart(XnModuleCalibrationStart handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00510         virtual void UnregisterFromCalibrationStart(XnCallbackHandle hCallback) = 0;
00511     };
00512 
00513     class ModulePoseDetectionInteface
00514     {
00515     public:
00516         virtual ~ModulePoseDetectionInteface() {}
00517 
00518         virtual XnUInt32 GetNumberOfPoses() = 0;
00519         virtual XnStatus GetAvailablePoses(XnChar** pstrPoses, XnUInt32& nPoses) = 0;
00520         virtual XnStatus GetAllAvailablePoses(XnChar** pstrPoses, XnUInt32 nNameLength, XnUInt32& nPoses) = 0;
00521 
00522         virtual XnStatus StartPoseDetection(const XnChar* strPose, XnUserID user) = 0;
00523         virtual XnStatus StopPoseDetection(XnUserID user) = 0;
00524         virtual XnStatus StopSinglePoseDetection(XnUserID user, const XnChar* strPose) = 0;
00525 
00526         virtual XnStatus RegisterToPoseDetectionCallbacks(XnModulePoseDetectionCallback StartPoseCB, XnModulePoseDetectionCallback EndPoseCB, void* pCookie, XnCallbackHandle& hCallback) = 0;
00527         virtual void UnregisterFromPoseDetectionCallbacks(XnCallbackHandle hCallback) = 0;
00528 
00529         virtual XnStatus RegisterToPoseDetectionInProgress(XnModulePoseDetectionInProgressCallback InProgressCB, void* pCookie, XnCallbackHandle& hCallback) = 0;
00530         virtual void UnregisterFromPoseDetectionInProgress(XnCallbackHandle hCallback) = 0;
00531 
00532         virtual XnStatus RegisterToPoseDetected(XnModulePoseDetectionCallback handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00533         virtual XnStatus RegisterToOutOfPose(XnModulePoseDetectionCallback handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00534         virtual void UnregisterFromPoseDetected(XnCallbackHandle hCallback) = 0;
00535         virtual void UnregisterFromOutOfPose(XnCallbackHandle hCallback) = 0;
00536     };
00537 
00538     class ModuleUserGenerator : virtual public ModuleGenerator
00539     {
00540     public:
00541 #ifdef XN_NO_DYNAMIC_CAST
00542         ModuleUserGenerator() { m_aInterfaces[XN_NODE_TYPE_USER] = this;}
00543 #endif
00544         virtual ~ModuleUserGenerator() {}
00545         virtual const void* GetData() { return NULL; }
00546         virtual XnUInt16 GetNumberOfUsers() = 0;
00547         virtual XnStatus GetUsers(XnUserID* pUsers, XnUInt16& nUsers) = 0;
00548         virtual XnStatus GetCoM(XnUserID user, XnPoint3D& com) = 0;
00549         virtual XnStatus GetUserPixels(XnUserID user, XnSceneMetaData *pScene) = 0;
00550         virtual XnStatus RegisterUserCallbacks(XnModuleUserHandler NewUserCB, XnModuleUserHandler LostUserCB, void* pCookie, XnCallbackHandle& hCallback) = 0;
00551         virtual void UnregisterUserCallbacks(XnCallbackHandle hCallback) = 0;
00552         virtual ModuleSkeletonInterface* GetSkeletonInterface() { return NULL; }
00553         virtual ModulePoseDetectionInteface* GetPoseDetectionInteface() {return NULL;}
00554 
00555         virtual XnStatus RegisterToUserExit(XnModuleUserHandler UserExitCB, void* pCookie, XnCallbackHandle& hCallback) = 0;
00556         virtual void UnregisterFromUserExit(XnCallbackHandle hCallback) = 0;
00557         virtual XnStatus RegisterToUserReEnter(XnModuleUserHandler UserReEnterCB, void* pCookie, XnCallbackHandle& hCallback) = 0;
00558         virtual void UnregisterFromUserReEnter(XnCallbackHandle hCallback) = 0;
00559     };
00560 
00561     class ModuleAudioGenerator : virtual public ModuleGenerator
00562     {
00563     public:
00564 #ifdef XN_NO_DYNAMIC_CAST
00565         ModuleAudioGenerator() { m_aInterfaces[XN_NODE_TYPE_AUDIO] = this; }
00566 #endif
00567         virtual ~ModuleAudioGenerator() {}
00568         virtual const void* GetData() { return GetAudioBuffer(); }
00569         virtual XnUChar* GetAudioBuffer() = 0;
00570         virtual XnUInt32 GetSupportedWaveOutputModesCount() = 0;
00571         virtual XnStatus GetSupportedWaveOutputModes(XnWaveOutputMode aSupportedModes[], XnUInt32& nCount) = 0;
00572         virtual XnStatus SetWaveOutputMode(const XnWaveOutputMode& OutputMode) = 0;
00573         virtual XnStatus GetWaveOutputMode(XnWaveOutputMode& OutputMode) = 0;
00574         virtual XnStatus RegisterToWaveOutputModeChanges(XnModuleStateChangedHandler handler, void* pCookie, XnCallbackHandle& hCallback) = 0;
00575         virtual void UnregisterFromWaveOutputModeChanges(XnCallbackHandle hCallback) = 0;
00576     };
00577 
00578     class ModuleCodec : virtual public ModuleProductionNode
00579     {
00580     public:
00581 #ifdef XN_NO_DYNAMIC_CAST
00582         ModuleCodec() { m_aInterfaces[XN_NODE_TYPE_CODEC] = this; }
00583 #endif
00584         virtual ~ModuleCodec() {}
00585         virtual XnCodecID GetCodecID() const = 0;
00586         virtual XnStatus Init(const ProductionNode& node) = 0;
00587         virtual XnStatus CompressData(const void* pSrc, XnUInt32 nSrcSize, void* pDst, XnUInt32 nDstSize, XnUInt* pnBytesWritten) const = 0;
00588         virtual XnStatus DecompressData(const void* pSrc, XnUInt32 nSrcSize, void* pDst, XnUInt32 nDstSize, XnUInt* pnBytesWritten) const = 0;
00589     };
00590 
00591     class ModuleScriptNode : virtual public ModuleProductionNode
00592     {
00593     public:
00594 #ifdef XN_NO_DYNAMIC_CAST
00595         ModuleScriptNode() { m_aInterfaces[XN_NODE_TYPE_SCRIPT] = this; }
00596 #endif
00597         virtual ~ModuleScriptNode() {}
00598         virtual const XnChar* GetSupportedFormat() = 0;
00599         virtual XnStatus LoadScriptFromFile(const XnChar* strFileName) = 0;
00600         virtual XnStatus LoadScriptFromString(const XnChar* strScript) = 0;
00601         virtual XnStatus Run(NodeInfoList& createdNodes, EnumerationErrors& errors) = 0;
00602     };
00603 }
00604 
00605 #endif // __XN_MODULE_CPP_INTERFACE_H__
Generated on Wed May 16 2012 10:16:05 for OpenNI 1.5.4 by   doxygen 1.7.5.1