OpenNI 1.3.2
XnDump.h
Go to the documentation of this file.
1 /****************************************************************************
2 * *
3 * OpenNI 1.1 Alpha *
4 * Copyright (C) 2011 PrimeSense Ltd. *
5 * *
6 * This file is part of OpenNI. *
7 * *
8 * OpenNI is free software: you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published *
10 * by the Free Software Foundation, either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * OpenNI is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
20 * *
21 ****************************************************************************/
22 #ifndef __XN_DUMP_H__
23 #define __XN_DUMP_H__
24 
25 //---------------------------------------------------------------------------
26 // Includes
27 //---------------------------------------------------------------------------
28 #include "XnOS.h"
29 
30 //---------------------------------------------------------------------------
31 // Types
32 //---------------------------------------------------------------------------
33 typedef struct XnDump
34 {
35  XN_FILE_HANDLE hFile;
36 } XnDump;
37 
38 const XnDump XN_DUMP_CLOSED = { XN_INVALID_FILE_HANDLE };
39 
40 //---------------------------------------------------------------------------
41 // Functions
42 //---------------------------------------------------------------------------
43 
50 XN_C_API XnStatus XN_C_DECL xnDumpSetMaskState(const XnChar* csMask, XnBool bEnabled);
51 
57 XN_C_API XnBool XN_C_DECL xnLogIsDumpMaskEnabled(const XnChar* csDumpMask);
58 
71 XN_C_API void XN_C_DECL xnDumpInit(XnDump* pDump, const XnChar* csDumpMask, const XnChar* csHeader, const XnChar* csFileNameFormat, ...);
72 
84 XN_C_API void XN_C_DECL xnDumpForceInit(XnDump* pDump, const XnChar* csHeader, const XnChar* csFileNameFormat, ...);
85 
92 XN_C_API void XN_C_DECL xnDumpClose(XnDump* pDump);
93 
101 XN_C_API void XN_C_DECL xnDumpWriteBufferImpl(XnDump dump, const void* pBuffer, XnUInt32 nBufferSize);
102 
103 inline void xnDumpWriteBuffer(XnDump dump, const void* pBuffer, XnUInt32 nBufferSize)
104 {
105  if (dump.hFile != XN_INVALID_FILE_HANDLE)
106  {
107  xnDumpWriteBufferImpl(dump, pBuffer, nBufferSize);
108  }
109 }
110 
118 XN_C_API void XN_C_DECL xnDumpWriteStringImpl(XnDump dump, const XnChar* csFormat, ...);
119 
125 XN_C_API void XN_C_DECL xnDumpFlush(XnDump dump);
126 
127 #if XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_WIN32_VAARGS_STYLE
128  #define xnDumpWriteString(dump, csFormat, ...) \
129  if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
130  xnDumpWriteStringImpl((dump), csFormat, __VA_ARGS__); \
131  }
132 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_GCC_VAARGS_STYLE
133  #define xnDumpWriteString(dump, csFormat, ...) \
134  if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
135  xnDumpWriteStringImpl((dump), csFormat, ##__VA_ARGS__); \
136  }
137 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_ARC_VAARGS_STYLE
138  #define xnDumpWriteString(dump, csFormat...) \
139  if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
140  xnDumpWriteStringImpl((dump), csFormat); \
141  }
142 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_NO_VAARGS
143  #define xnDumpWriteString(dump, csFormat, arg) \
144  if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
145  xnDumpWriteStringImpl((dump), csFormat, arg); \
146  }
147 #else
148  #error Xiron Log - Unknown VAARGS type!
149 #endif
150 
151 #endif // __XN_DUMP_H__