C++ bindings for cgul_crc16_incr
More...
#include <cgul_crc16_incr_cxx.h>
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.
§ 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] | g | generator polynomial |
[in] | init | initial value loaded into the accumulator |
[in] | final_xor | value to xor with the calculated crc |
[in] | reflected | whether 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] | g | polynomial |
[in] | init | initial value loaded into the accumulator |
[in] | final_xor | value to xor with the calculated crc |
[in] | reflected | whether to use the reflected algorithm |
[in] | size_xor | value 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 |
§ assign()
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
-
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] | block | block of data to add to the crc |
[in] | length | length 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
-
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
-
References cgul_crc16_incr__update_fname().
§ reset()
virtual void cgul_crc16_incr_cxx::reset |
( |
| ) |
|
|
inlinevirtual |
§ get_obj()
Get the underlying cgul_crc16_incr
object.
- Returns
- underlying object
§ take_obj()
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()
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
-
References cgul_crc16_incr__delete().
The documentation for this class was generated from the following file: