cgul_crc16_incr_cxx Class Reference

C++ bindings for cgul_crc16_incr More...

#include <cgul_crc16_incr_cxx.h>

Collaboration diagram for cgul_crc16_incr_cxx:
Collaboration graph

Public Member Functions

 cgul_crc16_incr_cxx (unsigned short g, unsigned short init, unsigned short final_xor, int reflected)
 
 cgul_crc16_incr_cxx (unsigned short g, unsigned short init, unsigned short final_xor, int reflected, size_t size_xor)
 
virtual ~cgul_crc16_incr_cxx ()
 
virtual void assign (const cgul_crc16_incr_cxx &rhs)
 
virtual unsigned long crc ()
 
virtual void update_block (const void *block, size_t length)
 
virtual void update_file (FILE *f)
 
virtual void update_fname (const char *fname)
 
virtual void reset ()
 
virtual cgul_crc16_incr_t get_obj () const
 
virtual cgul_crc16_incr_t take_obj ()
 
virtual void set_obj (cgul_crc16_incr_t rhs)
 

Detailed Description

This class provides the C++ bindings for C cgul_crc16_incr objects. The main purpose of this class is to convert the C-style function calls and exception handling in cgul_crc16_incr into C++-style function calls and exception handling.

Constructor & Destructor Documentation

§ cgul_crc16_incr_cxx() [1/2]

cgul_crc16_incr_cxx::cgul_crc16_incr_cxx ( unsigned short  g,
unsigned short  init,
unsigned short  final_xor,
int  reflected 
)
inline

Create a new cgul_crc16_incr_cxx object. Objects created with this constructor do not append the size to the data stream that is CRCed. The client is responsible for calling delete() on the object returned. If an error occurs, an exception is thrown.

Parameters
[in]ggenerator polynomial
[in]initinitial value loaded into the accumulator
[in]final_xorvalue to xor with the calculated crc
[in]reflectedwhether to use the reflected algorithm
See also
cgul_crc16__new()

References cgul_crc16_incr__new().

§ cgul_crc16_incr_cxx() [2/2]

cgul_crc16_incr_cxx::cgul_crc16_incr_cxx ( unsigned short  g,
unsigned short  init,
unsigned short  final_xor,
int  reflected,
size_t  size_xor 
)
inline

Create a new cgul_crc16_incr_cxx object. Objects created with this constructor append the size to the data stream that is CRCed. The client is responsible for calling delete() on the object returned. If an error occurs, an exception is thrown.

Parameters
[in]gpolynomial
[in]initinitial value loaded into the accumulator
[in]final_xorvalue to xor with the calculated crc
[in]reflectedwhether to use the reflected algorithm
[in]size_xorvalue to xor with the size before appending
See also
cgul_crc16__new_appends_size()

References cgul_crc16_incr__new_appends_size().

§ ~cgul_crc16_incr_cxx()

virtual cgul_crc16_incr_cxx::~cgul_crc16_incr_cxx ( )
inlinevirtual

Destructor.

References cgul_crc16_incr__delete().

Member Function Documentation

§ assign()

virtual void cgul_crc16_incr_cxx::assign ( const cgul_crc16_incr_cxx rhs)
inlinevirtual

Assign the current state of of rhs to this. This operation probably only makes sense if this and rhs have been constructed identically. If an error occurs, an exception is thrown.

Parameters
[in]rhsright-hand side

References cgul_crc16_incr__assign().

§ crc()

virtual unsigned long cgul_crc16_incr_cxx::crc ( )
inlinevirtual

This method completes the CRC calculation by performing the size XOR and the final XOR. Unlike cgul_crc16_cxx::crc(), this method does not reset the CRC-16 calculation. Instead, the current CRC-16 calculation can be continued with subsequent calls to cgul_crc16_incr_cxx::update_block(). The return value is the current value for the entire CRC-16 calculation. If an error occurs, an exception is thrown.

Returns
final crc value

References cgul_crc16_incr__crc().

§ update_block()

virtual void cgul_crc16_incr_cxx::update_block ( const void *  block,
size_t  length 
)
inlinevirtual

This method updates the CRC by adding all the bytes in block to the calculation.

Parameters
[in]blockblock of data to add to the crc
[in]lengthlength of block

References cgul_crc16_incr__update_block().

§ update_file()

virtual void cgul_crc16_incr_cxx::update_file ( FILE *  f)
inlinevirtual

This method updates the CRC by adding all the bytes (starting at the current offset) in the file f to the calculation. If an error occurs, an exception is thrown.

Parameters
[in]finput file

References cgul_crc16_incr__update_file().

§ update_fname()

virtual void cgul_crc16_incr_cxx::update_fname ( const char *  fname)
inlinevirtual

This method updates the CRC by adding all the bytes in the file with name fname to the calculation. If an error occurs, an exception is thrown.

Parameters
[in]fnameinput file name

References cgul_crc16_incr__update_fname().

§ reset()

virtual void cgul_crc16_incr_cxx::reset ( )
inlinevirtual

Reset to the initial internal state.

References cgul_crc16_incr__reset().

§ get_obj()

virtual cgul_crc16_incr_t cgul_crc16_incr_cxx::get_obj ( ) const
inlinevirtual

Get the underlying cgul_crc16_incr object.

Returns
underlying object

§ take_obj()

virtual cgul_crc16_incr_t cgul_crc16_incr_cxx::take_obj ( )
inlinevirtual

Take the underlying cgul_crc16_incr object. This means the underlying object will not be deleted when the wrapper goes out of scope. Also, because you have taken the underlying object, no other methods should be called on this wrapper's instance. Lastly, after taking the underlying object, it is the caller's responsibility to delete the underlying object by calling cgul_crc16_incr__delete().

Returns
underlying object

§ set_obj()

virtual void cgul_crc16_incr_cxx::set_obj ( cgul_crc16_incr_t  rhs)
inlinevirtual

Set the new underlying object to rhs. This causes the old underlying object to be deleted which invalidates any outstanding pointers to or iterators for the old underlying object.

This instance takes ownership of rhs which means rhs will be automatically deleted when the C++ wrapper is deleted. To prevent automatic deletion of rhs, call take_obj() when the C++ wrapper is no longer needed.

Parameters
[in]rhsright-hand side

References cgul_crc16_incr__delete().


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