38 void getValues(T*,
od_int64 nrvals)
const;
41 virtual bool isOK()
const {
return true; }
44 virtual bool writable()
const {
return false; }
55 virtual T*
arr() {
return 0; }
56 virtual const T*
arr()
const {
return 0; }
77 inline T value(
od_int64 idx )
const;
78 inline void setValue(
od_int64 idx, T v );
80 inline const T* arr()
const;
81 inline bool writable()
const;
82 inline bool canSetAll()
const;
83 inline void setAll(T);
100 { return typeid(RT)==typeid(AT) ? (RT*) ptr_ : (RT*) 0;} 108 template <
class RT,
class AT>
119 bool isOK()
const {
return ptr_; }
123 void setValue(
od_int64 idx, RT v );
131 bool selfSufficient()
const {
return mine_; }
146 #if defined __lux32__ 147 #define mChunkSize 0x20000000 148 #elif defined __win32__ 149 #define mChunkSize 0x20000000 151 #define mChunkSize 0x800000000 163 template <
class RT,
class AT>
173 bool isOK()
const {
return cursize_>=0; }
182 const RT* arr()
const;
211 , nriterations_( nriterations )
219 , nriterations_( nriterations )
226 const T* fromarr = from_.arr();
227 T* toarr = toptr_ ? toptr_ : to_->arr();
228 if ( toarr && fromarr )
230 (
size_t) (nrleft*from_.bytesPerItem()) );
234 for (
od_int64 idx=start; idx<=stop; idx++, toarr++ )
235 *toarr = from_.value( idx );
240 for (
od_int64 idx=start; idx<=stop; idx++, fromarr++ )
241 to_->setValue(idx, *fromarr );
245 for (
od_int64 idx=start; idx<=stop; idx++ )
246 to_->setValue(idx,from_.value(idx));
260 template <
class T>
inline 268 template <
class T>
inline 276 template <
class RT,
class AT>
inline 281 template <
class T>
inline 283 : src_( src ), off_( off ), writable_(true)
287 template <
class T>
inline 293 template <
class T>
inline 298 template <
class T>
inline 302 template <
class T>
inline 308 {
pErrMsg(
"Attempting to write to write-protected array"); }
312 template <
class T>
inline 318 {
pErrMsg(
"Attempting to write to write-protected array"); }
323 template <
class T>
inline 328 template <
class T>
inline 330 { T* p =
src_.arr();
return p ? p+
off_ : 0; }
333 template <
class T>
inline 335 { T* p =
src_.arr();
return p ? p+
off_ : 0; }
338 template <
class T>
inline 343 template <
class T>
inline 348 template <
class T>
inline 353 template <
class RT,
class AT>
355 : ptr_(ptr), mine_(memmine), cursize_( cursz )
359 template <
class RT,
class AT>
367 template <
class RT,
class AT>
381 template <
class RT,
class AT>
396 template <
class RT,
class AT>
411 template <
class RT,
class AT>
418 template <
class RT,
class AT>
inline 422 if ( !
mine_ )
return false;
434 if (
ptr_ && copysize>0 )
435 OD::memCopy(
ptr_, oldptr, (
size_t) (copysize*
sizeof(AT)) );
442 template <
class RT,
class AT>
inline 452 template <
class RT,
class AT>
inline 462 for (
int idx=0; idx<
ptrs_.
size(); idx++ )
469 curchunksize -= diff;
471 OD::memCopy(
ptrs_[idx], mavs.
ptrs_[idx], curchunksize*
sizeof(AT) );
477 template <
class RT,
class AT>
inline 484 template <
class RT,
class AT>
inline 503 template <
class RT,
class AT>
inline 522 template <
class RT,
class AT>
inline 531 for (
int idx=
ptrs_.
size()-1; idx>=0; idx-- )
538 curchunksize -= diff;
542 memsetter.
setSize( curchunksize );
548 template <
class RT,
class AT>
inline 556 template <
class RT,
class AT>
inline 561 template <
class RT,
class AT>
inline 570 while ( lefttoalloc )
586 if ( lefttoalloc > allocsize )
587 lefttoalloc -= allocsize;
T * arr()
Definition: valseries.h:329
void setValue(int64_t idx, RT v)
Definition: valseries.h:397
void getValues(ValueSeries< T > &, int64_t nrvals) const
Definition: valseries.h:261
T operator[](int64_t idx) const
Definition: valseries.h:60
ValueSeries< T > * clone() const
Definition: valseries.h:294
T to(const F &fr)
Definition: convert.h:33
ValueSeries< RT > * clone() const
Definition: valseries.h:368
Valueseries that allocates its data in smaller chunks. By doing this, it performs better in environme...
Definition: valseries.h:164
bool doWork(int64_t start, int64_t stop, int)
Definition: valseries.h:223
Sets large amounts of values to a constant using multiple threads.
Definition: odmemory.h:42
ValueSeries< T > & src_
Definition: valseries.h:91
bool setSize(int64_t)
Definition: valseries.h:419
int64_t nrIterations() const
Definition: valseries.h:222
ArrayValueSeries(AT *ptr, bool memmine, int64_t sz=-1)
Definition: valseries.h:354
#define mCast(tp, v)
Definition: commondefs.h:124
bool writable_
Definition: valseries.h:93
#define od_int64
Definition: plftypes.h:36
virtual bool reSizeable() const
Definition: valseries.h:52
virtual bool selfSufficient() const
Definition: valseries.h:50
ValueSeries< T > * to_
Definition: valseries.h:255
T value(int64_t idx) const
Definition: valseries.h:299
bool canSetAll() const
Definition: valseries.h:324
virtual bool setSize(int64_t)
Definition: valseries.h:53
bool writable() const
Definition: valseries.h:176
ValueSeries of offsets.
Definition: valseries.h:69
Gets ValueSeries.
Definition: valseries.h:203
MultiArrayValueSeries(int64_t)
Definition: valseries.h:443
#define mImplArr
Definition: valseries.h:99
const RT * arr() const
Definition: valseries.h:557
#define mMIN(x, y)
Definition: commondefs.h:49
bool writable() const
Definition: valseries.h:349
bool selfSufficient() const
Definition: valseries.h:185
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:66
size_type size() const
Definition: objectset.h:50
bool reSizeable() const
Definition: valseries.h:132
RT value(int64_t idx) const
Definition: valseries.h:382
Series of values from a pointer to some kind of array. If a more advanced conversion between the retu...
Definition: valseries.h:109
virtual bool isOK() const
Definition: valseries.h:41
int64_t off_
Definition: valseries.h:92
bool isOK() const
Definition: valseries.h:173
RT value(int64_t idx) const
Definition: valseries.h:485
virtual bool writable() const
Definition: valseries.h:44
int64_t cursize_
Definition: valseries.h:193
const RT * arr() const
Definition: valseries.h:128
T * toptr_
Definition: valseries.h:256
OffsetValueSeries(ValueSeries< T > &src, int64_t off)
Definition: valseries.h:282
char bytesPerItem() const
Definition: valseries.h:189
bool execute()
Definition: paralleltask.h:71
Interface to a series of values.
Definition: odmemory.h:17
#define mTryAlloc(var, stmt)
Catches bad_alloc and sets ptr to null as normal.
Definition: commondefs.h:241
int64_t getOffset() const
Definition: valseries.h:339
int64_t cursize_
Definition: valseries.h:141
bool isOK() const
Definition: valseries.h:119
void memValueSet(T *, T, int64_t, TaskRunner *taskrun=0)
Definition: odmemory.h:480
bool canSetAll() const
Definition: valseries.h:179
ValueSeriesGetAll(const ValueSeries< T > &from, ValueSeries< T > &to, int64_t nriterations)
Definition: valseries.h:206
void setOffset(int64_t no)
Definition: valseries.h:344
AT * ptr_
Definition: valseries.h:139
virtual void setValue(int64_t, T)
Definition: valseries.h:45
virtual void setAll(T)
Definition: valseries.h:48
bool setSize(int64_t)
Definition: valseries.h:562
#define od_uint64
Definition: plftypes.h:37
void sysMemCopy(void *, const void *, int64_t)
virtual char bytesPerItem() const
Definition: valseries.h:58
void setValue(int64_t idx, RT v)
Definition: valseries.h:504
int64_t size() const
Definition: valseries.h:188
void setAll(RT)
Definition: valseries.h:523
const ValueSeries< T > & source() const
Definition: valseries.h:88
void deepEraseArr(ObjectSet< T > &os)
empty the ObjectSet deleting all objects pointed to.
Definition: objectset.h:122
~ArrayValueSeries()
Definition: valseries.h:115
~MultiArrayValueSeries()
Definition: valseries.h:478
void forceCrash(bool withdump)
#define mChunkSize
Definition: valseries.h:151
ValueSeriesGetAll(const ValueSeries< T > &from, T *to, int64_t nriterations)
Definition: valseries.h:214
void setAll(RT)
Definition: valseries.h:412
virtual bool validIdx(int64_t) const
Definition: objectset.h:302
ObjectSet< AT > ptrs_
Definition: valseries.h:192
bool writable() const
Definition: valseries.h:122
int64_t nriterations_
Definition: valseries.h:253
virtual bool canSetAll() const
Definition: valseries.h:47
void setSize(int64_t sz)
Definition: odmemory.h:55
void allowNull(bool yn=true)
Definition: objectset.h:297
#define mClass(module)
Definition: commondefs.h:164
#define pErrMsg(msg)
Definition: errmsg.h:60
const ValueSeries< T > & from_
Definition: valseries.h:254
bool mine_
Definition: valseries.h:140
void setValue(int64_t idx, T v)
Definition: valseries.h:303
void setAll(T)
Definition: valseries.h:313
virtual T * arr()
Definition: valseries.h:55
const int64_t chunksize_
Definition: valseries.h:194
void setTarget(T *ptr)
Definition: odmemory.h:53
void setValue(const T &val)
Definition: odmemory.h:52
char bytesPerItem() const
Definition: valseries.h:135
ValueSeries< RT > * clone() const
Definition: valseries.h:277
int64_t size() const
Definition: valseries.h:134
virtual ~ValueSeries()
Definition: valseries.h:35
virtual const T * arr() const
Definition: valseries.h:56
bool canSetAll() const
Definition: valseries.h:125
bool reSizeable() const
Definition: valseries.h:186