#include <ArrayNDScanner.h>
Public Member Functions | |
unsigned | dim () const |
void | getIndex (unsigned *index, unsigned indexBufferLen) const |
bool | isValid () const |
unsigned long | maxState () const |
ArrayNDScanner & | operator++ () |
void | operator++ (int) |
void | reset () |
void | setState (const unsigned long state) |
unsigned long | state () const |
ArrayNDScanner (const unsigned *shape, const unsigned lenShape) | |
ArrayNDScanner (const std::vector< unsigned > &shape) | |
Private Member Functions | |
ArrayNDScanner ()=delete | |
void | initialize (const unsigned *shape, unsigned lenShape) |
Private Attributes | |
unsigned | dim_ |
unsigned long | maxState_ |
unsigned long | state_ |
unsigned long | strides_ [CHAR_BIT *sizeof(unsigned long)] |
This class can be used to iterate over array indices without actually building the array or requesting any memory from the heap. Typical use:
This can be useful, for example, in case one needs to iterate over slices of some array (so that the array itself can not be used to obtain similar information easily).
Definition at line 36 of file ArrayNDScanner.h.
|
inline |
Constructor from a multidimensional array shape
Definition at line 41 of file ArrayNDScanner.h.
References initialize().
|
inlineexplicit |
Definition at line 44 of file ArrayNDScanner.h.
References initialize().
|
privatedelete |
Referenced by setState().
|
inline |
void npstat::ArrayNDScanner::getIndex | ( | unsigned * | index, |
unsigned | indexBufferLen | ||
) | const |
Retrieve current multidimensional index
Definition at line 29 of file ArrayNDScanner.cc.
References dim_, mps_fire::i, training_settings::idx, checklumidiff::l, maxState_, state_, and strides_.
Referenced by isValid().
|
private |
Definition at line 7 of file ArrayNDScanner.cc.
References dim_, maxState_, state_, strides_, and mitigatedMETSequence_cff::U.
Referenced by ArrayNDScanner(), and setState().
|
inline |
Returns false when iteration is complete
Definition at line 59 of file ArrayNDScanner.h.
References getIndex(), diffTreeTool::index, maxState_, and state_.
Referenced by ntupleDataFormat._Object::_checkIsValid(), npstat::LinInterpolatedTableND< Numeric, Axis >::invertRatioResponse(), npstat::LinInterpolatedTableND< Numeric, Axis >::invertWRTAxis(), and core.AutoHandle.AutoHandle::ReallyLoad().
|
inline |
Maximum possible state (i.e., linear index of the scan)
Definition at line 56 of file ArrayNDScanner.h.
References maxState_.
|
inline |
|
inline |
Postfix increment (distinguished by the dummy "int" parameter)
Definition at line 72 of file ArrayNDScanner.h.
References maxState_, and state_.
|
inline |
Reset the state (as if the object has just been constructed)
Definition at line 65 of file ArrayNDScanner.h.
References state_.
|
inline |
Set the state directly
Definition at line 75 of file ArrayNDScanner.h.
References ArrayNDScanner(), initialize(), maxState_, and state_.
|
inline |
Retrieve current state (i.e., linear index of the scan)
Definition at line 53 of file ArrayNDScanner.h.
References state_.
|
private |
Definition at line 86 of file ArrayNDScanner.h.
Referenced by dim(), getIndex(), and initialize().
|
private |
Definition at line 85 of file ArrayNDScanner.h.
Referenced by getIndex(), initialize(), isValid(), maxState(), operator++(), and setState().
|
private |
Definition at line 84 of file ArrayNDScanner.h.
Referenced by getIndex(), initialize(), isValid(), operator++(), reset(), setState(), and state().
|
private |
Definition at line 83 of file ArrayNDScanner.h.
Referenced by getIndex(), and initialize().