Spaces:
Build error
Build error
File size: 1,783 Bytes
f8c5b0d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
#pragma once
// OpenCL Utils includes
#include "OpenCLUtilsCpp_Export.h"
// OpenCL Utils includes
#include <CL/Utils/ErrorCodes.h>
// OpenCL includes
#include <CL/opencl.hpp>
namespace cl {
namespace util {
#if defined(CL_HPP_ENABLE_EXCEPTIONS)
/*! \brief Exception class
*
* This may be thrown by SDK utility functions when
* CL_HPP_ENABLE_EXCEPTIONS is defined.
*/
class Error : public std::exception {
private:
int err_;
const char* errStr_;
public:
/*! \brief Create a new SDK error exception for a given error code
* and corresponding message.
*
* \param err error code value.
*
* \param errStr a descriptive string that must remain in scope until
* handling of the exception has concluded. If set, it
* will be returned by what().
*/
Error(cl_int err, const char* errStr = NULL): err_(err), errStr_(errStr)
{}
~Error() throw() {}
/*! \brief Get error string associated with exception
*
* \return A memory pointer to the error message string.
*/
virtual const char* what() const throw()
{
if (errStr_ == NULL)
{
return "empty";
}
else
{
return errStr_;
}
}
/*! \brief Get error code associated with exception
*
* \return The error code.
*/
cl_int err(void) const { return err_; }
};
#endif
namespace detail {
UTILSCPP_EXPORT cl_int errHandler(cl_int err, cl_int* errPtr,
const char* errStr = nullptr);
}
}
}
|