OpenCL C++ Bindings: cl::Context Class Reference

OpenCL C++ Bindings

Public Member Functions | Static Public Member Functions | List of all members
cl::Context Class Reference

Class interface for cl_context. More...

Inheritance diagram for cl::Context:

## Public Member Functions
| Context (const vector< Device > &devices, cl_context_properties *properties=NULL, void(CL_CALLBACK *notifyFptr)(const char *, const void *, size_type, void *)=NULL, void *data=NULL, cl_int *err=NULL)
| Constructs a context including a list of specified devices. More...
| Context (const Device &device, cl_context_properties *properties=NULL, void(CL_CALLBACK *notifyFptr)(const char *, const void *, size_type, void *)=NULL, void *data=NULL, cl_int *err=NULL)
| Constructs a context including a specific device. More...
| Context (cl_device_type type, cl_context_properties *properties=NULL, void(CL_CALLBACK *notifyFptr)(const char *, const void *, size_type, void *)=NULL, void *data=NULL, cl_int *err=NULL)
| Constructs a context including all or a subset of devices of a specified type. More...
| Context (const Context &ctx)
| Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Context & | operator= (const Context &ctx)
| Copy assignment to forward copy to the superclass correctly. Required for MSVC.
| Context (Context &&ctx) CL_HPP_NOEXCEPT_
| Move constructor to forward move to the superclass correctly. Required for MSVC.
Context & | operator= (Context &&ctx)
| Move assignment to forward move to the superclass correctly. Required for MSVC.
| Context ()
| Default constructor - initializes to NULL.
| Context (const cl_context &context, bool retainObject=false)
| Constructor from cl_context - takes ownership. More...
Context & | operator= (const cl_context &rhs)
| Assignment operator from cl_context - takes ownership. More...
template<typename T >
cl_int | getInfo (cl_context_info name, T *param) const
| Wrapper for clGetContextInfo().
template<cl_context_info name>
detail::param_traits< detail::cl_context_info, name >::param_type | getInfo (cl_int *err=NULL) const
| Wrapper for clGetContextInfo() that returns by value.
cl_int | getSupportedImageFormats (cl_mem_flags flags, cl_mem_object_type type, vector< ImageFormat > *formats) const
| Gets a list of supported image formats. More...
Public Member Functions inherited from cl::detail::Wrapper< cl_context >
| Wrapper (const cl_type &obj, bool retainObject)
| Wrapper (const Wrapper< cl_type > &rhs)
| Wrapper (Wrapper< cl_type > &&rhs) CL_HPP_NOEXCEPT_
Wrapper< cl_type > & | operator= (const Wrapper< cl_type > &rhs)
Wrapper< cl_type > & | operator= (Wrapper< cl_type > &&rhs)
Wrapper< cl_type > & | operator= (const cl_type &rhs)
const cl_type & | operator() () const
cl_type & | operator() ()
cl_type | get () const

## Static Public Member Functions
static Context | getDefault (cl_int *err=NULL)
| Returns a singleton context including all devices of CL_DEVICE_TYPE_DEFAULT. More...
static Context | setDefault (const Context &default_context)

## Additional Inherited Members
Public Types inherited from cl::detail::Wrapper< cl_context >
typedef cl_context | cl_type
Protected Member Functions inherited from cl::detail::Wrapper< cl_context >
cl_int | retain () const
cl_int | release () const
Protected Attributes inherited from cl::detail::Wrapper< cl_context >
cl_type | object_

## Detailed Description

Class interface for cl_context.

Note
  Copies of these objects are shallow, meaning that the copy will refer to the same underlying cl_context as the original. For details, see clRetainContext() and clReleaseContext().

See also
  cl_context

Definition at line 2780 of file opencl.hpp.

## Constructor & Destructor Documentation

## ◆ Context() [1/4]

cl::Context::Context | ( | const vector< Device > & | devices,
|  | cl_context_properties * | properties = `NULL`,
|  | void(CL_CALLBACK *notifyFptr)( const char *, const void *, size_type, void *) | = `NULL`,
|  | void * | data = `NULL`,
|  | cl_int * | err = `NULL`
| ) |  |
| inline

Constructs a context including a list of specified devices.

Wraps clCreateContext().

Definition at line 2852 of file opencl.hpp.

## ◆ Context() [2/4]

cl::Context::Context | ( | const Device & | device,
|  | cl_context_properties * | properties = `NULL`,
|  | void(CL_CALLBACK *notifyFptr)( const char *, const void *, size_type, void *) | = `NULL`,
|  | void * | data = `NULL`,
|  | cl_int * | err = `NULL`
| ) |  |
| inline

Constructs a context including a specific device.

Wraps clCreateContext().

Definition at line 2887 of file opencl.hpp.

## ◆ Context() [3/4]

cl::Context::Context | ( | cl_device_type | type,
|  | cl_context_properties * | properties = `NULL`,
|  | void(CL_CALLBACK *notifyFptr)( const char *, const void *, size_type, void *) | = `NULL`,
|  | void * | data = `NULL`,
|  | cl_int * | err = `NULL`
| ) |  |
| inline

Constructs a context including all or a subset of devices of a specified type.

Wraps clCreateContextFromType().

Definition at line 2917 of file opencl.hpp.

## ◆ Context() [4/4]

cl::Context::Context | ( | const cl_context & | context,
|  | bool | retainObject = `false`
| ) |  |
| inlineexplicit

Constructor from cl_context - takes ownership.

This effectively transfers ownership of a refcount on the cl_context into the new Context object.

Definition at line 3065 of file opencl.hpp.

## Member Function Documentation

## ◆ getDefault()

static Context cl::Context::getDefault | ( | cl_int * | err = `NULL` | ) |
| inlinestatic

Returns a singleton context including all devices of CL_DEVICE_TYPE_DEFAULT.

Note
  All calls to this function return the same cl_context as the first.

Definition at line 3033 of file opencl.hpp.

## ◆ getSupportedImageFormats()

cl_int cl::Context::getSupportedImageFormats | ( | cl_mem_flags | flags,
|  | cl_mem_object_type | type,
|  | vector< ImageFormat > * | formats
| ) |  | const
| inline

Gets a list of supported image formats.

Wraps clGetSupportedImageFormats().

Definition at line 3106 of file opencl.hpp.

## ◆ operator=()

Context& cl::Context::operator= | ( | const cl_context & | rhs | ) |
| inline

Assignment operator from cl_context - takes ownership.

This effectively transfers ownership of a refcount on the rhs and calls clReleaseContext() on the value previously held by this instance.

Definition at line 3073 of file opencl.hpp.

## ◆ setDefault()

static Context cl::Context::setDefault | ( | const Context & | default_context | ) |
| inlinestatic

Modify the default context to be used by subsequent operations. Will only set the default if no default was previously created.

Returns
  updated default context. Should be compared to the passed value to ensure that it was updated.

Definition at line 3050 of file opencl.hpp.

The documentation for this class was generated from the following file:

- opencl.hpp