Skip to content
Architector edited this page Apr 18, 2019 · 6 revisions

This is an abstraction of kernels in the OpenCL program. Once created, the kernel can be used in various programs.

Contructors

Kernel(const char* name);
Kernel(const std::string& name);

Example:

ecl::Kernel myKern = "name_of_my_kernel";

Getters / setters

To get / set kernel name:

const std::string& getName() const;
void setName(const std::string& name);

Operators

You can use overloaded operators!

  1. Equality:
myKern = const char*;
myKern = const std::string&;

myKern += const char*;
myKern += const std::string&;
myKern += const std::Kernel&;
  1. Friend:
Kernel kern = myKern + const char*;
Kernel kern = myKern + const std::string&;
Kernel kern = myKern + const std::Kernel&;

Example:

ecl::Kernel kern = "name";
ecl::Kernel temp = "_of_my_";

kern += temp + "kernel"; // name_of_my_kernel

Copy / move

Also you can use (copy / move) (constructors / operator=)!

  1. Copy:
Kernel(const Kernel&);
kern = const Kernel&;

Example:

ecl::Kernel kern = "test";
ecl::Kernel kern2 = kern; // copy Kernel from kern
  1. Move:
Kernel(Kernel&&);
kern = std::move(Kernel&&);

Example:

ecl::Kernel kern = "test";
ecl::Kernel kern2 = std::move(kern); // now kern is clear, kern2 grab Kernel
Clone this wiki locally