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/detail/read_write_single_value.hpp>
21 // scalar<T> provides a trivial "container" that stores a
22 // single value in a memory buffer on a compute device
29 scalar(const context &context)
30 : m_buffer(context, sizeof(T))
38 T read(command_queue &queue) const
40 return read_single_value<T>(m_buffer, 0, queue);
43 void write(const T &value, command_queue &queue)
45 write_single_value<T>(value, m_buffer, 0, queue);
48 const buffer& get_buffer() const
57 } // end detail namespace
58 } // end compute namespace
59 } // end boost namespace
61 #endif // BOOST_COMPUTE_CONTAINER_DETAIL_SCALAR_HPP