#include <reversedNumericData.h>
Public Member Functions | |
ReversedNumericData (const void *data, size_t length) | |
This constructor accepts the address of a numeric variable, and its sizeof. | |
ReversedNumericData (const void *data, size_t start, size_t length) | |
This constructor accepts a pointer to a data array containing a packed numeric value, the offset within the array at which the numeric value starts, and the size of the numeric value. | |
void | store_value (void *dest, size_t length) const |
Copies the data, with byte reversal if appropriate, into the indicated numeric variable, whose address and sizeof are given. | |
const void * | get_data () const |
Returns the pointer to the first byte of the data, either reversed or nonreversed, as appropriate. | |
Private Member Functions | |
void | reverse_assign (const char *source, size_t length) |
Actually does the data reversal. | |
Private Attributes | |
char | _data [max_numeric_size] |
Both of these classes provide interfaces that accept a pointer to a numeric variable and the size of the number, and they can append that data to the end of a string, or memcpy it into another location.
The difference is that NativeNumericData simply passes everything through unchanged, while ReversedNumericData always byte-swaps everything. Otherwise, they have the same interface.
The transparent part comes from LittleEndian and BigEndian, which are typedeffed to be one of these or the other, according to the machine's architecture.
Definition at line 76 of file reversedNumericData.h.
|
This constructor accepts the address of a numeric variable, and its sizeof.
Definition at line 34 of file reversedNumericData.I. References INLINE, length, and reverse_assign(). |
|
This constructor accepts a pointer to a data array containing a packed numeric value, the offset within the array at which the numeric value starts, and the size of the numeric value. It is essential that the array not be destructed or modified as long as the NumericData object remains; it may just store a pointer into that string's internal buffer. Definition at line 63 of file reversedNumericData.I. |
|
Returns the pointer to the first byte of the data, either reversed or nonreversed, as appropriate.
Definition at line 95 of file reversedNumericData.I. Referenced by StreamWriter::add_be_int16(), Datagram::add_be_int16(), StreamWriter::add_be_int32(), Datagram::add_be_int32(), StreamWriter::add_be_int64(), Datagram::add_be_int64(), StreamWriter::add_float32(), Datagram::add_float32(), StreamWriter::add_float64(), Datagram::add_float64(), and StreamWriter::add_uint64(). |
|
Actually does the data reversal.
Definition at line 36 of file reversedNumericData.cxx. Referenced by ReversedNumericData(). |
|
Copies the data, with byte reversal if appropriate, into the indicated numeric variable, whose address and sizeof are given.
Definition at line 80 of file reversedNumericData.I. Referenced by DatagramIterator::get_be_int16(), StreamReader::get_float32(), DatagramIterator::get_float64(), and StreamReader::get_uint64(). |
|
Definition at line 86 of file reversedNumericData.h. Referenced by ReversedNumericData(). |