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
Go to the documentation of this file.
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 
30 #ifndef _CCL_ABSTRACT_WRAPPER_H_
31 #define _CCL_ABSTRACT_WRAPPER_H_
32 
33 #include "ccl_oclversions.h"
34 #include "ccl_common.h"
35 #include "ccl_errors.h"
36 
41 typedef struct ccl_wrapper_info {
42 
47  void* value;
48 
53  size_t size;
54 
56 
57 /* Increase the reference count of the wrapper object. */
58 CCL_EXPORT
59 void ccl_wrapper_ref(CCLWrapper* wrapper);
60 
61 /* Returns the wrapper object reference count. For debugging and
62  * testing purposes only. */
63 CCL_EXPORT
64 int ccl_wrapper_ref_count(CCLWrapper* wrapper);
65 
66 /* Get the wrapped OpenCL object. */
67 CCL_EXPORT
68 void* ccl_wrapper_unwrap(CCLWrapper* wrapper);
69 
70 /* Get information about any wrapped OpenCL object. */
71 CCL_EXPORT
73  CCLWrapper* wrapper2, cl_uint param_name, size_t min_size,
74  CCLInfo info_type, cl_bool use_cache, CCLErr** err);
75 
76 /* Get pointer to information value. */
77 CCL_EXPORT
79  CCLWrapper* wrapper2, cl_uint param_name, size_t min_size,
80  CCLInfo info_type, cl_bool use_cache, CCLErr** err);
81 
82 /* Get information size. */
83 CCL_EXPORT
84 size_t ccl_wrapper_get_info_size(CCLWrapper* wrapper1,
85  CCLWrapper* wrapper2, cl_uint param_name, size_t min_size,
86  CCLInfo info_type, cl_bool use_cache, CCLErr** err);
87 
88 /* Debug function which checks if memory allocated by wrappers
89  * has been properly freed. */
90 CCL_EXPORT
91 cl_bool ccl_wrapper_memcheck();
92 
93 /* Get wrapper class or type name. */
94 CCL_EXPORT
95 const char* ccl_wrapper_get_class_name(CCLWrapper* wrapper);
96 
97 #endif
98 
int ccl_wrapper_ref_count(CCLWrapper *wrapper)
Returns the wrapper object reference count.
const char * ccl_wrapper_get_class_name(CCLWrapper *wrapper)
Get wrapper class or type name.
enum ccl_info CCLInfo
Type of information to obtain using ccl_wrapper_get_info(), ccl_wrapper_get_info_value() and ccl_wrap...
struct ccl_wrapper_info CCLWrapperInfo
Class which represents information about a wrapped OpenCL object.
size_t ccl_wrapper_get_info_size(CCLWrapper *wrapper1, CCLWrapper *wrapper2, cl_uint param_name, size_t min_size, CCLInfo info_type, cl_bool use_cache, CCLErr **err)
Get information size.
void ccl_wrapper_ref(CCLWrapper *wrapper)
Increase the reference count of the wrapper object.
CCLWrapperInfo * ccl_wrapper_get_info(CCLWrapper *wrapper1, CCLWrapper *wrapper2, cl_uint param_name, size_t min_size, CCLInfo info_type, cl_bool use_cache, CCLErr **err)
Get information about any wrapped OpenCL object.
Base class for all OpenCL wrappers.
size_t size
Size in bytes of object information.
void * value
Object information.
Header for normalizing OpenCL versions within cf4ocl.
void * ccl_wrapper_get_info_value(CCLWrapper *wrapper1, CCLWrapper *wrapper2, cl_uint param_name, size_t min_size, CCLInfo info_type, cl_bool use_cache, CCLErr **err)
Get pointer to information value.
Class which represents information about a wrapped OpenCL object.
GError CCLErr
Error handling class.
Definition: ccl_common.h:291
cl_bool ccl_wrapper_memcheck()
Debug function which checks if memory allocated by wrappers has been properly freed.
Common cf4ocl definitions.
Convert OpenCL error codes to readable strings (function header).
void * ccl_wrapper_unwrap(CCLWrapper *wrapper)
Get the wrapped OpenCL object.