File indexing completed on 2025-01-18 09:29:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_COMPUTE_ALLOCATOR_PINNED_ALLOCATOR_HPP
0012 #define BOOST_COMPUTE_ALLOCATOR_PINNED_ALLOCATOR_HPP
0013
0014 #include <boost/compute/allocator/buffer_allocator.hpp>
0015
0016 namespace boost {
0017 namespace compute {
0018
0019 template<class T>
0020 class pinned_allocator : public buffer_allocator<T>
0021 {
0022 public:
0023 explicit pinned_allocator(const context &context)
0024 : buffer_allocator<T>(context)
0025 {
0026 buffer_allocator<T>::set_mem_flags(
0027 buffer::read_write | buffer::alloc_host_ptr
0028 );
0029 }
0030
0031 pinned_allocator(const pinned_allocator<T> &other)
0032 : buffer_allocator<T>(other)
0033 {
0034 }
0035
0036 pinned_allocator<T>& operator=(const pinned_allocator<T> &other)
0037 {
0038 if(this != &other){
0039 buffer_allocator<T>::operator=(other);
0040 }
0041
0042 return *this;
0043 }
0044
0045 ~pinned_allocator()
0046 {
0047 }
0048 };
0049
0050 }
0051 }
0052
0053 #endif