An encapsulation of a block of memory. More...
#include <MemoryBlock.h++>

Public Member Functions | |
| MemoryBlock (byte_t *base=NULL, size_t size=0) throw () | |
| Construct a new MemoryBlock. | |
| virtual | ~MemoryBlock () throw () |
| Destructor. | |
| void | zero () throw () |
| Zero the memory block. | |
| void | fill (byte_t value) throw () |
| Fill the memory block with the given byte value. | |
| byte_t * | getBase () throw () |
| Get a pointer to the beginning of the memory block. | |
| const byte_t * | getBase () const throw () |
| Get a pointer to the beginning of the memory block. | |
| virtual void | setBase (byte_t *base) throw () |
| Set the pointer to the beginning of the memory block. | |
| size_t | getSize () const throw () |
| Get the size of the memory block. | |
| void | setSize (size_t size) throw () |
| Set the size of the memory block. | |
| bool | operator== (const MemoryBlock &other) const throw () |
| Equality operator. | |
| bool | operator!= (const MemoryBlock &other) const throw () |
| Inequality operator. | |
| byte_t | operator[] (int index) const throw (OutOfBoundsException) |
| Bounds-checked access. | |
| byte_t & | operator[] (int index) throw (OutOfBoundsException) |
| Bounds-checked access. | |
| bool | copyFrom (const MemoryBlock &other) throw () |
| Copy data from another memory block to this one. | |
| void | moveFrom (MemoryBlock &other) throw () |
| Copy data from another (possibly overlapping) memory block to this one. | |
| int | indexOf (byte_t val, uint_t startIndex=0) const throw () |
| Find the first occurrence of a given byte value in the memory block, starting at a given index. | |
| bool | operator! () const throw () |
| Test if the base of the block is NULL. | |
Protected Attributes | |
| byte_t * | _base |
| A pointer to the beginning of the memory block. | |
| size_t | _size |
| The size of the memory block, in bytes. | |
An encapsulation of a block of memory.
The class supports various bounds-checked memory operations.
| MemoryBlock | ( | byte_t * | base = NULL, |
|
| size_t | size = 0 | |||
| ) | throw () [inline] |
Construct a new MemoryBlock.
| base | The pointer to the beginning of the memory block. | |
| size | The size of the memory block, in bytes. |
| virtual ~MemoryBlock | ( | ) | throw () [inline, virtual] |
Destructor.
| bool copyFrom | ( | const MemoryBlock & | other | ) | throw () |
Copy data from another memory block to this one.
The number of bytes copied is the minimum of the sizes of the two blocks. The blocks may not overlap.
| other | The block to copy from. |
| void fill | ( | byte_t | value | ) | throw () |
Fill the memory block with the given byte value.
| const byte_t* getBase | ( | ) | const throw () [inline] |
Get a pointer to the beginning of the memory block.
| byte_t* getBase | ( | ) | throw () [inline] |
Get a pointer to the beginning of the memory block.
| size_t getSize | ( | ) | const throw () [inline] |
Get the size of the memory block.
Find the first occurrence of a given byte value in the memory block, starting at a given index.
| val | The value to search for. | |
| startIndex | The index to begin searching at. |
| void moveFrom | ( | MemoryBlock & | other | ) | throw () |
Copy data from another (possibly overlapping) memory block to this one.
The number of bytes copied is the minimum of the sizes of the two blocks.
| other | The block to copy from. Note that the copy may result in both blocks being modified, if the source area overlaps the target area. |
| bool operator! | ( | ) | const throw () [inline] |
Test if the base of the block is NULL.
| bool operator!= | ( | const MemoryBlock & | other | ) | const throw () [inline] |
Inequality operator.
| bool operator== | ( | const MemoryBlock & | other | ) | const throw () |
Equality operator.
| byte_t & operator[] | ( | int | index | ) | throw (OutOfBoundsException) |
Bounds-checked access.
| byte_t operator[] | ( | int | index | ) | const throw (OutOfBoundsException) |
Bounds-checked access.
| virtual void setBase | ( | byte_t * | base | ) | throw () [inline, virtual] |
Set the pointer to the beginning of the memory block.
Reimplemented in SharedMemoryBlock.
| void setSize | ( | size_t | size | ) | throw () [inline] |
Set the size of the memory block.
Reimplemented in SharedMemoryBlock.
| void zero | ( | ) | throw () [inline] |
Zero the memory block.
size_t _size [protected] |
The size of the memory block, in bytes.
1.6.3