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 13 #include <string> 14 15 #include <boost/compute/exception/opencl_error.hpp> 16 17 namespace boost { 18 namespace compute { 19 20 /// \class program_build_failure 21 /// \brief A failure when building OpenCL program 22 /// 23 /// Instances of this class are thrown when OpenCL program build fails. 24 /// Extends opencl_error by saving a program build log so it can be used 25 /// for testing, debugging, or logging purposes. 26 /// 27 /// \see opencl_error 28 class program_build_failure : public opencl_error 29 { 30 public: 31 /// Creates a new program_build_failure exception object for \p error 32 /// and \p build_log. program_build_failure(cl_int error,const std::string & build_log)33 explicit program_build_failure(cl_int error, const std::string& build_log) 34 throw() 35 : opencl_error(error), 36 m_build_log(build_log) 37 { 38 } 39 40 /// Destroys the program_build_failure object. ~program_build_failure()41 ~program_build_failure() throw() 42 { 43 } 44 45 /// Retrieve the log of a failed program build. build_log() const46 std::string build_log() const throw() 47 { 48 return m_build_log; 49 } 50 51 private: 52 std::string m_build_log; 53 }; 54 55 } // end compute namespace 56 } // end boost namespace 57 58 #endif // BOOST_COMPUTE_EXCEPTION_PROGRAM_BUILD_FAILURE_HPP 59