Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 15f1975d5e
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 231 lines (190 sloc) 8.604 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
/****************************************************************************
* *
* PrimeSense Sensor 5.x Alpha *
* Copyright (C) 2011 PrimeSense Ltd. *
* *
* This file is part of PrimeSense Sensor. *
* *
* PrimeSense Sensor 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. *
* *
* PrimeSense Sensor 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 PrimeSense Sensor. If not, see <http://www.gnu.org/licenses/>.*
* *
****************************************************************************/
#ifndef __XN_DEVICE_INTERFACE_ADAPTER_H__
#define __XN_DEVICE_INTERFACE_ADAPTER_H__

//---------------------------------------------------------------------------
// Includes
//---------------------------------------------------------------------------
#include "IXnDevice.h"
#include "XnDeviceManager.h"

//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
class XnDeviceInterfaceAdapter : public IXnDevice
{
public:
XnDeviceInterfaceAdapter(XnDeviceInterfaceFunctions* pFuncs) :
m_pFuncs(pFuncs)
{}

~XnDeviceInterfaceAdapter()
{
Destroy();
}

virtual XnStatus Init(const XnDeviceConfig* pDeviceConfig)
{
return m_pFuncs->Create(&m_Handle, pDeviceConfig);
}

virtual XnStatus Destroy()
{
return m_pFuncs->Destroy(&m_Handle);
}

virtual XnStatus GetSupportedStreams(const XnChar** aStreamNames, XnUInt32* pnStreamNamesCount)
{
return m_pFuncs->GetSupportedStreams(m_Handle, aStreamNames, pnStreamNamesCount);
}

virtual XnStatus CreateStream(const XnChar* StreamType, const XnChar* StreamName = NULL, const XnPropertySet* pInitialValues = NULL)
{
return m_pFuncs->CreateStream(m_Handle, StreamType, StreamName, pInitialValues);
}

virtual XnStatus DestroyStream(const XnChar* StreamName)
{
return m_pFuncs->DestroyStream(m_Handle, StreamName);
}

virtual XnStatus OpenStream(const XnChar* StreamName)
{
return m_pFuncs->OpenStream(m_Handle, StreamName);
}

virtual XnStatus CloseStream(const XnChar* StreamName)
{
return m_pFuncs->CloseStream(m_Handle, StreamName);
}

virtual XnStatus DoesModuleExist(const XnChar* ModuleName, XnBool* pbDoesExist)
{
return m_pFuncs->DoesModuleExist(m_Handle, ModuleName, pbDoesExist);
}

virtual XnStatus OpenAllStreams()
{
return m_pFuncs->OpenAllStreams(m_Handle);
}

virtual XnStatus CloseAllStreams()
{
return m_pFuncs->CloseAllStreams(m_Handle);
}

virtual XnStatus RegisterToStreamsChange(XnDeviceOnStreamsChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
{
return m_pFuncs->RegisterToStreamsChange(m_Handle, Handler, pCookie, hCallback);
}

virtual XnStatus UnregisterFromStreamsChange(XnCallbackHandle hCallback)
{
return m_pFuncs->UnregisterFromStreamsChange(m_Handle, hCallback);
}

virtual XnStatus CreateStreamData(const XnChar* StreamName, XnStreamData** ppStreamData)
{
return m_pFuncs->CreateStreamData(m_Handle, StreamName, ppStreamData);
}

virtual XnStatus RegisterToNewStreamData(XnDeviceOnNewStreamDataEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
{
return m_pFuncs->RegisterToNewStreamData(m_Handle, Handler, pCookie, hCallback);
}

virtual XnStatus UnregisterFromNewStreamData(XnCallbackHandle hCallback)
{
return m_pFuncs->UnregisterFromNewStreamData(m_Handle, hCallback);
}

virtual XnStatus IsNewDataAvailable(const XnChar* StreamName, XnBool* pbNewDataAvailable, XnUInt64* pnTimestamp)
{
return m_pFuncs->IsNewDataAvailable(m_Handle, StreamName, pbNewDataAvailable, pnTimestamp);
}

virtual XnStatus ReadStream(XnStreamData* pStreamOutput)
{
return m_pFuncs->ReadStream(m_Handle, pStreamOutput);
}

virtual XnStatus Read(XnStreamDataSet* pStreamOutputSet)
{
return m_pFuncs->Read(m_Handle, pStreamOutputSet);
}

virtual XnStatus WriteStream(XnStreamData* pStreamOutput)
{
return m_pFuncs->WriteStream(m_Handle, pStreamOutput);
}

virtual XnStatus Write(XnStreamDataSet* pStreamOutputSet)
{
return m_pFuncs->Write(m_Handle, pStreamOutputSet);
}

virtual XnStatus Tell(XnUInt64* pnTimestamp)
{
return m_pFuncs->Tell(m_Handle, pnTimestamp);
}

virtual XnStatus Seek(XnUInt64 nTimestamp)
{
return m_pFuncs->Seek(m_Handle, nTimestamp);
}

virtual XnStatus DoesPropertyExist(const XnChar* ModuleName, const XnChar* PropertyName, XnBool* pbDoesExist)
{
return m_pFuncs->DoesPropertyExist(m_Handle, ModuleName, PropertyName, pbDoesExist);
}

virtual XnStatus GetPropertyType(const XnChar* ModuleName, const XnChar* PropertyName, XnPropertyType* pnType)
{
return m_pFuncs->GetPropertyType(m_Handle, ModuleName, PropertyName, pnType);
}

virtual XnStatus SetProperty(const XnChar* ModuleName, const XnChar* PropertyName, XnUInt64 nValue)
{
return m_pFuncs->SetIntProperty(m_Handle, ModuleName, PropertyName, nValue);
}

virtual XnStatus SetProperty(const XnChar* ModuleName, const XnChar* PropertyName, XnDouble dValue)
{
return m_pFuncs->SetRealProperty(m_Handle, ModuleName, PropertyName, dValue);
}

virtual XnStatus SetProperty(const XnChar* ModuleName, const XnChar* PropertyName, const XnChar* csValue)
{
return m_pFuncs->SetStringProperty(m_Handle, ModuleName, PropertyName, csValue);
}

virtual XnStatus SetProperty(const XnChar* ModuleName, const XnChar* PropertyName, XnGeneralBuffer Value)
{
return m_pFuncs->SetGeneralProperty(m_Handle, ModuleName, PropertyName, Value);
}

virtual XnStatus GetProperty(const XnChar* ModuleName, const XnChar* PropertyName, XnUInt64* pnValue)
{
return m_pFuncs->GetIntProperty(m_Handle, ModuleName, PropertyName, pnValue);
}

virtual XnStatus GetProperty(const XnChar* ModuleName, const XnChar* PropertyName, XnDouble* pdValue)
{
return m_pFuncs->GetRealProperty(m_Handle, ModuleName, PropertyName, pdValue);
}

virtual XnStatus GetProperty(const XnChar* ModuleName, const XnChar* PropertyName, XnChar* csValue)
{
return m_pFuncs->GetStringProperty(m_Handle, ModuleName, PropertyName, csValue);
}

virtual XnStatus GetProperty(const XnChar* ModuleName, const XnChar* PropertyName, XnGeneralBuffer* pValue)
{
return m_pFuncs->GetGeneralProperty(m_Handle, ModuleName, PropertyName, pValue);
}

virtual XnStatus LoadConfigFromFile(const XnChar* csINIFilePath, const XnChar* csSectionName)
{
return m_pFuncs->LoadConfigFromFile(m_Handle, csINIFilePath, csSectionName);
}

virtual XnStatus GetAllProperties(XnPropertySet* pSet, XnBool bNoStreams = FALSE, const XnChar* strModule = NULL)
{
return m_pFuncs->GetAllProperties(m_Handle, pSet, bNoStreams, strModule);
}

virtual XnStatus RegisterToPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnDeviceOnPropertyChangedEventHandler Handler, void* pCookie, XnCallbackHandle& hCallback)
{
return m_pFuncs->RegisterToPropertyChange(m_Handle, Module, PropertyName, Handler, pCookie, hCallback);
}

virtual XnStatus UnRegisterFromPropertyChange(const XnChar* Module, const XnChar* PropertyName, XnCallbackHandle hCallback)
{
return m_pFuncs->UnregisterFromPropertyChange(m_Handle, Module, PropertyName, hCallback);
}

private:
XnDeviceInterfaceFunctions* m_pFuncs;
XnDeviceHandle m_Handle;
};

#endif //__XN_DEVICE_INTERFACE_ADAPTER_H__
Something went wrong with that request. Please try again.