1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
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
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #ifndef BOOST_COMPUTE_CONTAINER_DETAIL_SCALAR_HPP
12 #define BOOST_COMPUTE_CONTAINER_DETAIL_SCALAR_HPP
14 #include <boost/compute/buffer.hpp>
15 #include <boost/compute/event.hpp>
16 #include <boost/compute/detail/read_write_single_value.hpp>
22 // scalar<T> provides a trivial "container" that stores a
23 // single value in a memory buffer on a compute device
30 scalar(const context &context)
31 : m_buffer(context, sizeof(T))
39 T read(command_queue &queue) const
41 return read_single_value<T>(m_buffer, 0, queue);
44 event write(const T &value, command_queue &queue)
46 return write_single_value<T>(value, m_buffer, 0, queue);
49 const buffer& get_buffer() const
58 } // end detail namespace
59 } // end compute namespace
60 } // end boost namespace
62 #endif // BOOST_COMPUTE_CONTAINER_DETAIL_SCALAR_HPP