OmniSciDB  ba1bac9284
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 constback () const
 
DEVICE T * begin () const
 
DEVICE size_type capacity () const
 
DEVICE T constcbegin () const
 
DEVICE T constcend () const
 
DEVICE void clear ()
 
DEVICE T * data ()
 
DEVICE T constdata () const
 
DEVICE bool empty () const
 
DEVICE T * end () const
 
DEVICE bool full () const
 
DEVICE T & front ()
 
DEVICE T constfront () const
 
DEVICE T & operator[] (size_type const i)
 
DEVICE T constoperator[] (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 35 of file VectorView.h.

Member Typedef Documentation

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

Definition at line 45 of file VectorView.h.

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

Definition at line 43 of file VectorView.h.

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

Definition at line 41 of file VectorView.h.

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

Definition at line 39 of file VectorView.h.

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

Definition at line 44 of file VectorView.h.

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

Definition at line 42 of file VectorView.h.

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

Definition at line 40 of file VectorView.h.

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

Definition at line 38 of file VectorView.h.

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

Definition at line 37 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 54 of file VectorView.h.

DEVICE size_type capacity() const
Definition: VectorView.h:61
DEVICE T * data()
Definition: VectorView.h:65
DEVICE size_type size() const
Definition: VectorView.h:84
size_type capacity_
Definition: VectorView.h:50
size_type size_
Definition: VectorView.h:49
template<typename T>
DEVICE VectorView< T >::VectorView ( T *  data,
size_type const  size 
)
inline

Definition at line 56 of file VectorView.h.

56 : VectorView(data, size, size) {}
DEVICE T * data()
Definition: VectorView.h:65
DEVICE size_type size() const
Definition: VectorView.h:84
VectorView()=default

Member Function Documentation

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

Definition at line 58 of file VectorView.h.

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

Definition at line 59 of file VectorView.h.

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

Definition at line 60 of file VectorView.h.

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

60 { return data_; }

+ Here is the caller graph for this function:

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

Definition at line 61 of file VectorView.h.

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

61 { return capacity_; }
size_type capacity_
Definition: VectorView.h:50

+ Here is the caller graph for this function:

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

Definition at line 62 of file VectorView.h.

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

Definition at line 63 of file VectorView.h.

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

Definition at line 64 of file VectorView.h.

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

64 { size_ = 0; }
size_type size_
Definition: VectorView.h:49

+ Here is the caller graph for this function:

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

Definition at line 65 of file VectorView.h.

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

65 { return data_; }

+ Here is the caller graph for this function:

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

Definition at line 66 of file VectorView.h.

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

Definition at line 67 of file VectorView.h.

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

Definition at line 68 of file VectorView.h.

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

68 { return data_ + size_; }
size_type size_
Definition: VectorView.h:49

+ Here is the caller graph for this function:

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

Definition at line 70 of file VectorView.h.

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

Definition at line 71 of file VectorView.h.

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

Definition at line 69 of file VectorView.h.

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

Definition at line 72 of file VectorView.h.

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

Definition at line 73 of file VectorView.h.

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

Definition at line 74 of file VectorView.h.

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

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

+ Here is the caller graph for this function:

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

Definition at line 75 of file VectorView.h.

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

75  {
76  assert(size <= capacity_);
77  size_ = size;
78  }
DEVICE size_type size() const
Definition: VectorView.h:84
size_type capacity_
Definition: VectorView.h:50
size_type size_
Definition: VectorView.h:49

+ 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 80 of file VectorView.h.

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

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

+ Here is the caller graph for this function:

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

Definition at line 84 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().

84 { return size_; }
size_type size_
Definition: VectorView.h:49

+ 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: