jigdo API
RsyncSum Class Reference
A 32 bit checksum with the special property that you do not need to recalculate the checksum when data is added to the front/end of the checksummed area, or removed from it. More...
#include <rsyncsum.hh>
Public Member Functions | |
RsyncSum () | |
Initialises the checksum with zero. | |
RsyncSum (const byte *mem, size_t len) | |
Initialises with the checksum of a memory area. | |
bool | operator== (const RsyncSum &x) const |
Compare two RsyncSum objects. | |
bool | operator!= (const RsyncSum &x) const |
bool | operator< (const RsyncSum &x) const |
bool | operator> (const RsyncSum &x) const |
bool | operator<= (const RsyncSum &x) const |
bool | operator>= (const RsyncSum &x) const |
RsyncSum & | addBack (const byte *mem, size_t len) |
Append memory area to end of area covered by the checksum. | |
RsyncSum & | addBack (byte x) |
Append one byte at end of area covered by the checksum. | |
RsyncSum & | addBackNtimes (byte x, size_t n) |
Append the same byte n times at end of area covered by the checksum. | |
RsyncSum & | removeFront (const byte *mem, size_t len, size_t areaSize) |
Remove memory area from start of area covered by the checksum. | |
RsyncSum & | removeFront (byte x, size_t areaSize) |
Remove one byte from start of area covered by checksum. | |
uint32 | get () const |
Read stored checksum. | |
RsyncSum & | reset () |
Reset to initial state. | |
bool | empty () const |
Check whether sum is zero. |
Detailed Description
A 32 bit checksum with the special property that you do not need to recalculate the checksum when data is added to the front/end of the checksummed area, or removed from it.Currently only adding to the end and removing from the front is supported. Adding to the end is very slightly faster.
Many thanks to Andrew Tridgell and Paul Mackerras for the algorithm - NB none of rsync's code is used.
Unless described otherwise, if a method returns an RsyncSum&, then this is a reference to the object itself, to allow chaining of calls, e.g. obj.addBack(x).addBack(y)
Constructor & Destructor Documentation
RsyncSum::RsyncSum | ( | ) | [inline] |
Initialises the checksum with zero.
RsyncSum::RsyncSum | ( | const byte * | mem, | |
size_t | len | |||
) | [inline] |
Member Function Documentation
bool RsyncSum::operator== | ( | const RsyncSum & | x | ) | const [inline] |
RsyncSum & RsyncSum::addBack | ( | const byte * | mem, | |
size_t | len | |||
) |
RsyncSum & RsyncSum::addBack | ( | byte | x | ) | [inline] |
Append one byte at end of area covered by the checksum.
RsyncSum & RsyncSum::addBackNtimes | ( | byte | x, | |
size_t | n | |||
) | [inline] |
Append the same byte n times at end of area covered by the checksum.
(addBack() is not overloaded for this in order to avoid confusion with removeFront(byte, size_t), which has the same signature, but only removes one byte.)
RsyncSum & RsyncSum::removeFront | ( | const byte * | mem, | |
size_t | len, | |||
size_t | areaSize | |||
) |
RsyncSum & RsyncSum::removeFront | ( | byte | x, | |
size_t | areaSize | |||
) | [inline] |
Remove one byte from start of area covered by checksum.
uint32 RsyncSum::get | ( | ) | const [inline] |
Read stored checksum.
Referenced by get_checksum1(), main(), operator!=(), operator<(), operator<=(), operator==(), operator>(), operator>=(), and removeFront().
bool RsyncSum::empty | ( | ) | const [inline] |
Check whether sum is zero.
The documentation for this class was generated from the following files:
- util/rsyncsum.hh
- util/rsyncsum.cc
Generated on Tue Sep 23 14:27:43 2008 for jigdo by
