HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CE_Error.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: CE_Error.h ( CE Library, C++)
7  *
8  * COMMENTS: Compute Engine Error.
9  */
10 
11 #ifndef __CE_Error__
12 #define __CE_Error__
13 
14 #include "CE_API.h"
15 
16 #include <UT/UT_StringHolder.h>
17 
18 /// A class derived from cl::Error that allows arbitrary error messages to be
19 /// stored with the exception (as opposed to only globals like string
20 /// literals).
21 class CE_API CE_Error: public cl::Error
22 {
23 public:
24  CE_Error(cl_int err, const char *err_str = nullptr)
25  : cl::Error(err, nullptr), myErrStr(err_str)
26  {
27  }
28 
29  const char * what() const throw () override
30  {
31  return myErrStr.buffer();
32  }
33 
34 private:
35  UT_StringHolder myErrStr;
36 };
37 
38 
39 #endif
#define CE_API
Definition: CE_API.h:13
CE_Error(cl_int err, const char *err_str=nullptr)
Definition: CE_Error.h:24
int32_t cl_int
Definition: cl_platform.h:260
Error
Definition: oidn.hpp:577
const char * what() const override
Definition: CE_Error.h:29