3 #ifndef __base_separator_hpp__
4 #define __base_separator_hpp__
13 AvgBaseSep(T* array,
size_t size,
size_t bases);
15 T*
get(
size_t ndx,
size_t& amount)
const {
return mp_array + getOffset(ndx, amount); }
17 size_t getOffset(
size_t ndx,
size_t& amount)
const;
19 size_t size()
const {
return m_bases; }
47 if (!array || bases == 0 || bases > size)
48 throw std::logic_error(
"AvgBaseSep's constructor: Failed because of: 1) pointer to array is null. "
49 "2) amount of bases is equal to zero or more than size of array.");
52 m_base_size = size/bases + bool(m_dev);
55 throw std::logic_error(
"AvgBaseSep's constructor: Empty base. (Specfied zero size for array?).");
67 throw std::out_of_range(
"AvgBaseSep->getOffset: index out of range.");
70 if (m_dev && ndx >= m_dev) {
71 offset = m_dev*m_base_size + (ndx-m_dev)*(m_base_size-1);
72 amount = m_base_size-1;
75 offset = ndx*m_base_size;
83 #endif // __base_separator_hpp__
Definition: base_separator.hpp:10