Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Fletcher Class Reference

#include <elm/checksum/Fletcher.h>

Public Member Functions

 Fletcher (void)
 
virtual ~Fletcher (void)
 
t::uint32 sum (void)
 
void put (io::InStream &in)
 
void put (const void *buffer, int length)
 
void put (const CString &str)
 
void put (const String &str)
 
Fletcheroperator<< (const char *str)
 
Fletcheroperator<< (const CString &str)
 
Fletcheroperator<< (const String &str)
 
template<class T >
Fletcheroperator<< (const T &value)
 
virtual int write (const char *buffer, int size)
 
virtual int flush (void)
 
virtual cstring lastErrorMessage (void)
 

Detailed Description

Apply the Fletcher algorithm (http://en.wikipedia.org/wiki/Fletcher%27s_checksum) to compute a checksum.

Data are checksummed calling any one of the put() methods. When all data has been checksummed, the checksum value is returned by sum.

Constructor & Destructor Documentation

◆ Fletcher()

Fletcher ( void  )

Build a new Fletcher checksum builder.

◆ ~Fletcher()

~Fletcher ( void  )
virtual

Member Function Documentation

◆ flush()

int flush ( void  )
virtual

◆ lastErrorMessage()

cstring lastErrorMessage ( void  )
virtual

◆ operator<<() [1/4]

Fletcher& operator<< ( const char *  str)
inline

References Fletcher::put(), and elm::str().

◆ operator<<() [2/4]

Fletcher& operator<< ( const CString str)
inline

References Fletcher::put(), and elm::str().

◆ operator<<() [3/4]

Fletcher& operator<< ( const String str)
inline

References Fletcher::put(), and elm::str().

◆ operator<<() [4/4]

Fletcher& operator<< ( const T &  value)
inline

References Fletcher::put().

◆ put() [1/4]

void put ( const CString str)

Put a C string in the checksum.

Parameters
strC string to put in.

References Fletcher::put(), and elm::str().

◆ put() [2/4]

void put ( const String str)

Put a string in the checksum.

Parameters
strString to put in.

References Fletcher::put(), and elm::str().

◆ put() [3/4]

void put ( const void block,
int  length 
)

Put a data block in the checksum.

Parameters
blockBlock address.
lengthBlock length.

References Fletcher::put().

◆ put() [4/4]

void put ( io::InStream in)

Checksum the given stream.

Parameters
inStream to checksum.

Referenced by Fletcher::operator<<(), Fletcher::put(), and Fletcher::write().

◆ sum()

t::uint32 sum ( void  )

Return the checksum.

Parameters
checksumCurrent checksum.

◆ write()

int write ( const char *  buffer,
int  size 
)
virtual

References Fletcher::put().


The documentation for this class was generated from the following files: