OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VectorView< T > Class Template Reference

#include <VectorView.h>

+ Collaboration diagram for VectorView< T >:

Public Types

using value_type = T
 
using size_type = std::size_t
 
using difference_type = std::ptrdiff_t
 
using reference = value_type &
 
using const_reference = value_type const &
 
using pointer = value_type *
 
using const_pointer = value_type const *
 
using iterator = pointer
 
using const_iterator = const_pointer
 

Public Member Functions

 VectorView ()=default
 
DEVICE VectorView (T *data, size_type const size, size_type const capacity)
 
DEVICE VectorView (T *data, size_type const size)
 
DEVICE T & back ()
 
DEVICE T const & back () const
 
DEVICE T * begin () const
 
DEVICE size_type capacity () const
 
DEVICE T const * cbegin () const
 
DEVICE T const * cend () const
 
DEVICE void clear ()
 
DEVICE T * data ()
 
DEVICE T const * data () const
 
DEVICE bool empty () const
 
DEVICE T * end () const
 
DEVICE bool full () const
 
DEVICE T & front ()
 
DEVICE T const & front () const
 
DEVICE T & operator[] (size_type const i)
 
DEVICE T const & operator[] (size_type const i) const
 
DEVICE void push_back (T const &value)
 
DEVICE void resize (size_type const size)
 
DEVICE void set (T *data, size_type const size)
 
DEVICE size_type size () const
 

Private Attributes

T * data_ {nullptr}
 
size_type size_ {0}
 
size_type capacity_ {0}
 

Detailed Description

template<typename T>
class VectorView< T >

Manage externally allocated memory ranges with a vector-like interface.

Definition at line 34 of file VectorView.h.

Member Typedef Documentation

template<typename T>
using VectorView< T >::const_iterator = const_pointer

Definition at line 44 of file VectorView.h.

template<typename T>
using VectorView< T >::const_pointer = value_type const*

Definition at line 42 of file VectorView.h.

template<typename T>
using VectorView< T >::const_reference = value_type const&

Definition at line 40 of file VectorView.h.

template<typename T>
using VectorView< T >::difference_type = std::ptrdiff_t

Definition at line 38 of file VectorView.h.

template<typename T>
using VectorView< T >::iterator = pointer

Definition at line 43 of file VectorView.h.

template<typename T>
using VectorView< T >::pointer = value_type*

Definition at line 41 of file VectorView.h.

template<typename T>
using VectorView< T >::reference = value_type&

Definition at line 39 of file VectorView.h.

template<typename T>
using VectorView< T >::size_type = std::size_t

Definition at line 37 of file VectorView.h.

template<typename T>
using VectorView< T >::value_type = T

Definition at line 36 of file VectorView.h.

Constructor & Destructor Documentation

template<typename T>
VectorView< T >::VectorView ( )
default
template<typename T>
DEVICE VectorView< T >::VectorView ( T *  data,
size_type const  size,
size_type const  capacity 
)
inline

Definition at line 53 of file VectorView.h.

DEVICE size_type capacity() const
Definition: VectorView.h:60
DEVICE T * data()
Definition: VectorView.h:64
DEVICE size_type size() const
Definition: VectorView.h:83
size_type capacity_
Definition: VectorView.h:49
size_type size_
Definition: VectorView.h:48
template<typename T>
DEVICE VectorView< T >::VectorView ( T *  data,
size_type const  size 
)
inline

Definition at line 55 of file VectorView.h.

55 : VectorView(data, size, size) {}
DEVICE T * data()
Definition: VectorView.h:64
DEVICE size_type size() const
Definition: VectorView.h:83
VectorView()=default

Member Function Documentation

template<typename T>
DEVICE T& VectorView< T >::back ( )
inline

Definition at line 57 of file VectorView.h.

Referenced by quantile::detail::TDigest< RealType, IndexType >::quantile().

57 { return data_[size_ - 1]; }
size_type size_
Definition: VectorView.h:48

+ Here is the caller graph for this function:

template<typename T>
DEVICE T const& VectorView< T >::back ( ) const
inline

Definition at line 58 of file VectorView.h.

58 { return data_[size_ - 1]; }
size_type size_
Definition: VectorView.h:48
template<typename T>
DEVICE T* VectorView< T >::begin ( ) const
inline

Definition at line 59 of file VectorView.h.

Referenced by quantile::detail::Centroids< RealType, IndexType >::appendAndSortCurrent(), quantile::detail::TDigest< RealType, IndexType >::quantile(), ResultSet::topPermutation(), and quantile::detail::Centroids< RealType, IndexType >::totalWeight().

59 { return data_; }

+ Here is the caller graph for this function:

template<typename T>
DEVICE size_type VectorView< T >::capacity ( ) const
inline

Definition at line 60 of file VectorView.h.

Referenced by quantile::detail::Centroids< RealType, IndexType >::capacity().

