ViennaCL - The Vienna Computing Library  1.5.2
viennacl/ocl/command_queue.hpp
Go to the documentation of this file.
00001 #ifndef VIENNACL_OCL_COMMAND_QUEUE_HPP_
00002 #define VIENNACL_OCL_COMMAND_QUEUE_HPP_
00003 
00004 /* =========================================================================
00005    Copyright (c) 2010-2014, Institute for Microelectronics,
00006                             Institute for Analysis and Scientific Computing,
00007                             TU Wien.
00008    Portions of this software are copyright by UChicago Argonne, LLC.
00009 
00010                             -----------------
00011                   ViennaCL - The Vienna Computing Library
00012                             -----------------
00013 
00014    Project Head:    Karl Rupp                   rupp@iue.tuwien.ac.at
00015 
00016    (A list of authors and contributors can be found in the PDF manual)
00017 
00018    License:         MIT (X11), see file LICENSE in the base directory
00019 ============================================================================= */
00020 
00025 #ifdef __APPLE__
00026 #include <OpenCL/cl.h>
00027 #else
00028 #include <CL/cl.h>
00029 #endif
00030 
00031 #include <vector>
00032 #include <string>
00033 #include <sstream>
00034 #include "viennacl/ocl/device.hpp"
00035 #include "viennacl/ocl/handle.hpp"
00036 
00037 namespace viennacl
00038 {
00039   namespace ocl
00040   {
00041 
00045     class command_queue
00046     {
00047       public:
00048         command_queue() {}
00049         command_queue(viennacl::ocl::handle<cl_command_queue> h) : handle_(h) {}
00050 
00051         //Copy constructor:
00052         command_queue(command_queue const & other)
00053         {
00054           handle_ = other.handle_;
00055         }
00056 
00057         //assignment operator:
00058         command_queue & operator=(command_queue const & other)
00059         {
00060           handle_ = other.handle_;
00061           return *this;
00062         }
00063 
00064         bool operator==(command_queue const & other) const
00065         {
00066           return handle_ == other.handle_;
00067         }
00068 
00070         void finish() const
00071         {
00072           clFinish(handle_.get());
00073         }
00074 
00076         void flush() const
00077         {
00078           clFlush(handle_.get());
00079         }
00080 
00081         viennacl::ocl::handle<cl_command_queue> const & handle() const { return handle_; }
00082         viennacl::ocl::handle<cl_command_queue>       & handle()       { return handle_; }
00083 
00084       private:
00085 
00086         viennacl::ocl::handle<cl_command_queue> handle_;
00087     };
00088 
00089 
00090 
00091   } //namespace ocl
00092 } //namespace viennacl
00093 
00094 #endif