OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Intervals< T, U > Class Template Reference

#include <Intervals.h>

Classes

class  Iterator
 

Public Member Functions

bool empty () const
 
Iterator begin () const
 
Iterator end () const
 

Private Member Functions

 Intervals (T begin, T end, U n_workers)
 

Private Attributes

T const begin_
 
U const total_size_
 
U const quot_
 
U const rem_
 

Friends

template<typename T1 , typename U1 >
Intervals< T1 > makeIntervals (T1 begin, T1 end, std::size_t n_workers)
 

Detailed Description

template<typename T, typename U = typename std::make_unsigned<T>::type>
class Intervals< T, U >

Definition at line 74 of file Intervals.h.

Constructor & Destructor Documentation

template<typename T, typename U = typename std::make_unsigned<T>::type>
Intervals< T, U >::Intervals ( begin,
end,
n_workers 
)
inlineprivate

Definition at line 80 of file Intervals.h.

81  : begin_(begin)
82  , total_size_(begin < end && n_workers ? end - begin : 0)
83  , quot_(n_workers ? total_size_ / n_workers : 0)
84  , rem_(n_workers ? total_size_ % n_workers : 0) {
85  static_assert(std::is_integral<T>::value);
86  }
Iterator begin() const
Definition: Intervals.h:115
T const begin_
Definition: Intervals.h:75
U const total_size_
Definition: Intervals.h:76
Iterator end() const
Definition: Intervals.h:116
U const rem_
Definition: Intervals.h:78
U const quot_
Definition: Intervals.h:77

Member Function Documentation

template<typename T, typename U = typename std::make_unsigned<T>::type>
Iterator Intervals< T, U >::begin ( ) const
inline

Definition at line 115 of file Intervals.h.

References Intervals< T, U >::begin_, Intervals< T, U >::quot_, and Intervals< T, U >::rem_.

Referenced by Intervals< T, U >::end(), and makeIntervals().

115 { return {begin_, quot_, rem_}; }
T const begin_
Definition: Intervals.h:75
U const rem_
Definition: Intervals.h:78
U const quot_
Definition: Intervals.h:77

+ Here is the caller graph for this function:

template<typename T, typename U = typename std::make_unsigned<T>::type>
bool Intervals< T, U >::empty ( ) const
inline

Definition at line 114 of file Intervals.h.

References Intervals< T, U >::total_size_.

114 { return !total_size_; }
U const total_size_
Definition: Intervals.h:76
template<typename T, typename U = typename std::make_unsigned<T>::type>
Iterator Intervals< T, U >::end ( ) const
inline

Definition at line 116 of file Intervals.h.

References Intervals< T, U >::begin(), Intervals< T, U >::begin_, Intervals< T, U >::makeIntervals, Intervals< T, U >::quot_, heavydb.dtypes::T, and Intervals< T, U >::total_size_.

Referenced by makeIntervals().

116 { return {static_cast<T>(begin_ + total_size_), quot_, 0}; }
T const begin_
Definition: Intervals.h:75
U const total_size_
Definition: Intervals.h:76
U const quot_
Definition: Intervals.h:77

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

template<typename T, typename U = typename std::make_unsigned<T>::type>
template<typename T1 , typename U1 >
Intervals<T1> makeIntervals ( T1  begin,
T1  end,
std::size_t  n_workers 
)
friend

Referenced by Intervals< T, U >::end().

Member Data Documentation

template<typename T, typename U = typename std::make_unsigned<T>::type>
T const Intervals< T, U >::begin_
private

Definition at line 75 of file Intervals.h.

Referenced by Intervals< T, U >::begin(), and Intervals< T, U >::end().

template<typename T, typename U = typename std::make_unsigned<T>::type>
U const Intervals< T, U >::quot_
private

Definition at line 77 of file Intervals.h.

Referenced by Intervals< T, U >::begin(), and Intervals< T, U >::end().

template<typename T, typename U = typename std::make_unsigned<T>::type>
U const Intervals< T, U >::rem_
private

Definition at line 78 of file Intervals.h.

Referenced by Intervals< T, U >::begin().

template<typename T, typename U = typename std::make_unsigned<T>::type>
U const Intervals< T, U >::total_size_
private

Definition at line 76 of file Intervals.h.

Referenced by Intervals< T, U >::empty(), and Intervals< T, U >::end().


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