15 #ifndef odc_api_StridedData_H
16 #define odc_api_StridedData_H
22 #include "eckit/exception/Exceptions.h"
30 template <
typename value_type>
42 using void_arg_t =
typename std::conditional<std::is_const<value_type>::value,
const void*,
void*>
::type;
61 ASSERT(rowOffset + nrows <=
nelem_);
66 ASSERT(rowOffset + nrows <=
nelem_);
89 void fill(
int sourceRow,
int finalRow);
92 if (row == 0)
return true;
123 return !(*
this == rhs);
144 template <
typename value_type>
147 ASSERT(sourceRow < finalRow);
151 if (dataSize_ == 8) {
153 std::fill(
reinterpret_cast<uint64_t*
>(get(sourceRow+1)),
154 reinterpret_cast<uint64_t*
>(get(finalRow+1)),
155 *
reinterpret_cast<uint64_t*
>(get(sourceRow)));
157 uint64_t src = *
reinterpret_cast<uint64_t*
>(get(sourceRow));
158 uint64_t* end =
reinterpret_cast<uint64_t*
>(get(finalRow));
159 for (uint64_t* p =
reinterpret_cast<uint64_t*
>(get(sourceRow+1));
161 p =
reinterpret_cast<uint64_t*
>(
reinterpret_cast<char*
>(p) + stride_)) {
166 char* src = get(sourceRow);
167 for (
int row = sourceRow + 1; row <= finalRow; ++row) {
168 ::memcpy(get(row), src, dataSize_);
value_type * operator[](int i)
void fill(int sourceRow, int finalRow)
friend std::ostream & operator<<(std::ostream &o, const StridedDataT< value_type > &s)
StridedDataT< value_type > & operator=(const StridedDataT< value_type > &rhs)=default
bool isNewValue(size_t row) const
StridedDataT(const StridedDataT< value_type > &rhs)=default
typename std::conditional< std::is_const< value_type >::value, const void *, void * >::type void_arg_t
StridedDataT< value_type > & operator++()
const_iterator begin() const
const_iterator end() const
const_value_type * get(int i) const
StridedDataT< value_type > slice(size_t rowOffset, size_t nrows) const
StridedDataT< value_type > slice(size_t rowOffset, size_t nrows)
StridedDataT< value_type > operator++(int)
bool operator!=(const StridedDataT< value_type > &rhs) const
bool operator==(const StridedDataT< value_type > &rhs) const
StridedDataT(void_arg_t data, size_t nelem, size_t dataSize, size_t stride)
typename std::add_const< value_type >::type const_value_type
const_value_type * operator*() const
const_value_type * operator[](int i) const