summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCNugteren <web@cedricnugteren.nl>2015-06-18 18:44:14 +0200
committerCNugteren <web@cedricnugteren.nl>2015-06-18 18:44:14 +0200
commit682c01a80cfcb9556799c790f126957d8d0c07e2 (patch)
tree6fe3e870192ed5867e4b5b88312b6ea28c6dbfd1 /include
parentaf40b8e667b6e369c633247e584baa9c13e86f98 (diff)
Now returns program from database by reference
Diffstat (limited to 'include')
-rw-r--r--include/internal/clpp11.h16
-rw-r--r--include/internal/routine.h4
2 files changed, 4 insertions, 16 deletions
diff --git a/include/internal/clpp11.h b/include/internal/clpp11.h
index 73040fdb..8cf28871 100644
--- a/include/internal/clpp11.h
+++ b/include/internal/clpp11.h
@@ -296,16 +296,6 @@ class Program: public ObjectWithState {
swap(*this, other);
return *this;
}
- /*
- TODO: Implement move construction/assignment?
- Program(Program &&other) {
- clRetainProgram(program_);
- swap(*this, other);
- }
- Program& operator=(Program &&other) {
- swap(*this, other);
- return *this;
- }*/
friend void swap(Program &first, Program &second) {
std::swap(first.length_, second.length_);
std::swap(first.source_, second.source_);
@@ -327,8 +317,7 @@ class Program: public ObjectWithState {
}
// Accessors to the private data-member
- cl_program operator()() const { return program_; }
- cl_program& operator()() { return program_; }
+ const cl_program& operator()() const { return program_; }
private:
size_t length_;
std::vector<char> source_;
@@ -382,8 +371,7 @@ class Kernel: public ObjectWithState {
}
// Accessors to the private data-member
- cl_kernel operator()() const { return kernel_; }
- cl_kernel& operator()() { return kernel_; }
+ const cl_kernel& operator()() const { return kernel_; }
private:
cl_kernel kernel_;
};
diff --git a/include/internal/routine.h b/include/internal/routine.h
index 4482d23b..1b2e0dbb 100644
--- a/include/internal/routine.h
+++ b/include/internal/routine.h
@@ -33,7 +33,7 @@ class Routine {
const std::string kKhronosHalfPrecision = "cl_khr_fp16";
const std::string kKhronosDoublePrecision = "cl_khr_fp64";
- // New data-type:tThe cache of compiled OpenCL programs, along with some meta-data
+ // The cache of compiled OpenCL programs, along with some meta-data
struct ProgramCache {
Program program;
std::string device_name;
@@ -101,7 +101,7 @@ class Routine {
// Queries the cache and retrieve either a matching program or a boolean whether a match exists.
// The first assumes that the program is available in the cache and will throw an exception
// otherwise.
- Program GetProgramFromCache() const;
+ const Program& GetProgramFromCache() const;
bool ProgramIsInCache() const;
// Non-static variable for the precision. Note that the same variable (but static) might exist in