LDMX Software
|
A maximally-packed index of up to four different fields. More...
#include <PackedIndex.h>
Public Member Functions | |
PackedIndex (unsigned int v0, unsigned int v1, unsigned int v2=0, unsigned int v3=0) | |
Constructor from field values Put our values into a single 32-bit integer. | |
PackedIndex (uint32_t value) | |
Constructor from index value. | |
unsigned int | field0 () const |
Get the value of field 0. | |
unsigned int | field1 () const |
Get the value of field 1. | |
unsigned int | field2 () const |
Get the value of field 2. | |
unsigned int | field3 () const |
Get the value of field 3. | |
uint32_t | value () const |
Get the fully packed index. | |
Private Attributes | |
uint32_t | index_ |
The 32-bit integer that is storing our fields. | |
A maximally-packed index of up to four different fields.
We can pack an index with different fields by knowing each field's modulus or the number of different values the field can have.
For example, if a field has values 0, 1, 2, 3 then its modulus is four.
The maths underlying this packing also assumes that values start with 0 and count up.
in] m0 modulus of field 0
in] m1 modulus of field 1, optional
in] m2 modulus of field 2, optional
Definition at line 32 of file PackedIndex.h.
|
inline |
Constructor from field values Put our values into a single 32-bit integer.
We are provided two to four values to pack.
[in] | v0 | value of field 0 |
[in] | v1 | value of field 1 |
[in] | v2 | value of field 2 |
[in] | v3 | value of field 3 |
Definition at line 48 of file PackedIndex.h.
References ldmx::PackedIndex< m0, m1, m2 >::index_.
|
inline |
Constructor from index value.
Definition at line 54 of file PackedIndex.h.
|
inline |
Get the value of field 0.
Definition at line 57 of file PackedIndex.h.
References ldmx::PackedIndex< m0, m1, m2 >::index_.
|
inline |
Get the value of field 1.
Definition at line 59 of file PackedIndex.h.
References ldmx::PackedIndex< m0, m1, m2 >::index_.
|
inline |
Get the value of field 2.
Definition at line 61 of file PackedIndex.h.
References ldmx::PackedIndex< m0, m1, m2 >::index_.
|
inline |
Get the value of field 3.
Definition at line 63 of file PackedIndex.h.
References ldmx::PackedIndex< m0, m1, m2 >::index_.
|
inline |
Get the fully packed index.
Definition at line 66 of file PackedIndex.h.
References ldmx::PackedIndex< m0, m1, m2 >::index_.
|
private |
The 32-bit integer that is storing our fields.
Definition at line 70 of file PackedIndex.h.
Referenced by ldmx::PackedIndex< m0, m1, m2 >::field0(), ldmx::PackedIndex< m0, m1, m2 >::field1(), ldmx::PackedIndex< m0, m1, m2 >::field2(), ldmx::PackedIndex< m0, m1, m2 >::field3(), ldmx::PackedIndex< m0, m1, m2 >::PackedIndex(), and ldmx::PackedIndex< m0, m1, m2 >::value().