! \brief Class interface for cl_platform_id. * * \note Copies of these objects are inexpensive, since they don't 'own' * any underlying resources or data structures. * * \see cl_platform_id */
| 2175 | * \see cl_platform_id |
| 2176 | */ |
| 2177 | class Platform : public detail::Wrapper<cl_platform_id> |
| 2178 | { |
| 2179 | public: |
| 2180 | //! \brief Default constructor - initializes to NULL. |
| 2181 | Platform() : detail::Wrapper<cl_type>() { } |
| 2182 | |
| 2183 | /*! \brief Constructor from cl_platform_id. |
| 2184 | * |
| 2185 | * This simply copies the platform ID value, which is an inexpensive operation. |
| 2186 | */ |
| 2187 | __CL_EXPLICIT_CONSTRUCTORS Platform(const cl_platform_id &platform) : detail::Wrapper<cl_type>(platform) { } |
| 2188 | |
| 2189 | /*! \brief Assignment operator from cl_platform_id. |
| 2190 | * |
| 2191 | * This simply copies the platform ID value, which is an inexpensive operation. |
| 2192 | */ |
| 2193 | Platform& operator = (const cl_platform_id& rhs) |
| 2194 | { |
| 2195 | detail::Wrapper<cl_type>::operator=(rhs); |
| 2196 | return *this; |
| 2197 | } |
| 2198 | |
| 2199 | //! \brief Wrapper for clGetPlatformInfo(). |
| 2200 | cl_int getInfo(cl_platform_info name, STRING_CLASS* param) const |
| 2201 | { |
| 2202 | return detail::errHandler( |
| 2203 | detail::getInfo(&::clGetPlatformInfo, object_, name, param), |
| 2204 | __GET_PLATFORM_INFO_ERR); |
| 2205 | } |
| 2206 | |
| 2207 | //! \brief Wrapper for clGetPlatformInfo() that returns by value. |
| 2208 | template <cl_int name> typename |
| 2209 | detail::param_traits<detail::cl_platform_info, name>::param_type |
| 2210 | getInfo(cl_int* err = NULL) const |
| 2211 | { |
| 2212 | typename detail::param_traits< |
| 2213 | detail::cl_platform_info, name>::param_type param; |
| 2214 | cl_int result = getInfo(name, ¶m); |
| 2215 | if (err != NULL) { |
| 2216 | *err = result; |
| 2217 | } |
| 2218 | return param; |
| 2219 | } |
| 2220 | |
| 2221 | /*! \brief Gets a list of devices for this platform. |
| 2222 | * |
| 2223 | * Wraps clGetDeviceIDs(). |
| 2224 | */ |
| 2225 | cl_int getDevices( |
| 2226 | cl_device_type type, |
| 2227 | VECTOR_CLASS<Device>* devices) const |
| 2228 | { |
| 2229 | cl_uint n = 0; |
| 2230 | if( devices == NULL ) { |
| 2231 | return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR); |
| 2232 | } |
| 2233 | cl_int err = ::clGetDeviceIDs(object_, type, 0, NULL, &n); |
| 2234 | if (err != CL_SUCCESS) { |