srecord
1.65.0
|
The srecord::memory class is used to simulate memory contents. More...
#include <memory.h>
Public Member Functions | |
memory () | |
The default constructor. More... | |
memory (const memory &) | |
The copy constructor. More... | |
memory & | operator= (const memory &) |
The assignment operator. More... | |
~memory () | |
The destructor. More... | |
void | set (unsigned long address, int value) |
The set method is used to set the byte at the given ‘address’ to the given ‘value’. More... | |
int | get (unsigned long address) const |
The get method is used to fetch the value of the byte at the given 'address'. More... | |
bool | set_p (unsigned long address) const |
The set_p method is used to determine whether the byte at the given address has been set() yet. More... | |
void | walk (memory_walker::pointer) const |
The walk method is used to apply a memory_walker derived class to every byte of memory. More... | |
void | reader (const input::pointer &input, defcon_t redundant_bytes, defcon_t contradictory_bytes) |
The reader method is used to read the given ‘input’ source into memory. More... | |
bool | find_next_data (unsigned long &address, void *data, size_t &nbytes) const |
The find_next_data method may be used to locate data at or following the ‘address’ given. More... | |
record * | get_header (void) const |
The get_header method is used to determine the value of the header record set by either the reader() or set_header() methods. More... | |
void | set_header (const std::string &value) |
The set_header method may be used to set the header command. More... | |
record * | get_execution_start_address (void) const |
The get_execution_start_address method is used to determine the value of the execution start address record set by either the reader() or set_execution_start_address() methods. More... | |
void | set_execution_start_address (unsigned long value) |
The set_execution_start_address method may be used to set the execution start address record. More... | |
bool | has_holes (void) const |
The has_holes method may be used to determine whether or not the memory data has "holes" in it. More... | |
unsigned long | get_lower_bound () const |
The get_lower_bound method is used to obtain the lower bound (lowest address) of the memory image. More... | |
unsigned long | get_upper_bound () const |
The get_upper_bound method is used to obtain the upper bound (maximum address plus one) of the memory image. More... | |
bool | is_well_aligned (unsigned multiple) const |
The is_well_aligned method is used to test whether or not all of the data in the memory buffer is well aligned, on the given byte boundary. More... | |
bool | empty (void) const |
The empty method is used to determine whether or not this memory image has no data in it. More... | |
Static Public Member Functions | |
static bool | equal (const memory &, const memory &) |
The equal method may be used to determine if two memory instances are equal. More... | |
static bool | compare (const memory &, const memory &) |
The compare method may be used to determine if two memory instances are equal. More... | |
The srecord::memory class is used to simulate memory contents.
This allows staging of reord adta, and also validation of contents.
srecord::memory::memory | ( | ) |
The default constructor.
srecord::memory::memory | ( | const memory & | ) |
The copy constructor.
srecord::memory::~memory | ( | ) |
The destructor.
void srecord::memory::set | ( | unsigned long | address, |
int | value | ||
) |
The set method is used to set the byte at the given ‘address’ to the given ‘value’.
Uses the find() method to locate the chunk, and then calls the memory_chunk::set method, to set the byte within the chunk.
int srecord::memory::get | ( | unsigned long | address | ) | const |
The get method is used to fetch the value of the byte at the given 'address'.
If you fo a get on an address which has not been set() yet, the results are undefined.
Uses the find() method to locate the chunk, and then calls the memory_chunk::get method, to get the byte within the chunk.
bool srecord::memory::set_p | ( | unsigned long | address | ) | const |
The set_p method is used to determine whether the byte at the given address has been set() yet.
Returns true if already set, false if never been set.
Uses the find() method to locate the chunk, and then calls the memory_chunk::set_p method, to get the status of the byte within the chunk.
void srecord::memory::walk | ( | memory_walker::pointer | ) | const |
The walk method is used to apply a memory_walker derived class to every byte of memory.
void srecord::memory::reader | ( | const input::pointer & | input, |
defcon_t | redundant_bytes, | ||
defcon_t | contradictory_bytes | ||
) |
The reader method is used to read the given ‘input’ source into memory.
This method may be called multiple times, for multiple input files.
If the input format supports headers, and the file has a header, the first header will be remembered, if set_header() was not called previously.
input | The source of the byte stream |
redundant_bytes | ignore: do nothing warning: issue a warning and continue (default) error: issuse a atal error message, and exit failure. |
contradictory_bytes | If the value at any address is set more than once, Thid argument controls what happeens. ignore: do nothing warning: issue a warning and continue (default) error: issuse a atal error message, and exit failure (default). |
The equal method may be used to determine if two memory instances are equal.
The compare method may be used to determine if two memory instances are equal.
Verbose messages concerning the exact differences are printed if they are not equal.
bool srecord::memory::find_next_data | ( | unsigned long & | address, |
void * | data, | ||
size_t & | nbytes | ||
) | const |
The find_next_data method may be used to locate data at or following the ‘address’ given.
Returns false if there is no data meeting this criteria.
If there is data, the ‘address’ will be set to the start address of the data block. At most ‘nbytes’ of data will be transfetrred into the ‘data’ array. Then ‘nbytes’ wil be set to the number of bytes transferred. Returns true.
Calls the find_next_chunk() method.
record* srecord::memory::get_header | ( | void | ) | const |
The get_header method is used to determine the value of the header record set by either the reader() or set_header() methods.
If neither has set a header, a NULL is returned.
void srecord::memory::set_header | ( | const std::string & | value | ) |
The set_header method may be used to set the header command.
value | The ‘value’ string, to set the header. The user may use URL encoding for of the more interesting non-printable byte values (eg. "%3F"). |
record* srecord::memory::get_execution_start_address | ( | void | ) | const |
The get_execution_start_address method is used to determine the value of the execution start address record set by either the reader() or set_execution_start_address() methods.
If neither has set an execution start address, NULL is returned.
void srecord::memory::set_execution_start_address | ( | unsigned long | value | ) |
The set_execution_start_address method may be used to set the execution start address record.
bool srecord::memory::has_holes | ( | void | ) | const |
The has_holes method may be used to determine whether or not the memory data has "holes" in it.
unsigned long srecord::memory::get_lower_bound | ( | ) | const |
The get_lower_bound method is used to obtain the lower bound (lowest address) of the memory image.
unsigned long srecord::memory::get_upper_bound | ( | ) | const |
The get_upper_bound method is used to obtain the upper bound (maximum address plus one) of the memory image.
bool srecord::memory::is_well_aligned | ( | unsigned | multiple | ) | const |
The is_well_aligned method is used to test whether or not all of the data in the memory buffer is well aligned, on the given byte boundary.
multiple | The desired byte alignment. |
|
inline |