OpenNI 1.5.7
XnDump.h
Go to the documentation of this file.
1 /*****************************************************************************
2 * *
3 * OpenNI 1.x Alpha *
4 * Copyright (C) 2012 PrimeSense Ltd. *
5 * *
6 * This file is part of OpenNI. *
7 * *
8 * Licensed under the Apache License, Version 2.0 (the "License"); *
9 * you may not use this file except in compliance with the License. *
10 * You may obtain a copy of the License at *
11 * *
12 * http://www.apache.org/licenses/LICENSE-2.0 *
13 * *
14 * Unless required by applicable law or agreed to in writing, software *
15 * distributed under the License is distributed on an "AS IS" BASIS, *
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
17 * See the License for the specific language governing permissions and *
18 * limitations under the License. *
19 * *
20 *****************************************************************************/
21 #ifndef __XN_DUMP_H__
22 #define __XN_DUMP_H__
23 
24 //---------------------------------------------------------------------------
25 // Includes
26 //---------------------------------------------------------------------------
27 #include "XnPlatform.h"
28 #include "XnStatus.h"
29 
30 //---------------------------------------------------------------------------
31 // Types
32 //---------------------------------------------------------------------------
33 struct XnDumpFile;
34 typedef struct XnDumpFile XnDumpFile;
35 
36 //---------------------------------------------------------------------------
37 // Functions
38 //---------------------------------------------------------------------------
39 
46 XN_C_API XnStatus XN_C_DECL xnDumpSetMaskState(const XnChar* strMask, XnBool bEnabled);
47 
53 XN_C_API XnBool XN_C_DECL xnLogIsDumpMaskEnabled(const XnChar* strDumpMask);
54 
63 XN_C_API XnDumpFile* XN_C_DECL xnDumpFileOpen(const XnChar* strDumpName, const XnChar* strNameFormat, ...);
64 
77 XN_C_API XnDumpFile* XN_C_DECL xnDumpFileOpenEx(const XnChar* strDumpName, XnBool bForce, XnBool bSessionDump, const XnChar* strNameFormat, ...);
78 
86 XN_C_API void XN_C_DECL _xnDumpFileWriteBuffer(XnDumpFile* pFile, const void* pBuffer, XnUInt32 nBufferSize);
87 
96 XN_C_API void XN_C_DECL _xnDumpFileWriteString(XnDumpFile* pFile, const XnChar* strFormat, ...);
97 
103 XN_C_API void XN_C_DECL _xnDumpFileClose(XnDumpFile* pFile);
104 
105 #define xnDumpFileWriteBuffer(pFile, pBuffer, nBufferSize) \
106  if ((pFile) != NULL) \
107  { \
108  _xnDumpFileWriteBuffer(pFile, pBuffer, nBufferSize); \
109  } \
110 
111 #define xnDumpFileClose(pFile) \
112  if ((pFile) != NULL) \
113  { \
114  _xnDumpFileClose(pFile); \
115  pFile = NULL; \
116  } \
117 
118 #if XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_WIN32_VAARGS_STYLE
119  #define xnDumpFileWriteString(pFile, strFormat, ...) \
120  if ((pFile) != NULL) \
121  { \
122  _xnDumpFileWriteString(pFile, strFormat, __VA_ARGS__); \
123  }
124 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_GCC_VAARGS_STYLE
125  #define xnDumpFileWriteString(pFile, strFormat, ...) \
126  if ((pFile) != NULL) \
127  { \
128  _xnDumpFileWriteString(pFile, strFormat, ##__VA_ARGS__);\
129  }
130 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_ARC_VAARGS_STYLE
131  #define xnDumpFileWriteString(pFile, strFormat, ...) \
132  if ((pFile) != NULL) \
133  { \
134  _xnDumpFileWriteString(pFile, strFormat); \
135  }
136 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_NO_VAARGS
137  #define xnDumpFileWriteString(pFile, strFormat, arg) \
138  if ((pFile) != NULL) \
139  { \
140  _xnDumpFileWriteString(pFile, strFormat,arg); \
141  }
142 #else
143  #error Xiron Log - Unknown VAARGS type!
144 #endif
145 
146 
147 //---------------------------------------------------------------------------
148 // Backwards Compatibility Stuff
149 //---------------------------------------------------------------------------
150 
151 #ifndef __XN_NO_BC__
152 
153 #include "XnOS.h"
154 
155 typedef struct XnDump
156 {
157  XN_FILE_HANDLE hFile;
158 } XnDump;
159 
160 const XnDump XN_DUMP_CLOSED = { XN_INVALID_FILE_HANDLE };
161 
162 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, ...);
163 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpForceInit(XnDump* pDump, const XnChar* csHeader, const XnChar* csFileNameFormat, ...);
164 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpClose(XnDump* pDump);
165 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpWriteBufferImpl(XnDump dump, const void* pBuffer, XnUInt32 nBufferSize);
166 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpWriteStringImpl(XnDump dump, const XnChar* csFormat, ...);
167 XN_C_API void XN_API_DEPRECATED("Use xnDumpFileX methods instead") XN_C_DECL xnDumpFlush(XnDump dump);
168 
169 #define xnDumpWriteBuffer(dump, pBuffer, nBufferSize) \
170  if (dump.hFile != XN_INVALID_FILE_HANDLE) \
171  { \
172  xnDumpWriteBufferImpl(dump, pBuffer, nBufferSize); \
173  }
174 
175 #if XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_WIN32_VAARGS_STYLE
176  #define xnDumpWriteString(dump, csFormat, ...) \
177  if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
178  xnDumpWriteStringImpl((dump), csFormat, __VA_ARGS__); \
179  }
180 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_GCC_VAARGS_STYLE
181  #define xnDumpWriteString(dump, csFormat, ...) \
182  if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
183  xnDumpWriteStringImpl((dump), csFormat, ##__VA_ARGS__); \
184  }
185 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_ARC_VAARGS_STYLE
186  #define xnDumpWriteString(dump, csFormat...) \
187  if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
188  xnDumpWriteStringImpl((dump), csFormat); \
189  }
190 #elif XN_PLATFORM_VAARGS_TYPE == XN_PLATFORM_USE_NO_VAARGS
191  #define xnDumpWriteString(dump, csFormat, arg) \
192  if ((dump).hFile != XN_INVALID_FILE_HANDLE) { \
193  xnDumpWriteStringImpl((dump), csFormat, arg); \
194  }
195 #else
196  #error Xiron Log - Unknown VAARGS type!
197 #endif
198 
199 #endif // #ifndef __XN_NO_BC__
200 
201 #endif // __XN_DUMP_H__
XN_C_API XnStatus XN_C_DECL xnDumpSetMaskState(const XnChar *strMask, XnBool bEnabled)
XnUInt32 XnStatus
Definition: XnStatus.h:33
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:123
XN_C_API XnDumpFile *XN_C_DECL xnDumpFileOpenEx(const XnChar *strDumpName, XnBool bForce, XnBool bSessionDump, const XnChar *strNameFormat,...)
struct XnDumpFile XnDumpFile
Definition: XnDump.h:34