#include <ArrayNDScanner.h>
Public Member Functions | |
ArrayNDScanner (const std::vector< unsigned > &shape) | |
ArrayNDScanner (const unsigned *shape, const unsigned lenShape) | |
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 |
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 40 of file ArrayNDScanner.h.
References initialize().
|
inlineexplicit |
Definition at line 42 of file ArrayNDScanner.h.
References initialize().
|
privatedelete |
|
inline |
void npstat::ArrayNDScanner::getIndex | ( | unsigned * | index, |
unsigned | indexBufferLen | ||
) | const |
Retrieve current multidimensional index
Definition at line 27 of file ArrayNDScanner.cc.
References cms::cuda::assert(), dim_, mps_fire::i, heavyIonCSV_trainingSettings::idx, cmsLHEtoEOSManager::l, maxState_, state_, and strides_.
|
private |
Definition at line 7 of file ArrayNDScanner.cc.
References cms::cuda::assert(), dim_, dqmiolumiharvest::j, maxState_, state_, strides_, and mitigatedMETSequence_cff::U.
Referenced by ArrayNDScanner().
|
inline |
Returns false when iteration is complete
Definition at line 57 of file ArrayNDScanner.h.
References 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 54 of file ArrayNDScanner.h.
References maxState_.
|
inline |
|
inline |
|
inline |
Reset the state (as if the object has just been constructed)
Definition at line 63 of file ArrayNDScanner.h.
References state_.
|
inline |
|
inline |
Retrieve current state (i.e., linear index of the scan)
Definition at line 51 of file ArrayNDScanner.h.
References state_.
Referenced by setState().
|
private |
Definition at line 89 of file ArrayNDScanner.h.
Referenced by dim(), getIndex(), and initialize().
|
private |
Definition at line 88 of file ArrayNDScanner.h.
Referenced by getIndex(), initialize(), isValid(), maxState(), operator++(), and setState().
|
private |
Definition at line 87 of file ArrayNDScanner.h.
Referenced by getIndex(), initialize(), isValid(), operator++(), reset(), setState(), and state().
|
private |
Definition at line 86 of file ArrayNDScanner.h.
Referenced by getIndex(), and initialize().