Clover Git
OpenCL 1.1 software implementation

context.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2011, Denis Steckelmacher <steckdenis@yahoo.fr>
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *     * Redistributions of source code must retain the above copyright
00008  *       notice, this list of conditions and the following disclaimer.
00009  *     * Redistributions in binary form must reproduce the above copyright
00010  *       notice, this list of conditions and the following disclaimer in the
00011  *       documentation and/or other materials provided with the distribution.
00012  *     * Neither the name of the copyright holder nor the
00013  *       names of its contributors may be used to endorse or promote products
00014  *       derived from this software without specific prior written permission.
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00017  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019  * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
00020  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00021  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00022  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00023  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00024  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00025  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026  */
00027 
00033 #ifndef __CONTEXT_H__
00034 #define __CONTEXT_H__
00035 
00036 #include "object.h"
00037 
00038 #include <CL/cl.h>
00039 
00040 namespace Coal
00041 {
00042 
00043 class DeviceInterface;
00044 
00050 class Context : public Object
00051 {
00052     public:
00063         Context(const cl_context_properties *properties,
00064                 cl_uint num_devices,
00065                 const cl_device_id *devices,
00066                 void (CL_CALLBACK *pfn_notify)(const char *, const void *,
00067                                                size_t, void *),
00068                 void *user_data,
00069                 cl_int *errcode_ret);
00070         ~Context();
00071 
00076         cl_int info(cl_context_info param_name,
00077                     size_t param_value_size,
00078                     void *param_value,
00079                     size_t *param_value_size_ret) const;
00080 
00086         bool hasDevice(DeviceInterface *device) const;
00087 
00088     private:
00089         cl_context_properties *p_properties;
00090         void (CL_CALLBACK *p_pfn_notify)(const char *, const void *,
00091                                                size_t, void *);
00092         void *p_user_data;
00093 
00094         DeviceInterface **p_devices;
00095         unsigned int p_num_devices, p_props_len;
00096         cl_platform_id p_platform;
00097 };
00098 
00099 }
00100 
00101 struct _cl_context : public Coal::Context
00102 {};
00103 
00104 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines