A template for encoding and decoding a vector of Triples. More...
Public Member Functions | |
CodeBuffer (T *lastTriple=0) | |
Initialise the code buffer and identify the previous triple used (for difference coding of the first element). | |
void | reset (void) |
Reset the buffer (including the index value). | |
void | resetRow (void) |
Reset the buffer (keep the index value). | |
void | encodeBuffer (TripleList< T > &buffer) |
Encode the given triple buffer. | |
void | decodeBuffer (TripleList< T > &buffer) |
Decode into the triple buffer. | |
void | encodeElement (T *element) |
Encode a single triple. | |
void | decodeElement (T *element) |
Decode a single triple. | |
void | encodeListSize (void) |
Encode the current list size. | |
void | decodeListSize (void) |
Decode the current list size. | |
bool | bufferFinished (void) |
Check if there are any more elements left to encode in the current buffer. | |
Protected Attributes | |
T * | _lastElement |
The previous element, used for difference coding. | |
int | elementsAvailable |
number of elements to encode or yet uncoded |
A template for encoding and decoding a vector of Triples.
This class allows the user to encode and decode a vector of Triples, where the triple type is the template parameter. The vector is encoded by first storing the length of the vector (the number of nonzero values), then storing the triple position and value elements. The positions are stored as differences since they are ascending values.