Creates a new program with \p file in \p context. \see_opencl_ref{clCreateProgramWithSource}
| 413 | /// |
| 414 | /// \see_opencl_ref{clCreateProgramWithSource} |
| 415 | static program create_with_source_file(const std::string &file, |
| 416 | const context &context) |
| 417 | { |
| 418 | // open file stream |
| 419 | std::ifstream stream(file.c_str()); |
| 420 | |
| 421 | if(stream.fail()){ |
| 422 | BOOST_THROW_EXCEPTION(std::ios_base::failure("failed to create stream.")); |
| 423 | } |
| 424 | |
| 425 | // read source |
| 426 | std::string source( |
| 427 | (std::istreambuf_iterator<char>(stream)), |
| 428 | std::istreambuf_iterator<char>() |
| 429 | ); |
| 430 | |
| 431 | // create program |
| 432 | return create_with_source(source, context); |
| 433 | } |
| 434 | |
| 435 | /// Creates a new program with \p binary of \p binary_size in |
| 436 | /// \p context. |
nothing calls this directly
no outgoing calls
no test coverage detected