\class program \brief A compute program. The program class represents an OpenCL program. Program objects are created with one of the static \c create_with_ functions. For example, to create a program from a source string: \snippet test/test_program.cpp create_with_source And to create a program from a source file: \code boost::compute::program bar_program = boost::compute::program::create_with
| 72 | /// |
| 73 | /// \see kernel |
| 74 | class program |
| 75 | { |
| 76 | public: |
| 77 | /// Creates a null program object. |
| 78 | program() |
| 79 | : m_program(0) |
| 80 | { |
| 81 | } |
| 82 | |
| 83 | /// Creates a program object for \p program. If \p retain is \c true, |
| 84 | /// the reference count for \p program will be incremented. |
| 85 | explicit program(cl_program program, bool retain = true) |
| 86 | : m_program(program) |
| 87 | { |
| 88 | if(m_program && retain){ |
| 89 | clRetainProgram(m_program); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | /// Creates a new program object as a copy of \p other. |
| 94 | program(const program &other) |
| 95 | : m_program(other.m_program) |
| 96 | { |
| 97 | if(m_program){ |
| 98 | clRetainProgram(m_program); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | /// Copies the program object from \p other to \c *this. |
| 103 | program& operator=(const program &other) |
| 104 | { |
| 105 | if(this != &other){ |
| 106 | if(m_program){ |
| 107 | clReleaseProgram(m_program); |
| 108 | } |
| 109 | |
| 110 | m_program = other.m_program; |
| 111 | |
| 112 | if(m_program){ |
| 113 | clRetainProgram(m_program); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | return *this; |
| 118 | } |
| 119 | |
| 120 | #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES |
| 121 | /// Move-constructs a new program object from \p other. |
| 122 | program(program&& other) BOOST_NOEXCEPT |
| 123 | : m_program(other.m_program) |
| 124 | { |
| 125 | other.m_program = 0; |
| 126 | } |
| 127 | |
| 128 | /// Move-assigns the program from \p other to \c *this. |
| 129 | program& operator=(program&& other) BOOST_NOEXCEPT |
| 130 | { |
| 131 | if(m_program){ |
no outgoing calls