The srecord::record class is used to represent a data record read from a file.
More...
#include <record.h>
|
| | ~record () |
| | The destructor.
|
| |
| | record () |
| | The default constructor.
|
| |
| | record (const record &) |
| | The copy constructor.
|
| |
| | record (type_t) |
| | A constructor.
|
| |
| | record (type_t, address_t) |
| | A constructor.
|
| |
| | record (type_t the_type, address_t the_address, const data_t *the_data, size_t the_data_length) |
| | A constructor.
|
| |
| record & | operator= (const record &) |
| | The assignment operator.
|
| |
| address_t | get_address (void) const |
| | The get_address method is used to get the address of the record.
|
| |
| address_t | get_address_end (void) const |
| | The get_address_end method is used to get the address "off
the end" of this record.
|
| |
| bool | address_range_fits_into_n_bits (unsigned nbits) const |
| | The address_range_fits_into_n_bits method is used to test whether or not this record's address range fits within the given number of bits.
|
| |
| void | set_address (address_t arg) |
| | The set_address method is used to set the address of the record.
|
| |
| size_t | get_length (void) const |
| | The get_length method is used to get the length (number of bytes) of the record data.
|
| |
| void | set_length (size_t arg) |
| | The set_length method is used to set the number of data bytes in the record data.
|
| |
| const data_t * | get_data (void) const |
| | The get_data method is used to get a ponter to the baseof the record data.
|
| |
| int | get_data (size_t n) const |
| | The get_data method is used to fetch the nth data value.
|
| |
| bool | is_all_zero (void) const |
| | The is_all_zero method is used to determin if the record contains data bytes which are all zero.
|
| |
| void | set_data (size_t n, data_t d) |
| | The set_data method is used to set values in the data array.
|
| |
| void | set_data_extend (size_t n, data_t d) |
| | The set_data_extend method is used to set values in the data array.
|
| |
| type_t | get_type (void) const |
| | The get_type method is used to get the type of the record.
|
| |
| void | set_type (type_t arg) |
| | The set_type method is used to set the type of the record.
|
| |
|
| static size_t | maximum_data_length (address_t addr) |
| | The maximum_data_length method is used to determine the maximum data length possible within a record, for a given address.
|
| |
| static address_t | decode_big_endian (const data_t *data, size_t len) |
| | The decode_big_endian method is used to extract 'len' bytes from the given 'data' and assemble a big-endian value (most significant byte first).
|
| |
| static address_t | decode_little_endian (const data_t *data, size_t len) |
| | The decode_little_endian method is used to extract 'len' bytes from the given 'data' and assemble a little-endian value (least significant byte first).
|
| |
| static address_t | decode (const data_t *data, size_t len, endian_t end) |
| | The decode method is used to extract 'len' bytes from the given 'data' and assemble a valu.
|
| |
| static void | encode_big_endian (data_t *data, address_t val, size_t len) |
| | The encode_big_endian method is used to break down 'val' into 'len' bytes of 'data' orderdd big-endian (most significan byte first).
|
| |
| static void | encode_little_endian (data_t *data, address_t val, size_t len) |
| | The encode_little_endian method is used to break down 'val' into 'len' bytes of 'data' orderdd big-endian (least significan byte first).
|
| |
| static void | encode (data_t *data, address_t val, size_t len, endian_t end) |
| | The encode method is used to break down 'val' into 'len' bytes of 'data'.
|
| |
The srecord::record class is used to represent a data record read from a file.
(It is not limited to any particular file format.) The records may be of various types.
Definition at line 34 of file record.h.
◆ address_t
The type of record addresses.
Definition at line 58 of file record.h.
◆ data_t
The type of record data values.
Definition at line 63 of file record.h.
◆ type_t
The type of the various record types.
| Enumerator |
|---|
| type_unknown | |
| type_header | |
| type_data | |
| type_data_count | |
| type_execution_start_address | |
Definition at line 46 of file record.h.
◆ anonymous enum
| Enumerator |
|---|
| max_data_length | The max_data_length is the largest number of data bytes which any record can hold.
|
Definition at line 343 of file record.h.
◆ ~record()
| srecord::record::~record |
( |
| ) |
|
The destructor.
It isn't virtual, so don't derive anything from this class.
◆ record() [1/5]
| srecord::record::record |
( |
| ) |
|
The default constructor.
The record will have an indeterminate type, zero address, and no data.
Referenced by operator=(), and record().
◆ record() [2/5]
| srecord::record::record |
( |
const record & | | ) |
|
The copy constructor.
References record().
◆ record() [3/5]
| srecord::record::record |
( |
type_t | | ) |
|
A constructor.
The record will have the given type, a zero address and no data.
◆ record() [4/5]
A constructor.
The record will have the given type, the given address and no data.
◆ record() [5/5]
| srecord::record::record |
( |
type_t | the_type, |
|
|
address_t | the_address, |
|
|
const data_t * | the_data, |
|
|
size_t | the_data_length ) |
A constructor.
The record will have the given type, the given address and a copy of the given data.
- Parameters
-
| the_type | What kind of record this is |
| the_address | The memory address of the first byte of data, the rest increase by one each. |
| the_data | The bytes of data for the record. |
| the_data_length | How long the data is. assert(the_data_length < max_data_length); |
◆ operator=()
The assignment operator.
References record().
◆ get_address()
| address_t srecord::record::get_address |
( |
void | | ) |
const |
|
inline |
The get_address method is used to get the address of the record.
Definition at line 115 of file record.h.
◆ get_address_end()
| address_t srecord::record::get_address_end |
( |
void | | ) |
const |
|
inline |
The get_address_end method is used to get the address "off
the end" of this record.
Definition at line 121 of file record.h.
◆ address_range_fits_into_n_bits()
| bool srecord::record::address_range_fits_into_n_bits |
( |
unsigned | nbits | ) |
const |
The address_range_fits_into_n_bits method is used to test whether or not this record's address range fits within the given number of bits.
- Parameters
-
| nbits | The number of bits, e.g. 16 |
- Returns
- true if the address range will fit, or false if it will not fit
◆ set_address()
| void srecord::record::set_address |
( |
address_t | arg | ) |
|
|
inline |
The set_address method is used to set the address of the record.
Definition at line 138 of file record.h.
◆ get_length()
| size_t srecord::record::get_length |
( |
void | | ) |
const |
|
inline |
The get_length method is used to get the length (number of bytes) of the record data.
Definition at line 144 of file record.h.
◆ set_length()
| void srecord::record::set_length |
( |
size_t | arg | ) |
|
|
inline |
The set_length method is used to set the number of data bytes in the record data.
- Parameters
-
| arg | The new record length. Note that you can reduce the length, but you can't increase it. |
Definition at line 155 of file record.h.
◆ get_data() [1/2]
| const data_t * srecord::record::get_data |
( |
void | | ) |
const |
|
inline |
The get_data method is used to get a ponter to the baseof the record data.
Note: Accessing beyond get_length() bytes will give an undefined value.
Definition at line 168 of file record.h.
◆ get_data() [2/2]
| int srecord::record::get_data |
( |
size_t | n | ) |
const |
|
inline |
The get_data method is used to fetch the nth data value.
Note: For perfoemance reasons, no range checking is performed. Accessing beyond get_length() bytes will give an undefined value.
- Parameters
-
| n | The index into the data array, zero based. Values when n is in excess of length are undefined. |
Definition at line 181 of file record.h.
◆ is_all_zero()
| bool srecord::record::is_all_zero |
( |
void | | ) |
const |
The is_all_zero method is used to determin if the record contains data bytes which are all zero.
◆ set_data()
| void srecord::record::set_data |
( |
size_t | n, |
|
|
data_t | d ) |
|
inline |
The set_data method is used to set values in the data array.
No range checking is performed. The record length is not consulted or adjusted.
- Parameters
-
| n | The index into the data array, zero based. Results when n is in excess of length are undefined. |
| d | The new data value. |
Definition at line 200 of file record.h.
◆ set_data_extend()
| void srecord::record::set_data_extend |
( |
size_t | n, |
|
|
data_t | d ) |
The set_data_extend method is used to set values in the data array.
The record length is adjusted if necessary.
- Parameters
-
| n | The index into the data array, zero based. If this is beyond length, then length will be extended. assert(n < max_data_length); |
| d | The new data value. |
◆ get_type()
| type_t srecord::record::get_type |
( |
void | | ) |
const |
|
inline |
The get_type method is used to get the type of the record.
Definition at line 218 of file record.h.
◆ set_type()
| void srecord::record::set_type |
( |
type_t | arg | ) |
|
|
inline |
The set_type method is used to set the type of the record.
Definition at line 223 of file record.h.
◆ maximum_data_length()
| static size_t srecord::record::maximum_data_length |
( |
address_t | addr | ) |
|
|
static |
The maximum_data_length method is used to determine the maximum data length possible within a record, for a given address.
- Parameters
-
| addr | The address of the record. Some formats trade data size of address size, for a constant maximum line length. |
◆ decode_big_endian()
| static address_t srecord::record::decode_big_endian |
( |
const data_t * | data, |
|
|
size_t | len ) |
|
static |
The decode_big_endian method is used to extract 'len' bytes from the given 'data' and assemble a big-endian value (most significant byte first).
- Parameters
-
| data | The data to be decodes |
| len | Length of the data, in bytes |
- Returns
- the decoded value
Referenced by decode().
◆ decode_little_endian()
| static address_t srecord::record::decode_little_endian |
( |
const data_t * | data, |
|
|
size_t | len ) |
|
static |
The decode_little_endian method is used to extract 'len' bytes from the given 'data' and assemble a little-endian value (least significant byte first).
- Parameters
-
| data | The data to be decodes |
| len | Length of the data, in bytes |
- Returns
- the decoded value
Referenced by decode().
◆ decode()
◆ encode_big_endian()
| static void srecord::record::encode_big_endian |
( |
data_t * | data, |
|
|
address_t | val, |
|
|
size_t | len ) |
|
static |
The encode_big_endian method is used to break down 'val' into 'len' bytes of 'data' orderdd big-endian (most significan byte first).
- Parameters
-
| data | Where to place the encoded data |
| val | The value to be encoded |
| len | The number of bytes to use to encode the data. Bits above the 8*len resolution will be discarded. |
Referenced by encode().
◆ encode_little_endian()
| static void srecord::record::encode_little_endian |
( |
data_t * | data, |
|
|
address_t | val, |
|
|
size_t | len ) |
|
static |
The encode_little_endian method is used to break down 'val' into 'len' bytes of 'data' orderdd big-endian (least significan byte first).
- Parameters
-
| data | Where to place the encoded data |
| val | The value to be encoded |
| len | The number of bytes to use to encode the data. Bits above the 8*len resolution will be discarded. |
Referenced by encode().
◆ encode()
The encode method is used to break down 'val' into 'len' bytes of 'data'.
- Parameters
-
| data | Where to place the encoded data |
| val | The value to be encoded |
| len | The number of bytes to use to encode the data. Bits above the 8*len resolution will be discarded. |
| end | The byte order |
Definition at line 335 of file record.h.
References encode_big_endian(), encode_little_endian(), and srecord::endian_big.
The documentation for this class was generated from the following file: