1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013-2014 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_UNSUPPORTED_EXTENSION_ERROR_HPP
12 #define BOOST_COMPUTE_EXCEPTION_UNSUPPORTED_EXTENSION_ERROR_HPP
21 /// \class unsupported_extension_error
22 /// \brief Exception thrown when attempting to use an unsupported
25 /// This exception is thrown when the user attempts to use an OpenCL
26 /// extension which is not supported on the platform and/or device.
28 /// An example of this is attempting to use CL-GL sharing on a non-GPU
32 class unsupported_extension_error : public std::exception
35 /// Creates a new unsupported extension error exception object indicating
36 /// that \p extension is not supported by the OpenCL platform or device.
37 explicit unsupported_extension_error(const char *extension) throw()
38 : m_extension(extension)
40 std::stringstream msg;
41 msg << "OpenCL extension " << extension << " not supported";
42 m_error_string = msg.str();
45 /// Destroys the unsupported extension error object.
46 ~unsupported_extension_error() throw()
50 /// Returns the name of the unsupported extension.
51 std::string extension_name() const throw()
56 /// Returns a string containing a human-readable error message containing
57 /// the name of the unsupported exception.
58 const char* what() const throw()
60 return m_error_string.c_str();
64 std::string m_extension;
65 std::string m_error_string;
68 } // end compute namespace
69 } // end boost namespace
71 #endif // BOOST_COMPUTE_EXCEPTION_UNSUPPORTED_EXTENSION_ERROR_HPP