28 template <
class X,
class Y>
31 template <
class X,
class Y>
35 IndexInfo(
const T*,
int sz,T val);
37 template <
class X,
class Y>
39 template <
class X,
class Y>
49 template <
class T>
inline 58 {
inundef_ = val != arr[0];
return; }
59 const bool isrev = arr[0] > arr[sz-1];
60 if ( (isrev && val >= arr[0]) || (!isrev && val<=arr[0]) )
62 if ( (!isrev && val >= arr[sz-1]) || (isrev && val<=arr[sz-1]) )
71 if ( (!isrev && val < arr[
nearest_]) || (isrev && val > arr[nearest_]) )
73 T halfway = (arr[
nearest_] + arr[nearest_-1]) * .5f;
85 template <
class X,
class Y>
inline 88 const bool isrev = intv.
step < 0;
89 const Y hstep = intv.
step * 0.5;
91 if ( (isrev && y>intv.
start+hstep) || (!isrev && y<intv.
start-hstep) )
93 else if ( (isrev && y< intv.
stop-hstep) || (!isrev && y>intv.
stop+hstep) )
104 template <
class X,
class Y>
inline #define mExpClass(module)
Definition: commondefs.h:157
IndexInfo(const SamplingData< X > &s, Y y, int len)
Definition: indexinfo.h:32
T step
Definition: samplingdata.h:48
Info on (floating-point) position in an array or StepInterval.
Definition: indexinfo.h:21
int nrSteps() const
Definition: ranges.h:758
T atIndex(int) const
Definition: ranges.h:679
IndexInfo(const StepInterval< X > &s, Y y)
Definition: indexinfo.h:29
T atIndex(IT) const
Definition: samplingdata.h:156
T step
Definition: ranges.h:195
int nearest_
Definition: indexinfo.h:43
T start
Definition: samplingdata.h:47
Interval with step.
Definition: commontypes.h:29
T stop
Definition: ranges.h:91
void set(const StepInterval< X > &, Y)
Definition: indexinfo.h:86
T start
Definition: ranges.h:90
Holds the fundamental sampling info: start and interval.
Definition: samplingdata.h:20
bool inundef_
Definition: indexinfo.h:45
bool roundedtolow_
Definition: indexinfo.h:44
int nearestIndex(const X &) const
Definition: ranges.h:701
IndexInfo(int i, bool r=true, bool u=false)
Definition: indexinfo.h:24