]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/compute/include/boost/compute/user_event.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / compute / include / boost / compute / user_event.hpp
CommitLineData
7c673cae
FG
1//---------------------------------------------------------------------------//
2// Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
3//
4// Distributed under the Boost Software License, Version 1.0
5// See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt
7//
8// See http://boostorg.github.com/compute for more information.
9//---------------------------------------------------------------------------//
10
11#ifndef BOOST_COMPUTE_USER_EVENT_HPP
12#define BOOST_COMPUTE_USER_EVENT_HPP
13
14#include <boost/compute/event.hpp>
15#include <boost/compute/context.hpp>
16
17namespace boost {
18namespace compute {
19
20#if defined(CL_VERSION_1_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
21/// \class user_event
22/// \brief An user-created event.
23///
24/// \opencl_version_warning{1,1}
25///
26/// \see event
27class user_event : public event
28{
29public:
30 /// Creates a new user-event object.
31 ///
32 /// \see_opencl_ref{clCreateUserEvent}
33 explicit user_event(const context &context)
34 {
35 cl_int error;
36 m_event = clCreateUserEvent(context.get(), &error);
37 if(!m_event){
38 BOOST_THROW_EXCEPTION(opencl_error(error));
39 }
40 }
41
42 /// Creates a new user-event from \p other.
43 user_event(const user_event &other)
44 : event(other)
45 {
46 }
47
48 /// Copies the user-event from \p other to \c *this.
49 user_event& operator=(const user_event &other)
50 {
51 event::operator=(other);
52
53 return *this;
54 }
55
56 #ifndef BOOST_COMPUTE_NO_RVALUE_REFERENCES
57 /// Move-constructs a new user event object from \p other.
58 user_event(user_event&& other) BOOST_NOEXCEPT
59 : event(std::move(other))
60 {
61 }
62
63 /// Move-assigns the user event from \p other to \c *this.
64 user_event& operator=(user_event&& other) BOOST_NOEXCEPT
65 {
66 event::operator=(std::move(other));
67
68 return *this;
69 }
70 #endif // BOOST_COMPUTE_NO_RVALUE_REFERENCES
71
72 /// Sets the execution status for the user-event.
73 ///
74 /// \see_opencl_ref{clSetUserEventStatus}
75 void set_status(cl_int execution_status)
76 {
77 cl_int ret = clSetUserEventStatus(m_event, execution_status);
78 if(ret != CL_SUCCESS){
79 BOOST_THROW_EXCEPTION(opencl_error(ret));
80 }
81 }
82};
83#endif // CL_VERSION_1_1
84
85} // end compute namespace
86} // end boost namespace
87
88#endif // BOOST_COMPUTE_EVENT_HPP