Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //---------------------------------------------------------------------------//
0002 // Copyright (c) 2013-2014 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_UNSUPPORTED_EXTENSION_ERROR_HPP
0012 #define BOOST_COMPUTE_EXCEPTION_UNSUPPORTED_EXTENSION_ERROR_HPP
0013 
0014 #include <exception>
0015 #include <sstream>
0016 #include <string>
0017 
0018 namespace boost {
0019 namespace compute {
0020 
0021 /// \class unsupported_extension_error
0022 /// \brief Exception thrown when attempting to use an unsupported
0023 ///        OpenCL extension.
0024 ///
0025 /// This exception is thrown when the user attempts to use an OpenCL
0026 /// extension which is not supported on the platform and/or device.
0027 ///
0028 /// An example of this is attempting to use CL-GL sharing on a non-GPU
0029 /// device.
0030 ///
0031 /// \see opencl_error
0032 class unsupported_extension_error : public std::exception
0033 {
0034 public:
0035     /// Creates a new unsupported extension error exception object indicating
0036     /// that \p extension is not supported by the OpenCL platform or device.
0037     explicit unsupported_extension_error(const char *extension) throw()
0038         : m_extension(extension)
0039     {
0040         std::stringstream msg;
0041         msg << "OpenCL extension " << extension << " not supported";
0042         m_error_string = msg.str();
0043     }
0044 
0045     /// Destroys the unsupported extension error object.
0046     ~unsupported_extension_error() throw()
0047     {
0048     }
0049 
0050     /// Returns the name of the unsupported extension.
0051     std::string extension_name() const throw()
0052     {
0053         return m_extension;
0054     }
0055 
0056     /// Returns a string containing a human-readable error message containing
0057     /// the name of the unsupported exception.
0058     const char* what() const throw()
0059     {
0060         return m_error_string.c_str();
0061     }
0062 
0063 private:
0064     std::string m_extension;
0065     std::string m_error_string;
0066 };
0067 
0068 } // end compute namespace
0069 } // end boost namespace
0070 
0071 #endif // BOOST_COMPUTE_EXCEPTION_UNSUPPORTED_EXTENSION_ERROR_HPP