Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:00

0001 //---------------------------------------------------------------------------//
0002 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
0003 //
0004 // Distributed under the Boost Software License, Version 1.0
0005 // See accompanying file LICENSE_1_0.txt or copy at
0006 // http://www.boost.org/LICENSE_1_0.txt
0007 //
0008 // See http://boostorg.github.com/compute for more information.
0009 //---------------------------------------------------------------------------//
0010 
0011 #ifndef BOOST_COMPUTE_EXCEPTION_CONTEXT_ERROR_HPP
0012 #define BOOST_COMPUTE_EXCEPTION_CONTEXT_ERROR_HPP
0013 
0014 #include <exception>
0015 
0016 namespace boost {
0017 namespace compute {
0018 
0019 class context;
0020 
0021 /// \class context_error
0022 /// \brief A run-time OpenCL context error.
0023 ///
0024 /// The context_error exception is thrown when the OpenCL context encounters
0025 /// an error condition. Boost.Compute is notified of these error conditions by
0026 /// registering an error handler when creating context objects (via the
0027 /// \c pfn_notify argument to the \c clCreateContext() function).
0028 ///
0029 /// This exception is different than the opencl_error exception which is thrown
0030 /// as a result of error caused when calling a single OpenCL API function.
0031 ///
0032 /// \see opencl_error
0033 class context_error : public std::exception
0034 {
0035 public:
0036     /// Creates a new context error exception object.
0037     context_error(const context *context,
0038                   const char *errinfo,
0039                   const void *private_info,
0040                   size_t private_info_size) throw()
0041         : m_context(context),
0042           m_errinfo(errinfo),
0043           m_private_info(private_info),
0044           m_private_info_size(private_info_size)
0045     {
0046     }
0047 
0048     /// Destroys the context error object.
0049     ~context_error() throw()
0050     {
0051     }
0052 
0053     /// Returns a string with a description of the error.
0054     const char* what() const throw()
0055     {
0056         return m_errinfo;
0057     }
0058 
0059     /// Returns a pointer to the context object which generated the error
0060     /// notification.
0061     const context* get_context_ptr() const throw()
0062     {
0063         return m_context;
0064     }
0065 
0066     /// Returns a pointer to the private info memory block.
0067     const void* get_private_info_ptr() const throw()
0068     {
0069         return m_private_info;
0070     }
0071 
0072     /// Returns the size of the private info memory block.
0073     size_t get_private_info_size() const throw()
0074     {
0075         return m_private_info_size;
0076     }
0077 
0078 private:
0079     const context *m_context;
0080     const char *m_errinfo;
0081     const void *m_private_info;
0082     size_t m_private_info_size;
0083 };
0084 
0085 } // end compute namespace
0086 } // end boost namespace
0087 
0088 #endif // BOOST_COMPUTE_EXCEPTION_CONTEXT_ERROR_HPP