OpenNI 1.5.7
XnDump.h
Go to the documentation of this file.
00001 /*****************************************************************************
00002 *                                                                            *
00003 *  OpenNI 1.x Alpha                                                          *
00004 *  Copyright (C) 2012 PrimeSense Ltd.                                        *
00005 *                                                                            *
00006 *  This file is part of OpenNI.                                              *
00007 *                                                                            *
00008 *  Licensed under the Apache License, Version 2.0 (the "License");           *
00009 *  you may not use this file except in compliance with the License.          *
00010 *  You may obtain a copy of the License at                                   *
00011 *                                                                            *
00012 *      http://www.apache.org/licenses/LICENSE-2.0                            *
00013 *                                                                            *
00014 *  Unless required by applicable law or agreed to in writing, software       *
00015 *  distributed under the License is distributed on an "AS IS" BASIS,         *
00016 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  *
00017 *  See the License for the specific language governing permissions and       *
00018 *  limitations under the License.                                            *
00019 *                                                                            *
00020 *****************************************************************************/
00021 #ifndef __XN_DUMP_H__
00022 #define __XN_DUMP_H__
00023 
00024 //---------------------------------------------------------------------------
00025 // Includes
00026 //---------------------------------------------------------------------------
00027 #include "XnPlatform.h"
00028 #include "XnStatus.h"
00029 
00030 //---------------------------------------------------------------------------
00031 // Types
00032 //---------------------------------------------------------------------------
00033 struct XnDumpFile;
00034 typedef struct XnDumpFile XnDumpFile;
00035 
00036 //---------------------------------------------------------------------------
00037 // Functions
00038 //---------------------------------------------------------------------------
00039 
00046 XN_C_API XnStatus XN_C_DECL xnDumpSetMaskState(const XnChar* strMask, XnBool bEnabled);
00047 
00053 XN_C_API XnBool XN_C_DECL xnLogIsDumpMaskEnabled(const XnChar* strDumpMask);
00054 
00063 XN_C_API XnDumpFile* XN_C_DECL xnDumpFileOpen(const XnChar* strDumpName, const XnChar* strNameFormat, ...);
00064 
00077 XN_C_API XnDumpFile* XN_C_DECL xnDumpFileOpenEx(const XnChar* strDumpName, XnBool bForce, XnBool bSessionDump, const XnChar* strNameFormat, ...);
00078 
00086 XN_C_API void XN_C_DECL _xnDumpFileWriteBuffer(XnDumpFile* pFile, const void* pBuffer, XnUInt32 nBufferSize);
00087 
00096 XN_C_API void XN_C_DECL _xnDumpFileWriteString(XnDumpFile* pFile, const XnChar* strFormat, ...);
00097 
00103 XN_C_API void XN_C_DECL _xnDumpFileClose(XnDumpFile* pFile);
00104 
00105 #define xnDumpFileWriteBuffer(pFile, pBuffer, nBufferSize)      \
00106     if ((pFile) != NULL)                                        \
00107     {                                                           \
00108         _xnDumpFileWriteBuffer(pFile, pBuffer, nBufferSize);    \
00109     }                                                           \
00110 
00111 #define xnDumpFileClose(pFile)                                  \
00112     if ((pFile) != NULL)                                        \
00113     {                                                           \
00114         _xnDumpFileClose(pFile);                                \
00115         pFile = NULL;                                           \
00116     }                                                           \
00117 
00118 #if XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_WIN32_VAARGS_STYLE
00119     #define xnDumpFileWriteString(pFile, strFormat, ...)            \
00120         if ((pFile) != NULL)                                        \
00121         {                                                           \
00122             _xnDumpFileWriteString(pFile, strFormat, __VA_ARGS__);  \
00123         }
00124 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_GCC_VAARGS_STYLE
00125     #define xnDumpFileWriteString(pFile, strFormat, ...)            \
00126         if ((pFile) != NULL)                                        \
00127         {                                                           \
00128             _xnDumpFileWriteString(pFile, strFormat, ##__VA_ARGS__);\
00129         }
00130 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_ARC_VAARGS_STYLE
00131     #define xnDumpFileWriteString(pFile, strFormat, ...)            \
00132         if ((pFile) != NULL)                                        \
00133         {                                                           \
00134             _xnDumpFileWriteString(pFile, strFormat);               \
00135         }
00136 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_NO_VAARGS
00137     #define xnDumpFileWriteString(pFile, strFormat, arg)            \
00138         if ((pFile) != NULL)                                        \
00139         {                                                           \
00140             _xnDumpFileWriteString(pFile, strFormat,arg);           \
00141         }
00142 #else
00143     #error Xiron Log - Unknown VAARGS type!
00144 #endif
00145 
00146 
00147 //---------------------------------------------------------------------------
00148 // Backwards Compatibility Stuff
00149 //---------------------------------------------------------------------------
00150 
00151 #ifndef __XN_NO_BC__
00152 
00153 #include "XnOS.h"
00154 
00155 typedef struct XnDump 
00156 {
00157     XN_FILE_HANDLE hFile;
00158 } XnDump;
00159 
00160 const XnDump XN_DUMP_CLOSED = { XN_INVALID_FILE_HANDLE };
00161 
00162 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpInit(XnDump* pDump, const XnChar* csDumpMask, const XnChar* csHeader, const XnChar* csFileNameFormat, ...);
00163 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpForceInit(XnDump* pDump, const XnChar* csHeader, const XnChar* csFileNameFormat, ...);
00164 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpClose(XnDump* pDump);
00165 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpWriteBufferImpl(XnDump dump, const void* pBuffer, XnUInt32 nBufferSize);
00166 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpWriteStringImpl(XnDump dump, const XnChar* csFormat, ...);
00167 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpFlush(XnDump dump);
00168 
00169 #define xnDumpWriteBuffer(dump, pBuffer, nBufferSize)       \
00170     if (dump.hFile != XN_INVALID_FILE_HANDLE)               \
00171     {                                                       \
00172         xnDumpWriteBufferImpl(dump, pBuffer, nBufferSize);  \
00173     }
00174 
00175 #if XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_WIN32_VAARGS_STYLE
00176     #define xnDumpWriteString(dump, csFormat, ...)                      \
00177         if ((dump).hFile != XN_INVALID_FILE_HANDLE) {                   \
00178             xnDumpWriteStringImpl((dump), csFormat, __VA_ARGS__);       \
00179         }
00180 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_GCC_VAARGS_STYLE
00181     #define xnDumpWriteString(dump, csFormat, ...)                      \
00182         if ((dump).hFile != XN_INVALID_FILE_HANDLE) {                   \
00183             xnDumpWriteStringImpl((dump), csFormat, ##__VA_ARGS__);     \
00184         }
00185 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_ARC_VAARGS_STYLE
00186     #define xnDumpWriteString(dump, csFormat...)                        \
00187         if ((dump).hFile != XN_INVALID_FILE_HANDLE) {                   \
00188             xnDumpWriteStringImpl((dump), csFormat);                    \
00189         }
00190 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_NO_VAARGS
00191     #define xnDumpWriteString(dump, csFormat, arg)                      \
00192         if ((dump).hFile != XN_INVALID_FILE_HANDLE) {                   \
00193             xnDumpWriteStringImpl((dump), csFormat, arg);               \
00194         }
00195 #else
00196     #error Xiron Log - Unknown VAARGS type!
00197 #endif
00198 
00199 #endif // #ifndef __XN_NO_BC__
00200 
00201 #endif // __XN_DUMP_H__