OpenNI 1.5.4
|
XnDerivedCast.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 /**************************************************************************** 00023 * * 00024 * OpenNI 1.1 Alpha * 00025 * Copyright (C) 2011 PrimeSense Ltd. * 00026 * * 00027 * This file is part of OpenNI. * 00028 * * 00029 * OpenNI is free software: you can redistribute it and/or modify * 00030 * it under the terms of the GNU Lesser General Public License as published * 00031 * by the Free Software Foundation, either version 3 of the License, or * 00032 * (at your option) any later version. * 00033 * * 00034 * OpenNI is distributed in the hope that it will be useful, * 00035 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00036 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00037 * GNU Lesser General Public License for more details. * 00038 * * 00039 * You should have received a copy of the GNU Lesser General Public License * 00040 * along with OpenNI. If not, see <http://www.gnu.org/licenses/>. * 00041 * * 00042 ****************************************************************************/\ 00043 00044 #ifndef __XN_DERIVED_CAST_H__ 00045 #define __XN_DERIVED_CAST_H__ 00046 00047 // derived_cast Acts as dynamic_cast without the need for RTTI. used in platforms that not implement RTTI well like Linux-Arm. 00048 template<class T> 00049 static T derived_cast(ModuleProductionNode* pPrdNode); 00050 00051 #define DERIVED_CAST_IMPL(T, enm) \ 00052 template<> \ 00053 T* derived_cast<T*>(ModuleProductionNode* pPrdNode) \ 00054 { \ 00055 return (T*)pPrdNode->m_aInterfaces[enm]; \ 00056 } 00057 00058 DERIVED_CAST_IMPL(ModuleDevice, XN_NODE_TYPE_DEVICE) 00059 DERIVED_CAST_IMPL(ModuleRecorder, XN_NODE_TYPE_RECORDER) 00060 DERIVED_CAST_IMPL(ModulePlayer, XN_NODE_TYPE_PLAYER) 00061 DERIVED_CAST_IMPL(ModuleCodec, XN_NODE_TYPE_CODEC) 00062 DERIVED_CAST_IMPL(ModuleScriptNode, XN_NODE_TYPE_SCRIPT) 00063 DERIVED_CAST_IMPL(ModuleGenerator, XN_NODE_TYPE_GENERATOR) 00064 DERIVED_CAST_IMPL(ModuleUserGenerator, XN_NODE_TYPE_USER) 00065 DERIVED_CAST_IMPL(ModuleHandsGenerator, XN_NODE_TYPE_HANDS) 00066 DERIVED_CAST_IMPL(ModuleGestureGenerator, XN_NODE_TYPE_GESTURE) 00067 DERIVED_CAST_IMPL(ModuleAudioGenerator, XN_NODE_TYPE_AUDIO) 00068 DERIVED_CAST_IMPL(ModuleMapGenerator, XN_NODE_TYPE_MAP_GENERATOR) 00069 DERIVED_CAST_IMPL(ModuleDepthGenerator, XN_NODE_TYPE_DEPTH) 00070 DERIVED_CAST_IMPL(ModuleImageGenerator, XN_NODE_TYPE_IMAGE) 00071 DERIVED_CAST_IMPL(ModuleIRGenerator, XN_NODE_TYPE_IR) 00072 DERIVED_CAST_IMPL(ModuleSceneAnalyzer, XN_NODE_TYPE_SCENE) 00073 00074 #ifdef dynamic_cast 00075 #undef dynamic_cast 00076 #endif 00077 00078 #define dynamic_cast derived_cast 00079 00080 #endif
Generated on Wed May 16 2012 10:16:05 for OpenNI 1.5.4 by 1.7.5.1