cf4ocl (C Framework for OpenCL)  v2.1.0
Object-oriented framework for developing and benchmarking OpenCL projects in C/C++
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
_ccl_abstract_wrapper.h
1 /*
2  * This file is part of cf4ocl (C Framework for OpenCL).
3  *
4  * cf4ocl is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation, either version 3 of the
7  * License, or (at your option) any later version.
8  *
9  * cf4ocl is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with cf4ocl. If not, see
16  * <http://www.gnu.org/licenses/>.
17  * */
18 
31 #ifndef __CCL_ABSTRACT_WRAPPER_H_
32 #define __CCL_ABSTRACT_WRAPPER_H_
33 
34 #include "ccl_oclversions.h"
35 #include "ccl_common.h"
36 #include "ccl_errors.h"
37 
43 
47 struct ccl_wrapper {
48 
53  CCLClass class;
54 
59  void* cl_object;
60 
65  CCLWrapperInfoTable* info;
66 
71  int ref_count;
72 
73 };
74 
83 typedef void (*ccl_wrapper_release_fields)(CCLWrapper* wrapper);
84 
99 typedef CL_API_ENTRY cl_int
100  (CL_API_CALL* ccl_wrapper_release_cl_object)(void* cl_object);
101 
123 typedef CL_API_ENTRY cl_int (CL_API_CALL* ccl_wrapper_info_fp1)(
124  void* cl_object, cl_uint param_name, size_t param_value_size,
125  void* param_value, size_t* param_value_size_ret);
126 
150 typedef CL_API_ENTRY cl_int (CL_API_CALL* ccl_wrapper_info_fp2)(
151  void* cl_object1, void* cl_object2, cl_uint param_name,
152  size_t param_value_size, void* param_value,
153  size_t* param_value_size_ret);
154 
155 /* Create a new wrapper object. This function is called by the
156  * concrete wrapper constructors. */
157 CCLWrapper* ccl_wrapper_new(CCLClass class, void* cl_object, size_t size);
158 
159 /* Decrements the reference count of the wrapper object.
160  * If it reaches 0, the wrapper object is destroyed. */
161 cl_bool ccl_wrapper_unref(CCLWrapper* wrapper, size_t size,
162  ccl_wrapper_release_fields rel_fields_fun,
163  ccl_wrapper_release_cl_object rel_cl_fun, CCLErr** err);
164 
165 /* Add a ::CCLWrapperInfo object to the info table of the
166  * given wrapper. */
167 void ccl_wrapper_add_info(CCLWrapper* wrapper, cl_uint param_name,
168  CCLWrapperInfo* info);
169 
170 /* Create a new CCLWrapperInfo* object with a given value size. */
171 CCLWrapperInfo* ccl_wrapper_info_new(size_t size);
172 
173 /* Destroy a ::CCLWrapperInfo object. */
174 void ccl_wrapper_info_destroy(CCLWrapperInfo* info);
175 
176 #endif
177 
Information about wrapped OpenCL objects.
enum ccl_class CCLClass
Class or type of wrapped OpenCL object.
Base class for all OpenCL wrappers.
Header for normalizing OpenCL versions within cf4ocl.
Convert OpenCL error codes to readable strings (function header).
Class which represents information about a wrapped OpenCL object.
GError CCLErr
Error handling class.
Definition: ccl_common.h:291
Common cf4ocl definitions.