Bolt  1.3
C++ template library with support for OpenCL
Static Public Member Functions | List of all members
TypeName< TypeNameType > Struct Template Reference

#include <clcode.h>

Static Public Member Functions

static std::string get ()
 

Detailed Description

template<typename TypeNameType>
struct TypeName< TypeNameType >

Bolt uses the TypeName trait to determine the string name of function object parameters when generating OpenCL(TM) code that instantiates the required templates. For example, if the user calls the Bolt transpose library with a functor MyClass, Bolt instantiates the transform's template function with the class MyClass.

This is the default implementation for the TypeName trait, which must be overriden with a class specialization to return a string name of the class. The default TypeName returns an error string that causes the OpenCL(TM) kernel compilation to fail.

The BOLT_CREATE_TYPENAME is a convenience macro that helps create a TypeName trait. An example:

class MyClass { ... };
// Create TypeName trait for "MyClass" manually:
template<> struct TypeName<MyClass> { static std::string get() { return "MyClass"; }};
// Same as above, but using the BOLT_CREATE_TYPENAME convenience macro.

Note that the TypeName trait must be defined exactly once for each functor class used in a Bolt API.


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