60 { return capacity_; }
size_type capacity_
Definition: VectorView.h:49

+ Here is the caller graph for this function:

template<typename T>
DEVICE T const* VectorView< T >::cbegin ( ) const
inline

Definition at line 61 of file VectorView.h.

61 { return data_; }
template<typename T>
DEVICE T const* VectorView< T >::cend ( ) const
inline

Definition at line 62 of file VectorView.h.

62 { return data_ + size_; }
size_type size_
Definition: VectorView.h:48
template<typename T>
DEVICE void VectorView< T >::clear ( )
inline

Definition at line 63 of file VectorView.h.

Referenced by quantile::detail::Centroids< RealType, IndexType >::clear().

63 { size_ = 0; }
size_type size_
Definition: VectorView.h:48

+ Here is the caller graph for this function:

template<typename T>
DEVICE T* VectorView< T >::data ( )
inline

Definition at line 64 of file VectorView.h.

Referenced by VectorView< RealType >::set(), quantile::detail::TDigest< RealType, IndexType >::setBuffer(), and quantile::detail::TDigest< RealType, IndexType >::setCentroids().

64 { return data_; }

+ Here is the caller graph for this function:

template<typename T>
DEVICE T const* VectorView< T >::data ( ) const
inline

Definition at line 65 of file VectorView.h.

65 { return data_; }
template<typename T>
DEVICE bool VectorView< T >::empty ( ) const
inline

Definition at line 66 of file VectorView.h.

66 { return size_ == 0; }
size_type size_
Definition: VectorView.h:48
template<typename T>
DEVICE T* VectorView< T >::end ( ) const
inline

Definition at line 67 of file VectorView.h.

Referenced by quantile::detail::TDigest< RealType, IndexType >::quantile(), ResultSet::topPermutation(), and quantile::detail::Centroids< RealType, IndexType >::totalWeight().

67 { return data_ + size_; }
size_type size_
Definition: VectorView.h:48

+ Here is the caller graph for this function:

template<typename T>
DEVICE T& VectorView< T >::front ( )
inline

Definition at line 69 of file VectorView.h.

69 { return *data_; }
template<typename T>
DEVICE T const& VectorView< T >::front ( ) const
inline

Definition at line 70 of file VectorView.h.

70 { return *data_; }
template<typename T>
DEVICE bool VectorView< T >::full ( ) const
inline

Definition at line 68 of file VectorView.h.

68 { return size_ == capacity_; }
size_type capacity_
Definition: VectorView.h:49
size_type size_
Definition: VectorView.h:48
template<typename T>
DEVICE T& VectorView< T >::operator[] ( size_type const  i)
inline

Definition at line 71 of file VectorView.h.

71 { return data_[i]; }
template<typename T>
DEVICE T const& VectorView< T >::operator[] ( size_type const  i) const
inline

Definition at line 72 of file VectorView.h.

72 { return data_[i]; }
template<typename T>
DEVICE void VectorView< T >::push_back ( T const &  value)
inline

Definition at line 73 of file VectorView.h.

Referenced by ResultSet::initPermutationBuffer(), and quantile::detail::Centroids< RealType, IndexType >::push_back().

73 { data_[size_++] = value; }
size_type size_
Definition: VectorView.h:48

+ Here is the caller graph for this function:

template<typename T>
DEVICE void VectorView< T >::resize ( size_type const  size)
inline

Definition at line 74 of file VectorView.h.

Referenced by VectorView< RealType >::set(), and ResultSet::topPermutation().

74  {
75  assert(size <= capacity_);
76  size_ = size;
77  }
DEVICE size_type size() const
Definition: VectorView.h:83
size_type capacity_
Definition: VectorView.h:49
size_type size_
Definition: VectorView.h:48

+ Here is the caller graph for this function:

template<typename T>
DEVICE void VectorView< T >::set ( T *  data,
size_type const  size 
)
inline

Definition at line 79 of file VectorView.h.

Referenced by quantile::detail::TDigest< RealType, IndexType >::mergeSorted().

79  {
80  resize(size);
81  data_ = data;
82  }
DEVICE T * data()
Definition: VectorView.h:64
DEVICE void resize(size_type const size)
Definition: VectorView.h:74
DEVICE size_type size() const
Definition: VectorView.h:83

+ Here is the caller graph for this function:

template<typename T>
DEVICE size_type VectorView< T >::size ( ) const
inline

Definition at line 83 of file VectorView.h.

Referenced by quantile::detail::Centroids< RealType, IndexType >::appendAndSortCurrent(), quantile::detail::operator<<(), VectorView< RealType >::resize(), quantile::detail::Centroids< RealType, IndexType >::size(), ResultSet::sort(), and ResultSet::topPermutation().

83 { return size_; }
size_type size_
Definition: VectorView.h:48

+ Here is the caller graph for this function:

Member Data Documentation

template<typename T>
size_type VectorView< T >::capacity_ {0}
private

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