1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #ifndef BOOST_COMPUTE_EXCEPTION_CONTEXT_ERROR_HPP
12 #define BOOST_COMPUTE_EXCEPTION_CONTEXT_ERROR_HPP
21 /// \class context_error
22 /// \brief A run-time OpenCL context error.
24 /// The context_error exception is thrown when the OpenCL context encounters
25 /// an error condition. Boost.Compute is notified of these error conditions by
26 /// registering an error handler when creating context objects (via the
27 /// \c pfn_notify argument to the \c clCreateContext() function).
29 /// This exception is different than the opencl_error exception which is thrown
30 /// as a result of error caused when calling a single OpenCL API function.
33 class context_error : public std::exception
36 /// Creates a new context error exception object.
37 context_error(const context *context,
39 const void *private_info,
40 size_t private_info_size) throw()
43 m_private_info(private_info),
44 m_private_info_size(private_info_size)
48 /// Destroys the context error object.
49 ~context_error() throw()
53 /// Returns a string with a description of the error.
54 const char* what() const throw()
59 /// Returns a pointer to the context object which generated the error
61 const context* get_context_ptr() const throw()
66 /// Returns a pointer to the private info memory block.
67 const void* get_private_info_ptr() const throw()
69 return m_private_info;
72 /// Returns the size of the private info memory block.
73 size_t get_private_info_size() const throw()
75 return m_private_info_size;
79 const context *m_context;
80 const char *m_errinfo;
81 const void *m_private_info;
82 size_t m_private_info_size;
85 } // end compute namespace
86 } // end boost namespace
88 #endif // BOOST_COMPUTE_EXCEPTION_CONTEXT_ERROR_HPP