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 #ifdef CE_ENABLED
17 
18 #include <UT/UT_StringHolder.h>
19 
20 /// A class derived from cl::Error that allows arbitrary error messages to be
21 /// stored with the exception (as opposed to only globals like string
22 /// literals).
23 class CE_API CE_Error: public cl::Error
24 {
25 public:
26  CE_Error(cl_int err, const char *err_str = nullptr)
27  : cl::Error(err, nullptr), myErrStr(err_str)
28  {
29  }
30 
31  const char * what() const throw () override
32  {
33  return myErrStr.buffer();
34  }
35 
36 private:
37  UT_StringHolder myErrStr;
38 };
39 
40 
41 #endif
42 #endif
#define CE_API
Definition: CE_API.h:11
CE_Error(cl_int err, const char *err_str=nullptr)
Definition: CE_Error.h:26
int32_t cl_int
Definition: cl_platform.h:260
Error
Definition: oidn.hpp:577
const char * what() const override
Definition: CE_Error.h:31