program_build_failure.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //---------------------------------------------------------------------------//
  2. // Copyright (c) 2017 Kristian Popov <kristian.popov@outlook.com>
  3. //
  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
  7. //
  8. // See http://boostorg.github.com/compute for more information.
  9. //---------------------------------------------------------------------------//
  10. #ifndef BOOST_COMPUTE_EXCEPTION_PROGRAM_BUILD_FAILURE_HPP
  11. #define BOOST_COMPUTE_EXCEPTION_PROGRAM_BUILD_FAILURE_HPP
  12. #include <string>
  13. #include <boost/compute/exception/opencl_error.hpp>
  14. namespace boost {
  15. namespace compute {
  16. /// \class program_build_failure
  17. /// \brief A failure when building OpenCL program
  18. ///
  19. /// Instances of this class are thrown when OpenCL program build fails.
  20. /// Extends opencl_error by saving a program build log so it can be used
  21. /// for testing, debugging, or logging purposes.
  22. ///
  23. /// \see opencl_error
  24. class program_build_failure : public opencl_error
  25. {
  26. public:
  27. /// Creates a new program_build_failure exception object for \p error
  28. /// and \p build_log.
  29. explicit program_build_failure(cl_int error, const std::string& build_log)
  30. throw()
  31. : opencl_error(error),
  32. m_build_log(build_log)
  33. {
  34. }
  35. /// Destroys the program_build_failure object.
  36. ~program_build_failure() throw()
  37. {
  38. }
  39. /// Retrieve the log of a failed program build.
  40. std::string build_log() const throw()
  41. {
  42. return m_build_log;
  43. }
  44. private:
  45. std::string m_build_log;
  46. };
  47. } // end compute namespace
  48. } // end boost namespace
  49. #endif // BOOST_COMPUTE_EXCEPTION_PROGRAM_BUILD_FAILURE_HPP