Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | List of all members
uni20::HostBuffer< ElementType > Class Template Reference

Owning contiguous host buffer used by HostStorage. More...

#include <host_storage.hpp>

Public Types

using const_iterator = value_type const *
 
using iterator = value_type *
 
using size_type = std::size_t
 
using value_type = ElementType
 

Public Member Functions

auto begin () const noexcept -> const_iterator
 
auto begin () noexcept -> iterator
 
void clear () noexcept
 
auto data () const noexcept -> value_type const *
 
auto data () noexcept -> value_type *
 
bool empty () const noexcept
 
auto end () const noexcept -> const_iterator
 
auto end () noexcept -> iterator
 
 HostBuffer () noexcept=default
 
 HostBuffer (HostBuffer &&other) noexcept
 
 HostBuffer (HostBuffer const &other)
 
 HostBuffer (size_type size)
 Allocate storage for size elements.
 
 HostBuffer (size_type size, StorageInitialization initialization)
 Allocate elements with an explicit numerical initialization policy.
 
 HostBuffer (size_type size, value_type const &value)
 Allocate and fill storage with one value.
 
auto operator= (HostBuffer &&other) noexcept -> HostBuffer &
 
auto operator= (HostBuffer const &other) -> HostBuffer &
 
auto operator[] (size_type index) const noexcept -> value_type const &
 
auto operator[] (size_type index) noexcept -> value_type &
 
void resize (size_type size)
 Replace the allocation while preserving the common prefix.
 
void resize (size_type size, StorageInitialization initialization)
 Preserve the common prefix and initialize only newly added elements.
 
auto size () const noexcept -> size_type
 
void swap (HostBuffer &other) noexcept
 
 ~HostBuffer ()
 

Static Public Attributes

static constexpr bool initializes_elements = !uninitialized_ok<value_type>
 

Detailed Description

template<typename ElementType>
class uni20::HostBuffer< ElementType >

Owning contiguous host buffer used by HostStorage.

Allocation and growth leave uninitialized_ok elements unspecified. Other element types are value-constructed and destroyed normally. Copying preserves every stored object representation, and resizing preserves the common prefix just like std::vector::resize.

Template Parameters
ElementTypeElement type held in pageable host memory.

Member Typedef Documentation

◆ const_iterator

template<typename ElementType >
using uni20::HostBuffer< ElementType >::const_iterator = value_type const*

◆ iterator

template<typename ElementType >
using uni20::HostBuffer< ElementType >::iterator = value_type*

◆ size_type

template<typename ElementType >
using uni20::HostBuffer< ElementType >::size_type = std::size_t

◆ value_type

template<typename ElementType >
using uni20::HostBuffer< ElementType >::value_type = ElementType

Constructor & Destructor Documentation

◆ HostBuffer() [1/6]

template<typename ElementType >
uni20::HostBuffer< ElementType >::HostBuffer ( )
defaultnoexcept

◆ HostBuffer() [2/6]

template<typename ElementType >
uni20::HostBuffer< ElementType >::HostBuffer ( size_type  size)
inlineexplicit

Allocate storage for size elements.

Values are unspecified when value_type satisfies uninitialized_ok; otherwise elements are value-constructed.

◆ HostBuffer() [3/6]

template<typename ElementType >
uni20::HostBuffer< ElementType >::HostBuffer ( size_type  size,
StorageInitialization  initialization 
)
inline

Allocate elements with an explicit numerical initialization policy.

Exceptions
std::invalid_argumentIf Zero is requested for a type without a zero/default value.

◆ HostBuffer() [4/6]

template<typename ElementType >
uni20::HostBuffer< ElementType >::HostBuffer ( size_type  size,
value_type const &  value 
)
inline

Allocate and fill storage with one value.

◆ HostBuffer() [5/6]

template<typename ElementType >
uni20::HostBuffer< ElementType >::HostBuffer ( HostBuffer< ElementType > const &  other)
inline

◆ HostBuffer() [6/6]

template<typename ElementType >
uni20::HostBuffer< ElementType >::HostBuffer ( HostBuffer< ElementType > &&  other)
inlinenoexcept

◆ ~HostBuffer()

template<typename ElementType >
uni20::HostBuffer< ElementType >::~HostBuffer ( )
inline

Member Function Documentation

◆ begin() [1/2]

template<typename ElementType >
auto uni20::HostBuffer< ElementType >::begin ( ) const -> const_iterator
inlinenoexcept

◆ begin() [2/2]

template<typename ElementType >
auto uni20::HostBuffer< ElementType >::begin ( ) -> iterator
inlinenoexcept

◆ clear()

template<typename ElementType >
void uni20::HostBuffer< ElementType >::clear ( )
inlinenoexcept

◆ data() [1/2]

template<typename ElementType >
auto uni20::HostBuffer< ElementType >::data ( ) const -> value_type const*
inlinenoexcept

◆ data() [2/2]

template<typename ElementType >
auto uni20::HostBuffer< ElementType >::data ( ) -> value_type*
inlinenoexcept

◆ empty()

template<typename ElementType >
bool uni20::HostBuffer< ElementType >::empty ( ) const
inlinenoexcept

◆ end() [1/2]

template<typename ElementType >
auto uni20::HostBuffer< ElementType >::end ( ) const -> const_iterator
inlinenoexcept

◆ end() [2/2]

template<typename ElementType >
auto uni20::HostBuffer< ElementType >::end ( ) -> iterator
inlinenoexcept

◆ operator=() [1/2]

template<typename ElementType >
auto uni20::HostBuffer< ElementType >::operator= ( HostBuffer< ElementType > &&  other) -> HostBuffer&
inlinenoexcept

◆ operator=() [2/2]

template<typename ElementType >
auto uni20::HostBuffer< ElementType >::operator= ( HostBuffer< ElementType > const &  other) -> HostBuffer&
inline

◆ operator[]() [1/2]

template<typename ElementType >
auto uni20::HostBuffer< ElementType >::operator[] ( size_type  index) const -> value_type const&
inlinenoexcept

◆ operator[]() [2/2]

template<typename ElementType >
auto uni20::HostBuffer< ElementType >::operator[] ( size_type  index) -> value_type&
inlinenoexcept

◆ resize() [1/2]

template<typename ElementType >
void uni20::HostBuffer< ElementType >::resize ( size_type  size)
inline

Replace the allocation while preserving the common prefix.

Newly added uninitialized_ok elements have unspecified values.

◆ resize() [2/2]

template<typename ElementType >
void uni20::HostBuffer< ElementType >::resize ( size_type  size,
StorageInitialization  initialization 
)
inline

Preserve the common prefix and initialize only newly added elements.

◆ size()

template<typename ElementType >
auto uni20::HostBuffer< ElementType >::size ( ) const -> size_type
inlinenoexcept

◆ swap()

template<typename ElementType >
void uni20::HostBuffer< ElementType >::swap ( HostBuffer< ElementType > &  other)
inlinenoexcept

Member Data Documentation

◆ initializes_elements

template<typename ElementType >
constexpr bool uni20::HostBuffer< ElementType >::initializes_elements = !uninitialized_ok<value_type>
staticconstexpr

The documentation for this class was generated from the following file: