srecord  1.65.0
srecord::memory_chunk Class Reference

The srecord::memory_chunk class is used to represent portion of memory. More...

#include <chunk.h>

Public Types

enum  { size = 7 * 256 }
 

Public Member Functions

 memory_chunk (unsigned long address)
 The constructor. More...
 
 memory_chunk (const memory_chunk &)
 The copy constructor. More...
 
memory_chunkoperator= (const memory_chunk &)
 The assignment operator. More...
 
 ~memory_chunk ()
 The destructor. More...
 
void set (unsigned long offset, int value)
 The set method is used to set the byte at the given offset within the chunk. More...
 
int get (unsigned long offset)
 The get method is used to get the value at the given offset within the chunk. More...
 
bool set_p (unsigned long) const
 The get_p method is used to determine whether the byte at the given offset within the chunk contains valid data. More...
 
void walk (memory_walker::pointer) const
 The walk method is used to iterate across all of the bytes which are set within the chunk, calling the walker's observe method. More...
 
unsigned long get_address () const
 The get_address method is used to get the address of the memory chunk. More...
 
bool find_next_data (unsigned long &, void *, size_t &) const
 The find_next_data method is used when iteratinbg across all of the bytes set within the chunk. More...
 
unsigned long get_upper_bound () const
 The get_upper_bound method is used to determine the upper bound (offset of last byte with valid data, plus one) of the chunk. More...
 
unsigned long get_lower_bound () const
 The get_lower_bound method is used to determine the lower bound (offset of first byte with valid data) of the chunk. More...
 

Static Public Member Functions

static bool equal (const memory_chunk &, const memory_chunk &)
 The equal class method is used to determine wherther two memory chunks are equal. More...
 

Detailed Description

The srecord::memory_chunk class is used to represent portion of memory.

Not all bytes are actually set, so there is a bit map of which bytes actually contain data.

Definition at line 33 of file chunk.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
size 

The size value is the size, in bytes, of each memory chunk.

Note
Code that uses this value shall not assume that it is, or will ever be, a power of 2. The compiler will optimize for you, don't do premature optimizations like bit masks and bit shifts.
If you change this value, you will have to change tests test/01/t0199a.sh and test/02/t0200a.sh to match, otherwise it will fail. Make sure that interactions with srecord::output_filter_reblock are what you intended, too.

Definition at line 36 of file chunk.h.

Constructor & Destructor Documentation

◆ memory_chunk() [1/2]

srecord::memory_chunk::memory_chunk ( unsigned long  address)

The constructor.

◆ memory_chunk() [2/2]

srecord::memory_chunk::memory_chunk ( const memory_chunk )

The copy constructor.

◆ ~memory_chunk()

srecord::memory_chunk::~memory_chunk ( )

The destructor.

Member Function Documentation

◆ operator=()

memory_chunk& srecord::memory_chunk::operator= ( const memory_chunk )

The assignment operator.

◆ set()

void srecord::memory_chunk::set ( unsigned long  offset,
int  value 
)

The set method is used to set the byte at the given offset within the chunk.

◆ get()

int srecord::memory_chunk::get ( unsigned long  offset)

The get method is used to get the value at the given offset within the chunk.

◆ set_p()

bool srecord::memory_chunk::set_p ( unsigned long  ) const

The get_p method is used to determine whether the byte at the given offset within the chunk contains valid data.

◆ walk()

void srecord::memory_chunk::walk ( memory_walker::pointer  ) const

The walk method is used to iterate across all of the bytes which are set within the chunk, calling the walker's observe method.

◆ get_address()

unsigned long srecord::memory_chunk::get_address ( ) const
inline

The get_address method is used to get the address of the memory chunk.

This is NOT the address of the first byte, it is the chunk number. To calculate the byte address, multiply by size.

Definition at line 102 of file chunk.h.

◆ equal()

static bool srecord::memory_chunk::equal ( const memory_chunk ,
const memory_chunk  
)
static

The equal class method is used to determine wherther two memory chunks are equal.

The must have the same address, the same bit mask, and the same byte values on the valid bytes.

◆ find_next_data()

bool srecord::memory_chunk::find_next_data ( unsigned long &  ,
void *  ,
size_t &   
) const

The find_next_data method is used when iteratinbg across all of the bytes set within the chunk.

◆ get_upper_bound()

unsigned long srecord::memory_chunk::get_upper_bound ( ) const

The get_upper_bound method is used to determine the upper bound (offset of last byte with valid data, plus one) of the chunk.

It returns a memory byte address, NOT the chunk offset.

◆ get_lower_bound()

unsigned long srecord::memory_chunk::get_lower_bound ( ) const

The get_lower_bound method is used to determine the lower bound (offset of first byte with valid data) of the chunk.

It returns a memory byte address, NOT the chunk offset.


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