JetMETCorrections
InterpolationTables
interface
ArrayNDScanner.h
Go to the documentation of this file.
1
#ifndef NPSTAT_ARRAYNDSCANNER_HH_
2
#define NPSTAT_ARRAYNDSCANNER_HH_
3
14
#include <vector>
15
#include <climits>
16
17
namespace
npstat
{
36
class
ArrayNDScanner
{
37
public
:
39
40
inline
ArrayNDScanner
(
const
unsigned
* shape,
const
unsigned
lenShape) {
initialize
(shape, lenShape); }
41
42
inline
explicit
ArrayNDScanner
(
const
std::vector<unsigned>& shape) {
43
initialize
(shape.empty() ? static_cast<unsigned*>(
nullptr
) : &shape[0], shape.size());
44
}
46
48
inline
unsigned
dim
()
const
{
return
dim_
; }
49
51
inline
unsigned
long
state
()
const
{
return
state_
; }
52
54
inline
unsigned
long
maxState
()
const
{
return
maxState_
; }
55
57
inline
bool
isValid
()
const
{
return
state_
<
maxState_
; }
58
60
void
getIndex
(
unsigned
*
index
,
unsigned
indexBufferLen)
const
;
61
63
inline
void
reset
() {
state_
= 0UL; }
64
66
inline
ArrayNDScanner
&
operator++
() {
67
if
(
state_
<
maxState_
)
68
++
state_
;
69
return
*
this
;
70
}
71
73
inline
void
operator++
(
int
) {
74
if
(
state_
<
maxState_
)
75
++
state_
;
76
}
77
79
inline
void
setState
(
const
unsigned
long
state
) {
state_
=
state
<=
maxState_
?
state
:
maxState_
; }
80
81
private
:
82
ArrayNDScanner
() =
delete
;
83
84
void
initialize
(
const
unsigned
* shape,
unsigned
lenShape);
85
86
unsigned
long
strides_
[CHAR_BIT *
sizeof
(
unsigned
long)];
87
unsigned
long
state_
;
88
unsigned
long
maxState_
;
89
unsigned
dim_
;
90
};
91
}
// namespace npstat
92
93
#endif // NPSTAT_ARRAYSCANNER_HH_
npstat::ArrayNDScanner::strides_
unsigned long strides_[CHAR_BIT *sizeof(unsigned long)]
Definition:
ArrayNDScanner.h:86
npstat::ArrayNDScanner::isValid
bool isValid() const
Definition:
ArrayNDScanner.h:57
npstat::ArrayNDScanner::initialize
void initialize(const unsigned *shape, unsigned lenShape)
Definition:
ArrayNDScanner.cc:7
npstat::ArrayNDScanner::dim
unsigned dim() const
Definition:
ArrayNDScanner.h:48
npstat::ArrayNDScanner::setState
void setState(const unsigned long state)
Definition:
ArrayNDScanner.h:79
npstat::ArrayNDScanner::maxState_
unsigned long maxState_
Definition:
ArrayNDScanner.h:88
npstat::ArrayNDScanner::operator++
void operator++(int)
Definition:
ArrayNDScanner.h:73
npstat::ArrayNDScanner::getIndex
void getIndex(unsigned *index, unsigned indexBufferLen) const
Definition:
ArrayNDScanner.cc:27
npstat::ArrayNDScanner::ArrayNDScanner
ArrayNDScanner()=delete
npstat::ArrayNDScanner::ArrayNDScanner
ArrayNDScanner(const unsigned *shape, const unsigned lenShape)
Definition:
ArrayNDScanner.h:40
npstat
Definition:
AbsArrayProjector.h:14
npstat::ArrayNDScanner::operator++
ArrayNDScanner & operator++()
Definition:
ArrayNDScanner.h:66
npstat::ArrayNDScanner::dim_
unsigned dim_
Definition:
ArrayNDScanner.h:89
npstat::ArrayNDScanner
Definition:
ArrayNDScanner.h:36
npstat::ArrayNDScanner::ArrayNDScanner
ArrayNDScanner(const std::vector< unsigned > &shape)
Definition:
ArrayNDScanner.h:42
npstat::ArrayNDScanner::state
unsigned long state() const
Definition:
ArrayNDScanner.h:51
npstat::ArrayNDScanner::state_
unsigned long state_
Definition:
ArrayNDScanner.h:87
AlignmentPI::index
index
Definition:
AlignmentPayloadInspectorHelper.h:46
npstat::ArrayNDScanner::reset
void reset()
Definition:
ArrayNDScanner.h:63
npstat::ArrayNDScanner::maxState
unsigned long maxState() const
Definition:
ArrayNDScanner.h:54
Generated for CMSSW Reference Manual by
1.8.16