From 56f300607b1d0b81ab3269894fda5a066c46cdeb Mon Sep 17 00:00:00 2001 From: Ivan Shapovalov Date: Tue, 18 Oct 2016 04:53:06 +0300 Subject: Routine: get rid of ::SetUp() Since we now use C++ exceptions inside the implementation (and exceptions can be thrown from constructors), there is no need for a separate Routine::SetUp() function. For this, we also change the way how the kernel source string is constructed. The kernel-specific source code is now passed to the Routine ctor via an initializer_list of C strings to avoid unnecessary data copying while also working around C1091 of MSVC 2013. --- src/routine.hpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/routine.hpp') diff --git a/src/routine.hpp b/src/routine.hpp index c2bcdaff..f4ad435e 100644 --- a/src/routine.hpp +++ b/src/routine.hpp @@ -34,21 +34,19 @@ class Routine { // Base class constructor. The user database is an optional extra database to override the // built-in database. + // All heavy preparation work is done inside this constructor. explicit Routine(Queue &queue, EventPointer event, const std::string &name, const std::vector &routines, const Precision precision, - const std::vector &userDatabase = {}); - - // Set-up phase of the kernel - void SetUp(); + const std::vector &userDatabase, + std::initializer_list source); protected: // Non-static variable for the precision const Precision precision_; - // The routine's name and its kernel-source in string form + // The routine's name const std::string routine_name_; - std::string source_string_; // The OpenCL objects, accessible only from derived classes Queue queue_; -- cgit v1.2.3