20 #ifndef GEOS_COMMON_BUFFERALLOCATOR_HPP
21 #define GEOS_COMMON_BUFFERALLOCATOR_HPP
26 #include <umpire/ResourceManager.hpp>
27 #include <umpire/TypedAllocator.hpp>
36 void setPreferPinned(
bool p );
43 bool getPreferPinned( );
59 template<
typename T >
67 umpire::TypedAllocator< value_type > m_alloc;
68 bool m_prefer_pinned_l;
77 : m_alloc( umpire::TypedAllocator< T >( umpire::ResourceManager::getInstance().getAllocator( umpire::resource::Host ) ) )
78 , m_prefer_pinned_l( getPreferPinned( ) )
80 #if defined(UMPIRE_ENABLE_PINNED)
81 if( m_prefer_pinned_l )
83 m_alloc = umpire::TypedAllocator< T >( umpire::ResourceManager::getInstance().getAllocator( umpire::resource::Pinned ) );
93 value_type * allocate(
size_t sz )
95 return m_alloc.allocate( sz );
103 void deallocate( value_type * buffer,
size_t sz )
105 if( buffer !=
nullptr )
106 m_alloc.deallocate( buffer, sz );
126 bool operator==(
const BufferAllocator & other )
bool operator!=(InputFlags const left, InputFlags const right)
Comparison operator for InputFlags enumeration.
bool operator==(InputFlags const left, InputFlags const right)
Comparison operator for InputFlags enumeration.