28 inline bool filterUndef(
const T* input,T* output,
int sz);
48 void unSetUdf(
void* ptr,
od_int64 idx)
const;
53 typedef bool (*IsUdfFunc)(
const void*,
od_int64 idx);
54 typedef void (*SetUdfFunc)(
void*,
od_int64 idx);
55 typedef void (*UnsetUdfFunc)(
void*,
od_int64 idx);
61 static bool isUdfUChar(
const void*,
od_int64);
62 static void setUdfUChar(
void*,
od_int64);
63 static void unsetUdfUChar(
void*,
od_int64);
65 static bool isUdfChar(
const void*,
od_int64);
66 static void setUdfChar(
void*,
od_int64);
67 static void unsetUdfChar(
void*,
od_int64);
69 static bool isUdfUShort(
const void*,
od_int64);
70 static void setUdfUShort(
void*,
od_int64);
71 static void unsetUdfUShort(
void*,
od_int64);
73 static bool isUdfShort(
const void*,
od_int64);
74 static void setUdfShort(
void*,
od_int64);
75 static void unsetUdfShort(
void*,
od_int64);
77 static bool isUdfUInt32(
const void*,
od_int64);
78 static void setUdfUInt32(
void*,
od_int64);
79 static void unsetUdfUInt32(
void*,
od_int64);
81 static bool isUdfInt32(
const void*,
od_int64);
82 static void setUdfInt32(
void*,
od_int64);
83 static void unsetUdfInt32(
void*,
od_int64);
85 static bool isUdfUInt64(
const void*,
od_int64);
86 static void setUdfUInt64(
void*,
od_int64);
87 static void unsetUdfUInt64(
void*,
od_int64);
89 static bool isUdfInt64(
const void*,
od_int64);
90 static void setUdfInt64(
void*,
od_int64);
91 static void unsetUdfInt64(
void*,
od_int64);
93 static bool isUdfFloat(
const void*,
od_int64);
94 static void setUdfFloat(
void*,
od_int64);
95 static void unsetUdfFloat(
void*,
od_int64);
97 static bool isUdfDouble(
const void*,
od_int64);
98 static void setUdfDouble(
void*,
od_int64);
99 static void unsetUdfDouble(
void*,
od_int64);
103 template <
class T>
inline 106 if ( !sz || !outptr )
return true;
108 const T* inptr = input.
arr();
117 return filterUndef( inptr ? inptr : myinp, outptr, sz );
121 template <
class T>
inline 124 if ( !sz )
return true;
126 T* outptr = output.
arr();
130 myoutp = outptr =
new T[sz];
136 output->setValues( outptr, sz );
142 template <
class T>
inline 148 int firstdefined = 0;
149 while ( firstdefined<sz &&
mIsUdf(input[firstdefined]) )
152 if ( firstdefined==sz )
155 for (
int idx=0; idx<=firstdefined; idx++ )
156 output[idx] = input[firstdefined];
158 if ( firstdefined==sz-1 )
161 int prevdefined = firstdefined;
162 int nextdefined = -1;
164 for (
int idx=firstdefined+1; idx<sz; )
166 if ( !
mIsUdf(input[idx]) )
169 output[idx] = input[idx];
176 while ( nextdefined<sz &&
mIsUdf(input[nextdefined]) )
181 if ( nextdefined==sz )
183 for (
int posidx = prevdefined+1; posidx<sz; posidx++ )
184 output[posidx] = input[prevdefined];
190 const T diff = input[nextdefined] - input[prevdefined];
191 const T unit = diff / (float)(nextdefined-prevdefined);
192 for (
int posidx = prevdefined+1; posidx<=nextdefined; posidx++ )
193 output[posidx] = input[prevdefined]+unit*(posidx-prevdefined);
195 prevdefined = nextdefined;
#define mExpClass(module)
Definition: commondefs.h:160
void getValues(ValueSeries< T > &, int64_t nrvals) const
Definition: valseries.h:261
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:287
#define od_int64
Definition: plftypes.h:36
Class that handles undefvalues in arrays that are in a format described by a BinDataDesc.
Definition: undefarray.h:39
IsUdfFunc isudf_
Definition: undefarray.h:57
Interface to a series of values.
Definition: odmemory.h:17
SetUdfFunc setudf_
Definition: undefarray.h:58
T & setUdf(T &u)
Definition: undefval.h:262
UnsetUdfFunc limitrange_
Definition: undefarray.h:59
bool filterUndef(const T *input, T *output, int sz)
Definition: undefarray.h:143
Description of binary data.
Definition: bindatadesc.h:43
bool isUdf(const T &t)
Definition: undefval.h:243
virtual T * arr()
Definition: valseries.h:55