OpenNI 1.5.4
XnDump.h
Go to the documentation of this file.
1 /****************************************************************************
2 * *
3 * OpenNI 1.x 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 "XnPlatform.h"
29 #include "XnStatus.h"
30 
31 //---------------------------------------------------------------------------
32 // Types
33 //---------------------------------------------------------------------------
34 struct XnDumpFile;
35 typedef struct XnDumpFile XnDumpFile;
36 
37 //---------------------------------------------------------------------------
38 // Functions
39 //---------------------------------------------------------------------------
40 
47 XN_C_API XnStatus XN_C_DECL xnDumpSetMaskState(const XnChar* strMask, XnBool bEnabled);
48 
54 XN_C_API XnBool XN_C_DECL xnLogIsDumpMaskEnabled(const XnChar* strDumpMask);
55 
64 XN_C_API XnDumpFile* XN_C_DECL xnDumpFileOpen(const XnChar* strDumpName, const XnChar* strNameFormat, ...);
65 
78 XN_C_API XnDumpFile* XN_C_DECL xnDumpFileOpenEx(const XnChar* strDumpName, XnBool bForce, XnBool bSessionDump, const XnChar* strNameFormat, ...);
79 
87 XN_C_API void XN_C_DECL _xnDumpFileWriteBuffer(XnDumpFile* pFile, const void* pBuffer, XnUInt32 nBufferSize);
88 
97 XN_C_API void XN_C_DECL _xnDumpFileWriteString(XnDumpFile* pFile, const XnChar* strFormat, ...);
98 
104 XN_C_API void XN_C_DECL _xnDumpFileClose(XnDumpFile* pFile);
105 
106 #define xnDumpFileWriteBuffer(pFile, pBuffer, nBufferSize) \
107  if ((pFile) != NULL) \
108  { \
109  _xnDumpFileWriteBuffer(pFile, pBuffer, nBufferSize); \
110  } \
111 
112 #define xnDumpFileClose(pFile) \
113  if ((pFile) != NULL) \
114  { \
115  _xnDumpFileClose(pFile); \
116  pFile = NULL; \
117  } \
118 
119 #if XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_WIN32_VAARGS_STYLE
120  #define xnDumpFileWriteString(pFile, strFormat, ...) \
121  if ((pFile) != NULL) \
122  { \
123  _xnDumpFileWriteString(pFile, strFormat, __VA_ARGS__); \
124  }
125 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_GCC_VAARGS_STYLE
126  #define xnDumpFileWriteString(pFile, strFormat, ...) \
127  if ((pFile) != NULL) \
128  { \
129  _xnDumpFileWriteString(pFile, strFormat, ##__VA_ARGS__);\
130  }
131 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_ARC_VAARGS_STYLE
132  #define xnDumpFileWriteString(pFile, strFormat, ...) \
133  if ((pFile) != NULL) \
134  { \
135  _xnDumpFileWriteString(pFile, strFormat); \
136  }
137 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_NO_VAARGS
138  #define xnDumpFileWriteString(pFile, strFormat, arg) \
139  if ((pFile) != NULL) \
140  { \
141  _xnDumpFileWriteString(pFile, strFormat,arg); \
142  }
143 #else
144  #error Xiron Log - Unknown VAARGS type!
145 #endif
146 
147 
148 //---------------------------------------------------------------------------
149 // Backwards Compatibility Stuff
150 //---------------------------------------------------------------------------
151 
152 #ifndef __XN_NO_BC__
153 
154 #include "XnOS.h"
155 
156 typedef struct XnDump
157 {
158  XN_FILE_HANDLE hFile;
159 } XnDump;
160 
161 const XnDump XN_DUMP_CLOSED = { XN_INVALID_FILE_HANDLE };
162 
163 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, ...);
164 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpForceInit(XnDump* pDump, const XnChar* csHeader, const XnChar* csFileNameFormat, ...);
165 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpClose(XnDump* pDump);
166 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpWriteBufferImpl(XnDump dump, const void* pBuffer, XnUInt32 nBufferSize);
167 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpWriteStringImpl(XnDump dump, const XnChar* csFormat, ...);
168 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpFlush(XnDump dump);
169 
170 #define xnDumpWriteBuffer(dump, pBuffer, nBufferSize) \
171  if (dump.hFile != XN_INVALID_FILE_HANDLE) \
172  { \
173  xnDumpWriteBufferImpl(dump, pBuffer, nBufferSize); \
174  }
175 
176 #if XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_WIN32_VAARGS_STYLE
177  #define xnDumpWriteString(dump, csFormat, ...) \
178  if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
179  xnDumpWriteStringImpl((dump), csFormat, __VA_ARGS__); \
180  }
181 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_GCC_VAARGS_STYLE
182  #define xnDumpWriteString(dump, csFormat, ...) \
183  if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
184  xnDumpWriteStringImpl((dump), csFormat, ##__VA_ARGS__); \
185  }
186 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_ARC_VAARGS_STYLE
187  #define xnDumpWriteString(dump, csFormat...) \
188  if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
189  xnDumpWriteStringImpl((dump), csFormat); \
190  }
191 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_NO_VAARGS
192  #define xnDumpWriteString(dump, csFormat, arg) \
193  if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
194  xnDumpWriteStringImpl((dump), csFormat, arg); \
195  }
196 #else
197  #error Xiron Log - Unknown VAARGS type!
198 #endif
199 
200 #endif // #ifndef __XN_NO_BC__
201 
202 #endif // __XN_DUMP_H__
XN_C_API XnStatus XN_C_DECL xnDumpSetMaskState(const XnChar *strMask, XnBool bEnabled)
XnUInt32 XnStatus
Definition: XnStatus.h:34
XN_C_API XnBool XN_C_DECL xnLogIsDumpMaskEnabled(const XnChar *strDumpMask)
XN_C_API XnDumpFile *XN_C_DECL xnDumpFileOpen(const XnChar *strDumpName, const XnChar *strNameFormat,...)
#define XN_C_API
Definition: XnPlatform.h:126
XN_C_API XnDumpFile *XN_C_DECL xnDumpFileOpenEx(const XnChar *strDumpName, XnBool bForce, XnBool bSessionDump, const XnChar *strNameFormat,...)
struct XnDumpFile XnDumpFile
Definition: XnDump.h:35