1 #ifndef arraynddumper_h 2 #define arraynddumper_h 35 : inp_(arr), haveudfs_(true)
37 { setOneLinePerFastestDim(); }
40 { withpos_ =
true; nlafter_ = 1; }
41 inline void setOneLinePerFastestDim();
42 inline void setOneLinePerSlowestDim();
57 const int nrdims = inp_.info().getNDim();
58 nlafter_ = nrdims < 2 ? 0 : inp_.info().getSize( nrdims - 1 );
65 const int nrdims = inp_.info().getNDim();
67 { nlafter_ = 0;
return; }
70 for (
int idim=1; idim<nrdims; idim++ )
71 nlafter_ *= inp_.info().getSize( idim );
78 if ( inp_.isEmpty() )
return;
81 const int nrdims = inp_.info().getNDim();
86 const int* pos = it.getPos();
87 if ( withpos_ && nrthisline == 0 )
89 for (
int idim=0; idim<nrdims; idim++ )
94 const T val = inp_.getND( pos );
95 if ( haveudfs_ &&
mIsUdf(val) )
104 if ( nrthisline == nlafter_ )
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:287
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:26
bool withpos_
Definition: arraynddumper.h:47
#define od_int64
Definition: plftypes.h:36
ArrayNDDumper(const ArrayND< T > &arr)
Definition: arraynddumper.h:34
od_int64 nlafter_
Definition: arraynddumper.h:49
Dumps contents of ArrayND objects.
Definition: arraynddumper.h:30
void setOneLinePerFastestDim()
Definition: arraynddumper.h:55
#define od_tab
Definition: od_iosfwd.h:24
An ArrayND is an array with a given number of dimensions and a size.
Definition: arraynd.h:33
Iterates through all samples in an ArrayND.
Definition: arraynd.h:179
const ArrayND< T > & inp_
Definition: arraynddumper.h:46
void setSingleLineWithPos()
Definition: arraynddumper.h:39
bool haveudfs_
Definition: arraynddumper.h:48
#define mClass(module)
Definition: commondefs.h:164
void setOneLinePerSlowestDim()
Definition: arraynddumper.h:63
void dump(od_ostream &) const
Definition: arraynddumper.h:76
#define od_newline
Definition: od_iosfwd.h:25