Helper-class that allows access the array data. The design goal for introducing this class (instead of providing array references in the interface methods) is to allow a minimum of flexibility in respect to the data provision, while not using callback functions (or virtual methods) to access each single array element.
The approach implemented here, allows the array value to be a single attribute residing in an array of structs. For this, besides a base pointer to the first value and the length of the array, the distance between two values within the array of structs (or classes) has to be given.
By nature, to do this, basic pointer manipulation is needed, which imposes the need using char*
values internally, which are cast back to the source type with setters/getters.
Consequently, templated constructors are given, which accept array types to restrict such pointer conversion within the type.
Besides this, this accessor type, provides a transparent inline conversion of signed integer values to its unsigned counterparts by performing "zig zag encoding".
TIntegral | The integral array type. |
Public Type Index: | |
using | TUI = typename std::make_unsigned<TIntegral>::type |
The unsigned version of template type TIntegral . | |
Public Field Index: | |
TUI | max |
Maximum value (when zig-zag encoded) | |
TUI | maxDec |
Maximum decrease between two adjacent values. | |
TUI | maxInc |
Maximum increase between two adjacent values. | |
TUI | min |
Maximum value (when zig-zag encoded) | |
TUI | minDec |
Minimum decrease between two adjacent values. | |
TUI | minInc |
Minimum increase between two adjacent values. | |
Public Method Index: | |
Array (const TIntegral &firstValue, const TIntegral &secondValue, size_t length) | |
Array (const TIntegral *arrayStart, size_t length) | |
void | calcMinMax () |
TUI | get (size_t idx) const |
size_t | length () const |
void | set (size_t idx, TUI value) |
Private Field Index: | |
size_t | distance |
The distance in memory between two array values. | |
char * | firstVal |
Pointer to the first array value. | |
size_t | len |
The length of the array. | |
using alib::bitbuffer::ac_v1::ArrayCompressor::Array< TIntegral >::TUI = typename std::make_unsigned<TIntegral>::type |
|
private |
|
private |
|
private |
TUI alib::bitbuffer::ac_v1::ArrayCompressor::Array< TIntegral >::max |
TUI alib::bitbuffer::ac_v1::ArrayCompressor::Array< TIntegral >::maxDec |
TUI alib::bitbuffer::ac_v1::ArrayCompressor::Array< TIntegral >::maxInc |
TUI alib::bitbuffer::ac_v1::ArrayCompressor::Array< TIntegral >::min |
TUI alib::bitbuffer::ac_v1::ArrayCompressor::Array< TIntegral >::minDec |
TUI alib::bitbuffer::ac_v1::ArrayCompressor::Array< TIntegral >::minInc |
|
inline |
This constructor may (and must only) be used when the data is stored in simple arrays, hence when the data is not nested in an array of structs.
arrayStart | Pointer to the first value of the array. |
length | The length of the array |
Definition at line 96 of file ac.inl.
|
inline |
This constructor takes the first and the second array value as pointers. The second is used to "assume" (!) the distance in memory between each value.
firstValue | Pointer to the first value of the array. |
secondValue | Pointer to the second value of the array |
length | The length of the array |
Definition at line 116 of file ac.inl.
|
inline |
|
inline |
|
inline |
|
inline |