OpenNI 1.3.2
|
00001 /**************************************************************************** 00002 * * 00003 * OpenNI 1.1 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_DUMP_H__ 00023 #define __XN_DUMP_H__ 00024 00025 //--------------------------------------------------------------------------- 00026 // Includes 00027 //--------------------------------------------------------------------------- 00028 #include "XnOS.h" 00029 00030 //--------------------------------------------------------------------------- 00031 // Types 00032 //--------------------------------------------------------------------------- 00033 typedef struct XnDump 00034 { 00035 XN_FILE_HANDLE hFile; 00036 } XnDump; 00037 00038 const XnDump XN_DUMP_CLOSED = { XN_INVALID_FILE_HANDLE }; 00039 00040 //--------------------------------------------------------------------------- 00041 // Functions 00042 //--------------------------------------------------------------------------- 00043 00050 XN_C_API XnStatus XN_C_DECL xnDumpSetMaskState(const XnChar* csMask, XnBool bEnabled); 00051 00057 XN_C_API XnBool XN_C_DECL xnLogIsDumpMaskEnabled(const XnChar* csDumpMask); 00058 00071 XN_C_API void XN_C_DECL xnDumpInit(XnDump* pDump, const XnChar* csDumpMask, const XnChar* csHeader, const XnChar* csFileNameFormat, ...); 00072 00084 XN_C_API void XN_C_DECL xnDumpForceInit(XnDump* pDump, const XnChar* csHeader, const XnChar* csFileNameFormat, ...); 00085 00092 XN_C_API void XN_C_DECL xnDumpClose(XnDump* pDump); 00093 00101 XN_C_API void XN_C_DECL xnDumpWriteBufferImpl(XnDump dump, const void* pBuffer, XnUInt32 nBufferSize); 00102 00103 inline void xnDumpWriteBuffer(XnDump dump, const void* pBuffer, XnUInt32 nBufferSize) 00104 { 00105 if (dump.hFile != XN_INVALID_FILE_HANDLE) 00106 { 00107 xnDumpWriteBufferImpl(dump, pBuffer, nBufferSize); 00108 } 00109 } 00110 00118 XN_C_API void XN_C_DECL xnDumpWriteStringImpl(XnDump dump, const XnChar* csFormat, ...); 00119 00125 XN_C_API void XN_C_DECL xnDumpFlush(XnDump dump); 00126 00127 #if XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_WIN32_VAARGS_STYLE 00128 #define xnDumpWriteString(dump, csFormat, ...) \ 00129 if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \ 00130 xnDumpWriteStringImpl((dump), csFormat, __VA_ARGS__); \ 00131 } 00132 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_GCC_VAARGS_STYLE 00133 #define xnDumpWriteString(dump, csFormat, ...) \ 00134 if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \ 00135 xnDumpWriteStringImpl((dump), csFormat, ##__VA_ARGS__); \ 00136 } 00137 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_ARC_VAARGS_STYLE 00138 #define xnDumpWriteString(dump, csFormat...) \ 00139 if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \ 00140 xnDumpWriteStringImpl((dump), csFormat); \ 00141 } 00142 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_NO_VAARGS 00143 #define xnDumpWriteString(dump, csFormat, arg) \ 00144 if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \ 00145 xnDumpWriteStringImpl((dump), csFormat, arg); \ 00146 } 00147 #else 00148 #error Xiron Log - Unknown VAARGS type! 00149 #endif 00150 00151 #endif // __XN_DUMP_H__