#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) | |
ArrayNDScanner ()=delete | |
Private Member Functions | |
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(), and l1trig_cff::shape.
|
inlineexplicit |
Definition at line 42 of file ArrayNDScanner.h.
References initialize(), and l1trig_cff::shape.
|
delete |
|
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, MainPageGenerator::l, maxState_, state_, and strides_.
|
private |
Definition at line 7 of file ArrayNDScanner.cc.
References cms::cuda::assert(), dim_, dqmiolumiharvest::j, maxState_, l1trig_cff::shape, state_, strides_, and mitigatedMETSequence_cff::U.
Referenced by ArrayNDScanner().
|
inline |
Returns false when iteration is complete
Definition at line 59 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 56 of file ArrayNDScanner.h.
References maxState_.
|
inline |
|
inline |
Postfix increment (distinguished by the dummy "int" parameter)
Definition at line 75 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 81 of file ArrayNDScanner.h.
References maxState_, state(), and state_.
|
inline |
Retrieve current state (i.e., linear index of the scan)
Definition at line 53 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().