MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / Error

Class Error

include/internal/CL/cl.hpp:280–319  ·  view source on GitHub ↗

! \brief Exception class * * This may be thrown by API functions when __CL_ENABLE_EXCEPTIONS is defined. */

Source from the content-addressed store, hash-verified

278 * This may be thrown by API functions when __CL_ENABLE_EXCEPTIONS is defined.
279 */
280class Error : public std::exception
281{
282private:
283 cl_int err_;
284 const char * errStr_;
285public:
286 /*! \brief Create a new CL error exception for a given error code
287 * and corresponding message.
288 *
289 * \param err error code value.
290 *
291 * \param errStr a descriptive string that must remain in scope until
292 * handling of the exception has concluded. If set, it
293 * will be returned by what().
294 */
295 Error(cl_int err, const char * errStr = NULL) : err_(err), errStr_(errStr)
296 {}
297
298 ~Error() throw() {}
299
300 /*! \brief Get error string associated with exception
301 *
302 * \return A memory pointer to the error message string.
303 */
304 virtual const char * what() const throw ()
305 {
306 if (errStr_ == NULL) {
307 return "empty";
308 }
309 else {
310 return errStr_;
311 }
312 }
313
314 /*! \brief Get error code associated with exception
315 *
316 * \return The error code.
317 */
318 cl_int err(void) const { return err_; }
319};
320
321#define __ERR_STR(x) #x
322#else

Callers 1

errHandlerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected